text:
Q: how to create react native header as svg/ and manipulating the svg? I'm trying to create my custom header component for a react native app,

import React from 'react'
import { StatusBar } from 'react-native'
import Svg, { Path } from 'react-native-svg'

export default function App () {
  StatusBar.setHidden(true)
  return (
    <Svg
      xmlns='http://www.w3.org/2000/svg'
      xlink='http://www.w3.org/1999/xlink'
      width='100%'
      height='186.919'
      viewBox='0 0 574.211 186.919'
    >
      <Path
        id='Path_2524-2'
        data-name='Path 2524'
        class='cls-1'
        d='M-815.085,1.627-985.466,25.151a739.285,739.285,0,0,1-202.451,0L-1358.3,1.627V-123.778h543.212Z'
        transform='translate(1373.8 134.28)'
        fill={'red'}
      />
    </Svg>
  )
}

I have attached my code, as well as the outcome photo.

I've tried changing the values of height and width in the svg component with no luck,I have also tried containing it in a view with absolute position, it's not getting the full width as well, can someone help me to accomplish what is in the second photo?


text:
Q: C++ Class.function syntax without initializing the class (Arduino) This is a very beginner question so please don't judge me too harshly. In C++, specifically on the Arduino platform although I doubt that makes a difference, I often use libraries that go like so:
#include "WiFi.h"

...
Serial.println("Supra");
WiFi.begin(MODE);
...

But I have never initialized these classes, but they seem to act like singletons. I looked for source that might shed some light but I didn't find anything.
How are these classes initialized? How would I make my own, for example called Messenger that would be accessible by just including its header file and then have the variable name Messenger with functions like Messenger.send?

A: From WiFi.h header in arduino-esp32 master branch:
class WiFiClass : public WiFiGenericClass, public WiFiSTAClass, public WiFiScanClass, public WiFiAPClass
{
// ...
};

// here global variable of class WiFiClass is defined
extern WiFiClass WiFi;

Now, when you execute WiFi.begin(whatever) you are invoking begin method from WiFiSTAClass that WiFiClass inherits.
From WiFiSTA.h :
class WiFiSTAClass
{
public:

    wl_status_t begin(const char* ssid, const char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);
    wl_status_t begin(char* ssid, char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);
wl_status_t begin();

// ...

If you would like to create your own class and a global variable of this class in the header, just create a header e.g. Myheader.hpp:
#pragma once
// MyHeader.hpp
class Messenger {
public:
    bool send() {
        // whatever
        return true;
    }
};

extern Messenger Msngr;

However, I strongly discourage you to follow this pattern. Using global variables is quite bad for many reasons. If for some reason you wish to avoid copying the objects of your class, just use smart pointers. If for some reason you wish the objects of your class to be created somewhere else, just create a Factory that will return the desired instances.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Los valores del vector no coinciden con los introducidos Estoy en los primeros pasos de aprender a programar en c y no se porque me esta pasando lo siguiente, al momento de imprimir desde una función me da valores erróneos y no entiendo el por qué.
En la función montosfacturas que esta en el final del código y ejecuto a través de un switch. Ahí radica el principal problema. Corrí alguna prueba imprimiendo los valores de ambos vectores y en un primer momento me dan los valores indicados, pero cuando los imprimo en el switch case 2 me encuentro con que ambos valores no concuerdan, aquí el código:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <iostream>

void cantFacturas(int),montosFacturas(int fac[],int cVen[]);
float prmF = 0;
int factura = 1, contF = 0, menu = 20, art[] = {0}, i = 1, n = 1, f = 0, fac[] = {0}, codArt = 0, cantArt = 0, totalArt = 0, vArt = 0, Vfac = 0, CajaDiaria = 0, bandera = 0;
int valArt[] = {0}, valFac[] = {0}, cVen[ ]= {0}, mFV[][61] = {0}, Articulo[] = {0}, facturasArticulo[] = {0};

int main()
{
    system("cls");

    while(menu != 9)
    {

        puts("\n...Elija su menu...\n");
        puts("Menu 0- Carga de Datos\n");
        puts("Menu 1- Cantidad de Facturas Emitidas\n");
        puts("Menu 2- Monto de Cada Factura\n");
        puts("Menu 3- Suma de las Facturas-Caja Diaria\n");
        puts("Menu 4- Cantidad Total de Articulos Vendidos\n");
        puts("Menu 5- Cantidad Vendida de cada Articulo\n");
        puts("Menu 6- Promedio de Importe de las Facturas\n");
        puts("Menu 7- Porcentual de cada Articulo sobre el Total\n");
        puts("Menu 8- Impresion Decendente del punto D\n");
        puts("Menu 9-Salir");
        puts("\nIngrese su Menu");
        scanf("%d", &menu);

        if(bandera == 0 && menu == 0)
        {
            switch(menu)
            {
                case 0:
                    for(i = 1; i <= 10; i++)
                    {
                        printf("Cargue el valor del Articulo Codigo =  %d\n",i);
                        scanf("%d", &vArt);
                        valArt[i] = vArt;
                        art[i] = i;
                    }

                    printf("\nIngrese el numero de Factura:   ");
                    scanf("%d", &fac[n]);
                    printf("el valor de fac[n] es %d", fac[n]);

                    while(fac[n] != 0)
                    {
                        printf("\nIngrese el codigo del Articulo:   ");
                        scanf("%d", &codArt);
                        printf("Ingrese la cantidad Vendida:   ");
                        scanf("%d", &cantArt);

                        cVen[n] = (cantArt * valArt[codArt]);//Punto B
                        CajaDiaria = CajaDiaria + (cantArt * valArt[codArt]);//Punto C
                        totalArt = totalArt + cantArt;//Punto D
                        Articulo[codArt] = (Articulo[codArt] + cantArt);//Punto E
                        facturasArticulo[codArt] = facturasArticulo[codArt]++;//punto F

                        n++;
                        contF++;//Punto A

                        printf("\nIngrese el numero de Factura:   ");
                        scanf("%d", &fac[n]);
                        printf("el valor de fac[n] es %d", fac[n]);
                    }
                    break;

                default:
                    printf("\nNo es una opcion del menu. ");
                    break;
                }
                bandera=1;
            }
            else if(bandera == 1 && menu != 0)
            {
                switch(menu)
                {
                    case 1:
                        cantFacturas(contF);
                        break;
                    case 2:
                        montosFacturas(fac,cVen);
                        break;
                    case 3:
                    case 4:
                    case 5:
                    case 6:
                    case 7:
                    case 8:
                    case 9:
                        printf("Gracias por usar Pellerano Factura System!!!!");
                        break;
                    default:
                        printf("\nNO EXISTE ESA OPCION");
                }
            }
            else if(menu != 0)
            {
                system("cls");
                printf("\nCargue los datos Primero");
                continue;
            }
            else
            {
                printf("\nNo puede cargar mas datos");
            }
        }
    return 0;
}

void cantFacturas(int)
{
    printf("\nLa cantidad de Facturas emitidas es: %d", contF);
}

void montosFacturas(int fac[], int cVen[])
{

    for(i = 1; i <= contF; i++)
    {
        printf("\nEl valor de la factura %d es igual a %d", fac[i], cVen[i]);// porque cuando lo imprimo no devuelve los valores indicados??
    }
}

A: El problema que tienes es que los usas arrays de tamaño 1:
int valArt[]={0};

He cogido este como muestra pero me vale cualquier otro. En esa línea estás declarando un array, valArt, con espacio para un único elemento... y estos arrays no se van a redimensionar en el futuro, luego si tu escribes en posiciones diferentes a valArt[0] pisarás memoria de otras variables.
Aquí tienes dos posibles soluciones:
Determinas un número máximo de elementos y creas el array con ese tamaño
Es una opción un tanto rígida pero funciona bien siempre y cuando el número de elementos no sea desproporcionado:
#define MAX_ELEMENTOS 40

int valArt[MAX_ELEMENTOS] = {0};

Usas memoria dinámica
Esta opción te permita usar almacenar todos los elementos que necesites, ya que podrás alterar el tamaño del array en tiempo de ejecución:
// Array para 40 elementos
int * valArt = (int*)malloc(40 * sizeof(int));

// Aumentamos la reserva a 80
int* ptr = (int*)realloc(valArt, 80 * sizeof(int));
if( ptr == 0 )
{
  // Error al reservar la memoria
}
valArt = ptr;

// Liberamos la memoria reservada para el array
free(valArt);


text:
Q: Get list of tracks and filenames (or a way to play them) from iTunes on OS X On OS X, is there a way to ask iTunes for all the tracks it has, with some metadata (I'm most interested in the number of plays), and the filenames of the tracks (alternatively, simply a way to play them would be fine as well).
I know I could probably hack something up reading the iTunes database, but I'm looking for a solution that is not considered off-limits for acceptance into the Mac App Store.
Is this possible?

A: iTunes is a program - not an intrinsic unremovable part of the operating system like it is on iOS - which is why there is not a dedicated SDK on OSX. You can access via iTunes via AppleScript.
There are applications on the Mac app store that are just GUI's on top of AppleScript. http://dougscripts.com/itunes/category/mac-app-store/


text:
Q: React hook error in react-leaflet internally I am trying to implement a map with marker clusters using react-leaflet I am doing everything right because when I tried this with an older version of react and react-leaflet it was a success. But when I am using the latest version of react and react-leaflet it gives some react hook errors but I am unable to figure out the actual problem. I am not going with the older version because I already have a project with the latest version of react and I want to implement it into it.
I am putting the relevant code below.
This is App.js
// App.js

import "./App.css";
import Map from "./Components/Map/Map";
function App() {
  return <Map />;
}

export default App;

This is Map.js
// Map.js

import React, { useState } from "react";
import { Box, Button } from "@mui/material";
import Mapp from "./Mapp";

function Map() {
  const [center] = useState([12.9716, 77.5946]);
  const [status, setStatus] = useState("red");
  const [previosStatus, setPreviousStatus] = useState("red");
  const handleStatus = (value) => {
    if (value === status) {
      return setStatus(previosStatus);
    }
    setPreviousStatus(status);

    return setStatus(value);
  };
  return (
    <>
      <Mapp status={status} center={center} />
      <Box
        sx={{ display: "flex", justifyContent: "space-evenly", marginTop: 3 }}
      >
        <Button
          variant="contained"
          onClick={() => handleStatus("red")}
          sx={{
            backgroundColor: status === "red" ? "gray" : "red",
            color: status === "red" ? "black" : "white",
          }}
        >
          Red
        </Button>
        <Button
          variant="contained"
          onClick={() => handleStatus("green")}
          sx={{
            backgroundColor: status === "green" ? "gray" : "green",
            color: status === "green" ? "black" : "white",
          }}
        >
          Green
        </Button>
        <Button
          variant="contained"
          onClick={() => handleStatus("blue")}
          sx={{
            backgroundColor: status === "blue" ? "gray" : "blue",
            color: status === "blue" ? "black" : "white",
          }}
        >
          Blue
        </Button>
        <Button
          variant="contained"
          onClick={() => handleStatus("ok")}
          sx={{
            backgroundColor: status === "ok" ? "gray" : "purple",
            color: status === "ok" ? "black" : "white",
          }}
        >
          OK
        </Button>
        <Button
          variant="contained"
          onClick={() => handleStatus("all")}
          sx={{
            backgroundColor: status === "all" ? "gray" : "magenta",
            color: status === "ok" ? "black" : "white",
          }}
        >
          ALL
        </Button>
      </Box>
    </>
  );
}

export default Map;

This is Mapp.js
// Mapp.js

import React from "react";
import data from "./data";
import { MapContainer, Marker, Popup, TileLayer } from "react-leaflet";
import MarkerClusterGroup from "react-leaflet-markercluster";
import "./styles.css";
import "react-leaflet-markercluster/dist/styles.min.css";
function Mapp(props) {
  const { center, status } = props;
  return (
    <MapContainer
      className="markercluster-map"
      style={{ height: "100vh", width: "100vw" }}
      center={center}
      zoom={8}
      maxZoom={20}
    >
      <TileLayer
        attribution='© OpenStreetMap contributors'
        url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
      />
      <MarkerClusterGroup>
        {data.map((location, index) => {
          if (location.status === status || status === "all")
            return (
              <Marker key={index} position={[location.lat, location.lng]}>
                <Popup>{location.batteryId}</Popup>
              </Marker>
            );
          return null;
        })}
      </MarkerClusterGroup>
    </MapContainer>
  );
}

export default Mapp;

The data.js file contains data like
const data = [
  {
    lat: 12.8466368,
    lng: 77.676544,
    status: "...",
    location: "....",
    batteryId: "....",
    substatus: "....",
  },
 {
    lat: 12.8466368,
    lng: 77.676544,
    status: "...",
    location: "....",
    batteryId: "....",
    substatus: "....",
  },
...
]

export default data;

This is package.json
{
  "name": "leaflet-map-latest",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.9.0",
    "@emotion/styled": "^11.8.1",
    "@mui/material": "^5.8.3",
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.3.0",
    "@testing-library/user-event": "^13.5.0",
    "leaflet": "^1.8.0",
    "react": "^18.1.0",
    "react-dom": "^18.1.0",
    "react-leaflet": "^4.0.0",
    "react-leaflet-markercluster": "^3.0.0-rc1",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

This is the error that is showing in the console. However, it compiles successfully.

Thank you.


text:
Q: Uses of "this" Keyword I'm studying the uses of this and I think I understand it, at least partially, like when to solve ambiguity and to call methods from the "current" class, but one example from the book I'm reading(Head First C#) is giving me a hard time:
public void SpeakTo(Elephant whoToTalkTo, string message) {
    whoToTalkTo.TellMe(message, this);
}

In this method, is it safe to say that the this has the function of always refering to whatever object calls the method SpeakTo(), regardless of which class the call is written in?

A: No... Actually, this in your context refers to the object on which SpeakTo is defined, not the object which calls it.
Let's put it this way:

*

*Object speaker is of the class Speaker which defines the SpeakTo
method,

*Object caller is calling the speaker.SpeakTo(), and

*Object whoToTalkTo is of the class which defines the TellMe(string, Speaker)
As you can see, whoToTalkTo is expecting the Speaker class instance. Then, the speaker object is precisely that, and it is free to pass this as the argument.
Now we can construct a larger example in which these relations are becoming more obvious:
class Speaker
{
    public int Data { get; set; }

    public void SpeakTo(Elephant whoToTalkTo, string message)
    {
        // Passing current instance of this class as the argument
        whoToTalkTo.TellMe(message, this);
    }
}

This Speaker class contains a piece of state. Now I will use the whoToTalkTo object to change that state:
class Talker
{
    public void TellMe(string message, Speaker speaker)
    {
        speaker.Data = message.Length;
    }
}

This implementation is changing the state of one particular object which was passed to it.
Now the ultimate caller comes to the picture, the one which actually selects the Speaker object which will be subjected to the TellMe() method:
class Caller
{
    public void DoWork()
    {
        Talker talker = new Talker();

        Speaker one = new Speaker();
        Speaker two = new Speaker();

        // This sets one.Data to length of "something"
        one.SpeakTo(talker, "something");

        // This sets two.Data to length of "else"
        two.SpeakTo(talker, "else");

        Console.WriteLine(one.Data);
        Console.WriteLine(two.Data);
    }
}

This code will print values 9 and 4, which indicates that the whoToTalkTo has actually been modifying the state of two distinct objects.

A:
In this method, is it safe to say that the "this" has the function of always refering to whatever object calls the method "SpeakTo()", regardless of which class the call is written in?

Nope. this does not refer to the object that calls SpeakTo. It refers to the object on which SpeakTo is called.
I will use some code to clarify this point
class Foo {
    public static void Main(String[] args) {
        var foo = new Foo();
        foo.MyMethod();
    }

    public void MyMethod() {
         var bar = new Bar();
         bar.SpeakTo(anElephant, "Hello");
     }
}

class Bar {
    public void SpeakTo(Elephant whoToTalkTo, string message) {
       whoToTalkTo.TellMe(message, this);
    }
}

According to your statement, this refers to the foo variable that's created in the main method. This is not the case. this actually refers to bar. i.e. the object that's before the method name.

A: this refers to the current object of the class which has method SpeakTo.
consider the following example:
public class A
{
      public void SpeakTo(Elephant whoToTalkTo, string message) {
          whoToTalkTo.TellMe(message, this);
       }
}

Now if you instantiate an object of A and calls the method SpeakTo it will be like:
A obj = new A();
obj.SpeakTo();

In the method SpeakTo, this refers to the current object, i.e. obj.
The signature of method TellMe should look like:
public void TellMe(string message, A objOfA)


text:
Q: Grep for multiple strings, show number of lines after one of the strings (but not the other) I would like to search a file for multiple strings and for one particular string, show the 5 lines following it as well.
cat file | grep -e 'string1' -e 'string2'

works of course, but I would like to get something like
cat file | grep -e 'string1' -e -A 5 'string2'

How can I make it so that (I'm assuming using the -A 5 option) it shows only the lines containing string1 and only the lines containing string2 and the 5 lines after string2, but not the 5 lines after string1?
EDIT: just got it working with awk:
cat file | awk '/string1/{c=1}/string2/{c=5}{while(c-->0){print;getline}}'

A: about awk code
awk '/string1/ {if ( c <= 0 ) c = 1;} /string2/ {c=5} { if (c-- > 0) print; }' file

*

*do not cat ... | awk, awk can read file.

*I rearrange test (if string1 is one line after string2, it interrupt printing in OP's solution)

A: You can't do that using one go of grep. You need to use two grep instances :
grep 'string1' file; grep -A 5 'string2' file

If you want to run the second upon success of the first one :
grep 'string1' file && grep -A 5 'string2' file

A: Sed solution:
sed -n '/string2/,+4{p;b;};/string1/p' file

my sed also accept ~ instead of +


text:
Q: Send a kafka consumer record as json response from a resource and build again from json response How can I convert a kafka consumer record object into json string and send from a resource, and then on the client side take that json and construct a consumer record?
The application isn't using any spring dependencies currently, just jax-rs.


text:
Q: PHP LDAP Options Not Defined I'm attempting to use the PHP LDAP module to put an authentication layer over some of my organization's content. The script works perfectly if I set LDAP_OPT_X_TLS_REQUIRE_CERT to 0, but if I don't, I get the following errors.

*

*ldap_error() returns "Unable to bind to server: Can't contact LDAP server"

*ldap_get_option() for LDAP_OPT_ERROR_STRING returns "TLS error -8179:Peer's Certificate issuer is not recognized."

This page suggests that the Peer's Certificate error can be resolved by putting the LDAP server's security certificates on my own server. I requested the PEM from the IT department. Now I need to determine where to put it.
When I try to get the expected certificate directory by printing ldap_get_option() for LDAP_OPT_X_TLS_CACERTDIR, I get the warning "ldap_get_option() expects parameter 2 to be integer, string given". Indeed, when I echo LDAP_OPT_X_TLS_CACERTDIR itself, the result is literally that string, not an integer.
For example:
echo LDAP_OPT_SIZELIMIT . '
';
echo LDAP_OPT_ERROR_STRING . '
';
echo LDAP_OPT_X_TLS_CACERTDIR;
die();

Result:
3
50
LDAP_OPT_X_TLS_CACERTDIR

This is a problem for every LDAP_OPT_X_? option listed in the documentation with the exception of LDAP_OPT_X_TLS_REQUIRE_CERT, which prints out as 24582.
Does anyone know why these options are not defined?

A: The Ldap-Option LDAP_OPT_X_TLS_CACERTDIR was introduced in PHP 7.1 to PHPs LDAP-Extension (https://github.com/php/php-src/commit/8e9e89610e2e196892dbb7b605c65923a3fedf87). So when you're using PHP 7.0 there's not really a chance to get that up and running without hacking the PHP-Sources yourself. The easiest choice would be to update to PHP 7.1


text:
Q: Win 7; How to stop the Explorer left navigation pane from opening it's folders when you click on drive letters? On my 2nd bootable backup drive (W7 freshly compiled from NTLite), when I click on a drive letter in the navigation pane, it keeps on opening folders there and the center pane. That makes it really hard ti use the left pane w/o manually condensing it back down to just the single 'Computer' entry. I have multiple drives with a total of seven partitions, I don't want to have it open both listings of the partition I'm interested in.
I realize I can click on the "-" before the drive or Computer entry too collapse the directory everytime, but that is a real pain and doesn't solve the problem.
My main bootable drive (loaded with W7 from RT7 Lite) does not have this problem.
BTW, when I use a open, save or save as dialog box, clicking on a drive letter only opens folders in the right pane (as it should).


text:
Q: GAE one to many Relationship JDO Example I read GAE doc about JDO but i didn't find such example that fit to my scenario. Please help me.
I have two JDO classes like A and B. "A" class have one to many relationship with "B". This relation is unowed also not dependent. class "A" and "B" has following structure (to make it simple i am not using annotations)
class A {

private String name;
private String id; // primary Key
private List<B> b;

..... getter setter
}

class B {

private Key key; // primary Key
private String id; // this is the attribute of the Class A
private String someData;

}

Now my scenario is that First I created class "A" objects one by one and save it to the data store using Persistent manager. For this storing "List<B> b " will be null bcz i don't have data for it.
After that lets suppose I provide a form that have two fields one for the "id" attribute of the Class "A" and other for "someData" attibute. In this user provide the "id" of one of the stored objects of class "A". When User submit the result i have to create a class "B" object and save it to data store and also have to add it in list of B of its corresponding Class "A" object. I hope you understand what i want to do.
Now my question is that what approach i have to use for maintaining this one to many relationship of JDO classes. Either i have to first retrieve the class "A" object based on the "id" provided in the form and after getting the object i get "list of B" class objects and add a "B" class object in the list and then save the class "A" object( As object is attached to the PM its automatically save) or other approach is that I just create the class "B" object and save it to the data store using PM.
If just creating B class object and saving it to the data store is persistent to the relationship. I simple word when i get the class A objects does "list of B" class object have the all objects linked to class "A" object ( because B class has attribute which is the primary key of class A )
Thanks

A: It seems to me that the GAE/J documentation at Java | Storing Data | Datastore | JDO | Entity Relationships in JDO | Unowned Relationships should help you here.
Because the relationship between A and B is unowned, all A and B instances are in separate entity groups. Therefore, you will have to perform two separate persistence operations to create/update/delete an instance of B and update the relevant instance of A accordingly.
Does this help?


text:
Q: Can you create calendar event for a future date at a specific time with Google Script? I want to create a calendar event based on when emails come into my inbox. I would like for this to occur 14 days after the email arrives, but specifically at 9am in the morning. Right now I am trying to make the script run the next day at 9am, and then create an event 13 days from that run time. Is there any more effective way to do this in the script itself?
//This script runs the next day around 9am, calendar invite will be created for 13 days form then
    to account for the next day
var now = new Date().getTime();
var MILLIS_PER_DAY = 1000 * 60 * 60 * 24;
for (i in threads) {
  cals[0].createEvent(reminderLabel + '- '+ i.getFirstMessageSubject(),
    new Date(now+(MILLIS_PER_DAY*13)),
      new Date(now+(MILLIS_PER_DAY*13)+900000), {description: i.getPermalink()});
}

A: Here's a function I use to create events when I just want to notify myself 6 hours from now and I use a rather cryptic input technique which is described the html placeholder attribute of a textbox EventTitle/hours/min/ I split the input string on / if the length is 3 or less then I automatically create 30,15,0 minute notification but I just created an event two weeks from today and had a notification that will occur tommorow using this input string TwoWeeksFromToday/336/0/18720.  Here's the code.
function createEventWithReminders(eA) {
  var minute=60*1000;
  var hour=60*minute;
  var cal=CalendarApp.getCalendarById(getGlobal('DailyEventsId'));
  var now=new Date();
  var startValue=now.valueOf() + (Number(eA[1]) * hour ) + (Number(eA[2]) * minute);
  var start=new Date(startValue);
  var endValue=start.valueOf() + (10 * minute);
  var end=new Date(endValue);
  var event=cal.createEvent(eA[0], start, end);
  if(eA.length>3) {
    for(var i=3;i<eA.length;i++) {
      event.addEmailReminder(eA[i]);
    }
  }
  else{
    event.addEmailReminder(0);
    event.addEmailReminder(15);
    event.addEmailReminder(30);
  }
  return true;
}

I've been using it this way for about 3 years.
Image of Calendar Event:

A: You can run the function automatically daily on time-driven trigger
The content of the function should be the following

*

*Implement an if statement to list only the messages that arrived in the last 24 hours

*Create a date object that has the time 9:00 am of today

*For all new messages, create an event in 13 days from 9:00 am today

Sample (bind an installable time-driven trigger to it):
function myFunction() {
  var threads = GmailApp.getInboxThreads();
  var cals = CalendarApp.getAllCalendars();
  var now = new Date().getTime();
  var nineAm = new Date();
  nineAm.setHours(09);
  nineAm.setMinutes(00);
  nineAm = nineAm.getTime();
  var reminderLabel = "Reminder: ";
  var MILLIS_PER_DAY = 1000 * 60 * 60 * 24;
  for (var i =0; i <threads.length; i++) {
    if(threads[i].getLastMessageDate().getTime()>=(now-24*3600*1000)){
      Logger.log(threads[i].getLastMessageDate());
      cals[0].createEvent(reminderLabel + '- '+ threads[i].getFirstMessageSubject(),
        new Date(nineAm+(MILLIS_PER_DAY*13)),
          new Date(nineAm+(MILLIS_PER_DAY*13)+900000), {description: threads[i].getPermalink()});
    }else{
      return;
    }
  }
}

A: You can try this:
var event = CalendarApp.createEventFromDescription('Remind for email in 14 days at 9 am');
event.setTime(event.getEndTime(), event.getEndTime()); // fix Calendar bug with start date

Documentation: createEventFromDescription(description).


text:
Q: arrayfire python free device memory I am tryin to use arrayfire with python.
I have an GTX550Ti and use opencl backend since I don't seem to get cuda working (don't know if compute version 2.1 of the 550Ti is too low for arrayfire).
I try to free memory / arrays that are allocated using statement such as
import numpy as np
import arrayfire as af

arr_h = np.arange(2**15,dtype=np.complex64)
arr_d = af.np_to_af_array(arr_h)

af.free_device(arr_d)

the free_device complains and says it need a pointer.
If I use either
af.free_device(arr_d.raw_ptr())

or
af.free_device(arr_d.device_ptr())

I get an error:

OSError: exception: access violation reading 0xFFFFFFFFFFFFFFFFFFF

So.. what is the correct way to free memory?

A: af.free_device(devicepointer)

Frees a device object. But you are trying to free an array inside the device. I would try any of these:
arr_d = af.Array()
arr_d = None
del arr_d


text:
Q: Sending HTML emails that renders correctly in Notes 7 Does anyone here has any experience on how to send HTML emails that renders correctly on a Lotus Notes Client 7?
My email has a couple of complex CSS files and I tried embedding them on <style> tags, but it doesn't seem to work. The thing is that the email renders perfectly in version 8 and on other email clients.
Any hints or pointers?
Thanks!

A: Lotus Notes 7 has a terrible HTML engine. Really awful. It's not you.
Here's some old advice about dealing with it. I also suggest signing up for an email testing service like Litmus. You're never going to fix the problem, if you can't see the problem.
(In the template I was using, I found the problem was actually in the HTML. It has some sort of bizarre problem with the box model. Wrapping a bunch of elements in DIVs helped)

A: Here's a good chart for various email clients. Unfortunately only Notes 6 is covered at this point, but it gives you a starting point.
http://www.campaignmonitor.com/css/


text:
Q: Scoping issues when chaining class constructors Why does the following not work when chaining constructors:
#include <iostream>
#include <vector>

class cls {
public:
    cls()           {cls(5);}       // want to resize v to 5
    cls(int n)      {v.resize(n);}
    std::vector<int> v;
};

int main(int argc, const char* argv[]) {
    cls x, y(5);
    std::cout << x.v.size() << std::endl;   // prints 0 <- expected 5
    std::cout << y.v.size();                // prints 5
    return 0;
}

Demo: http://ideone.com/30UBzS
I expected both objects to have a v of size 5. What's wrong?
Reason I want to do this is because writing separate cls() and cls(n) ctors would duplicate a lot of code.

A: Calling cls(5); inside of the cls::cls() constructor is not doing what you think it is doing. It is creating a temporary variable using the second cls constructor which is destroyed at ;.
You can use C++11's delegating constructors to achieve what you want:
cls() : cls(5) { }

If you don't have a compiler that supports C++11, you can pull the common initialisation out into another function, and have both constructors call that:
class cls {
public:
    cls()           { init(5); }
    cls(int n)      { init(n); }
    std::vector<int> v;
private:
    void init(int n) { v.resize(n); }
};

A: You should change
cls()  {cls(5);}

to
cls()  {v.resize(5);}

Otherwise you are creating new temporary cls in the constructor and ignoring it.

OR If you want to delegate the constructor (C++11) do it like this
cls() : cls(5)  {}
//   ^^   ^
//        | use cls(int n)

delegated constructor are allowed only in the member initialization list of a constructor.

A: Here is what you need:
class cls
{
public:
       cls()
       :
       v( 5 ){}               // create v that contains 5 elements ( each initialized to 0 ) - note: this is NOT resizing

        explicit cls( const int size )
        :
        v( size ){}
private:
        std::vector<int> v;
};

Of course, if you need resizing feature on the living object, you will need a 'resize' method already mentioned in this thread.

A: cal(5) creates a completely different object, in fact it's a temporary meaning the object will be destroyed at the end of its encapsulation expression. Or it might not be called at all due to compiler optimization.
But with that aside, the constructor call only affects the temporary and not the original object calling the constructor.
If your intention was to make the code shorter, you should create a member function that does this (assuming your compiler doesn't support C++11, in which case you could simply use the Delegating Constructor feature):
class cls
{
    void resize(int n)
    {
        v.resize(n);
    }

    public:
        cls()           { resize(5); }
        cls(int n)      { resize(n); }
        std::vector<int> v;
};


text:
Q: can we code time in text widget? Is it possible to code time HH:MM:SS using text widget?
I know we can do this with label widget. My code deals with text widget and want to display time at any corner on the TKinter  window.
If possible how to delete and insert the text using label widgets. Text widget has the following methods default.
delete(startindex [,endindex])

This method deletes a specific character or a range of text.
insert(index [,string]...)

This method inserts strings at the specified index location.
 In my code the text has to be deleted and inserted all the time.
thanks.

A: delete from 1.0 to end.
import datetime

text.delete('1.0', 'end')
text.insert('end', datetime.datetime.now().strftime('%H:%M:%S')) # text.insert('end', label['text'])

label['text'] = datetime.datetime.now().strftime('%H:%M:%S')

Display Entry on bottom right
import datetime
from Tkinter import * # from tkinter import *   # Python 3.x

root = Tk()
root.geometry('500x500')
frame = Frame(root)
frame.pack(side=BOTTOM, fill=BOTH)

entry = Entry(frame)
entry.pack(side=RIGHT)
entry.insert(END, datetime.datetime.now().strftime('%H:%M:%S'))
root.mainloop()

def __init__(self):
    tk.Tk.__init__(self)
    self.geometry("1360x750")
    frameLabel = tk.Frame(self)
    self.text = tk.Text(frameLabel)
    frameLabel.pack(side=BOTTOM, fill=BOTH)
    self.text.pack(side=RIGHT)
    self.text.insert('end', 'TEST')
    self.queue = Queue.Queue()
    thread = SerialThread(self.queue)
    thread.start()
    self.process_serial()

UPDATE2
import datetime
from Tkinter import * # from tkinter import *   # Python 3.x

root = Tk()
root.geometry('500x500')
frame = Frame(root)
frame.pack(side=BOTTOM, fill=BOTH)

label = Label(frame)
label.pack(side=RIGHT)
label['text'] = datetime.datetime.now().strftime('%H:%M:%S')
root.mainloop()


text:
Q: How to configure EF Code First to not map a specific type? I was getting the following error when runing such this code:
var dbContext = new MyDbContext();
var list = dbContext.Set<TEntity>().ToList();

From the changes I made recently to codes I understood that because I added an event to the base class it causes all the problems:
public PropertyChangedEventHandler PropertyChangedEvent { get; set; }

Applying the NotMapped attribute to the above property my codes now are working again.
Now I want to know if there is anyway to autmatically tell EntityFramework to not Map properties of a specific type(which is not my own type, I could not apply any attribute to a .Net's type).
Exception:
Sequence does not contains any element.

at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Data.Entity.ModelConfiguration.Edm.Services.StructuralTypeMappingGenerator.GetEntityTypeMappingInHierarchy(DbDatabaseMapping databaseMapping, EdmEntityType entityType)
   at System.Data.Entity.ModelConfiguration.Edm.Services.AssociationTypeMappingGenerator.GenerateIndependentAssociationType(EdmAssociationType associationType, DbDatabaseMapping databaseMapping)
   at System.Data.Entity.ModelConfiguration.Edm.Services.AssociationTypeMappingGenerator.Generate(EdmAssociationType associationType, DbDatabaseMapping databaseMapping)
   at System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.GenerateAssociationTypes(EdmModel model, DbDatabaseMapping databaseMapping)
   at System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.Generate(EdmModel model)
   at System.Data.Entity.ModelConfiguration.Edm.EdmModelExtensions.GenerateDatabaseMapping(EdmModel model, DbProviderManifest providerManifest)
   at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)
   at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
   at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
   at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.InternalContext.Initialize()
   at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   at System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator()
   at System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()

A: You can use the Ignore method of DbModelBuilder to exclude a type from being mapped.
public class MyContext : DbContext
{
    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Ignore<PropertyChangedEventHandler>();
    }
}

A: Use the fluent interface.
public class Context : DbContext
{
  protected override void OnModelCreating(DbModelBuilder modelBuilder)
  {
    modelBuilder.Entity<TYPE>().Ignore(c => c.PROPERTY);
  }
}

Where TYPE and PROPERTY are relevant to your code, or use the Ignore method on the modelBuilder directly to ignore a type completely


text:
Q: get data in component angular 6 Hi I am new angular6 how can I get data to component, I have fetched data from api in incident.component.ts now I have a button called view details in incident.component.html when clicked the view detail button it will navigate to incident-detail component using router.navigate, now along with this I want send data which is in incident component.ts to incident-detail component.
incident.component.html

<button class="btn btn-sm btn-link"
(click)="onLoadActive(incident)">View in Detail</button>

incident.component.ts
    import { Component, OnInit } from '@angular/core';
    import { Router } from '@angular/router';
    import { Incidents } from '../../shared/models/incidents.model';
    import { DataStorageService } from '../../shared/services/data-storage.service';

    @Component({
    selector: 'app-active-incident',
    templateUrl: './active-incident.component.html',
    styleUrls: ['./active-incident.component.css']
    })
   export class ActiveIncidentComponent implements OnInit {
   detailData: any;

   onLoadActive(incident) {
   // some logic
   this.detailData = incident;
   this.router.navigate(['/active-detail']);
   }
   }

incident-detail.component.ts
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-active-incident-detail',
templateUrl: './active-incident-detail.component.html',
styleUrls: ['./active-incident-detail.component.css']
})
export class ActiveIncidentDetailComponent implements OnInit {

constructor() { }

ngOnInit() {
// want to get **detailData** here
}
}

A: There are distinguish ways to pass data between component to component.
1) User services by use of emit() and subscribe().
2) User @Input() decorator to pass data.
3) You can access data by store that data in common file's variable and fetch that data.
Make sure if reload page then you will note able to fetch data.
4) If amount of data's size is small then you can use cookie or local-storage.
If you use app selector of incident-detail component then go with second option. which is very easy to use. Otherwise go with first option.
For that, You have to create one service file.
E.x: common.service.ts  // shared/services/common.service.ts

Hear you have to make one variable.
import { Component, Injectable, EventEmitter } from '@angular/core';
incidentData = new EventEmitter<any>();

Now in you indecent.ts file.
import this `common.service.ts` file and add in constructor param.

Now emit() the event.
onLoadActive(event){
    this.commonService.incidentData.emit({data:{pass your any data hear}});
    // In this param you have to pass data which you want to send in other component.
}

Now you have to subscribe() this event into your other component.
In incident-detail component file.
Step 1 : Import common.service.ts file.
Step 2 : Subscribe event in component's constructor.
viewData : any = [];  // Used to display data
constructor(private commonService : CommonService){
    this.commonservice.incidentData.subscribe((data : any) => {
         console.log("Data from parent ::: " , JSON.stringify(data));
         this.viewData = data;
         // Now use this viewData array in you HTML file.
    })
}

In HTML file.

{{data.name}}

{{data.address}}

In your case, You have used *ngFor loop in incedent component. And pass that data in to another data. For that also you can also use emit() and subscribe() to do that.
E.x: // In your parent component. You have used ngFor.

    <button (click)="viewData(data)">View Details</button>

In Incedent.component.ts file
You have same set emit() as I explain above.
viewData(viewData){
    // Hear you have to emit event and pass data.
    this.commonService.incidentData.emit({data:viewData});
}

A: There are two ways to pass data into a component, with 'property binding' and 'event binding'. In Angular, data and event change detection happens top-down from parent to children. However for Angular events we can use the DOM event mental model where events flow bottom-up from child to parent. So, Angular events can be treated like regular HTML DOM based events when it comes to cancellable event propagation.
The @Input() decorator defines a set of parameters that can be passed down from the component's parent. For example, we can modify the TestComponent component so that name can be provided by the parent.
import { Component, Input } from '@angular/core';

@Component({
  selector: 'test',
  template: '
Hello, {{name}}!
',
})
export class TestComponent {
  @Input() name: string;
}

The point of making components is not only encapsulation, but also reusability. Inputs allow us to configure a particular instance of a component.
We can now use our component like this:

<test name="World"></test>

<test [name]="helloName"></test>

And dont forget to import your component in your typescript file.


text:
Q: What is better performance wise, 1 huge js and css file or multiple files Right now, I work on multiple css and js files but I combine them all together in 1 big file. I am not sure if this is the right way. For example my js file is about 200kb(Foundation + jQuery). This file is only loaded at the end of the body, so I am not sure what is the best way, I mean the file size won't get smaller anyway if I split them up.

A: You should always combine your CSS and JS files into a single file per type as a general rule.
However, if you really want to play around with load optimization, you can try to take advantage of the amount of simultaneous downloads a browser can do at one time. If it can do 6 at a time, then you won't see any major performance hit, and you may even get a performance gain, for having up to 6 separate files so they can download in parallel.
I personally wouldn't count on the simultaneous downloads though. It is a better rule of thumb to just combine them.
You can always use Googles PageSpeed to review your site for load optimization.

A: You should always combine and minify CSS and JS files. The browser makes fewer a separate request for each file you have. That's a small hit, but if you have a lot of files, it adds up.
https://developers.google.com/speed/docs/insights/MinifyResources
https://blog.hubspot.com/marketing/reduce-http-requests
Task runners like Grunt and Gulp can help with this. You can set up a script to minify and combine (concat) your files all in one action.
Or your IDE might even have it built in, so that everytime you save, a new file is compiled.
Always make sure your JS is right before the closing body tag, unless you have a specific reason to put it higher on the page.

A: The best solution for optimizing a website is firstly
 1. To reduce the number of files to be loaded which reduces the number of browser requests,
 2. To use server cache, to removing the repetition of MySql queries or connections
 3. To use browser cache for the bigs javascript files
 4. Synchronous and asynchronous requests or Ajax/Jquery


text:
Q: How can animals in the wizarding world go close to extinction? A comment on this question led me to read about the Golden Snidget on Pottermore (emphasis mine):

The Golden Snidget is an extremely rare, protected species of bird. Completely round, with a very long, thin beak and glistening, jewel-like red eyes, the Golden Snidget is an extremely fast flier that can change direction with uncanny speed and skill, owing to the rotational joints of its wings.
The Golden Snidget's feathers and eyes are so highly prized that it was at one time in danger of being hunted to extinction by wizards. The danger was recognised in time and the species protected, the most notable factor being the substitution of the Golden Snitch for the Snidget in the game of Quidditch. Snidget sanctuaries exist worldwide.
- Fantastic Beasts and Where to Find Them

We see that skilled witches and wizards are easily able to transfigure inanimate things into animals:

Then [McGonagall] changed her desk into a pig and back again. They were all very impressed and couldn't wait to get started, but soon realized they weren't going to be changing the furniture into animals for a long time.
- Harry Potter and the Philosopher's Stone, Chapter 8

So my question is, why would any animal (although I have provided only the Snidget as an example, I'm sure there are be more) be on the verge of extinction if it's fairly easy to perform a transfiguration and create more of them? Are there any rules or regulations in place prohibiting doing this?

A: Transfiguration gives something the APPEARANCE of something else, but it doesn't make it the actual thing.
So while you could transfigure a piece of wood into a Snidget, and it might look at act like a Snidget, it wouldn't have the magical qualities of a Snidget.
Just want to point out that in every case of transfiguration, that when they transfigured objects INTO animals, those animals were ALWAYS mundane.
A familiar or something that starts out magical might be transformed into an object, but you couldn't actually make a magical beast out of a desk. (Just a pig).
The rules Rowling has set forth regarding conjuration aren't the same as for transfiguration--with conjuration, you start out with nothing and conjure from thin air. With transfiguration you start out with something and make it into something else.
How permanent transfiguration is, is another consideration. We don't actually know if it is permanent. Dead bodies are hidden this way (Barty Crouch) transfigured into a log, and when Slughorn makes himself into a chair, I am going to assume that's not permanent because, gosh, hard to cast anything as a chair.
Because money and resources ARE an issue in the HP world, and such a thing would completely screw up an economy, I'd have to come to the conclusion that transfigurations aren't entirely permanent. So if you transfigured a shoe into a steak, there would be the possibility that either it would revert inside your stomach, wouldn't taste right, or might look like a steak but wouldn't provide all the nutrients. Otherwise, why not take dirt and transfigure that into anything from gold to tomatoes?
Plenty of things get transfigured, but I hadn't seen anything specifically mentioned as permanent in the books when things go as they should--hard to prove an absence of a thing... in St. Mungo's there are healers to reverse transfigurations, which sounds like cases in which things go wrong it could be more permanent.

A: Magically created animals aren't real animals.
In an interview, J.K. Rowling explains that she'd decided conjured objects wouldn't last for very long.

Q: It seems that the wizards and witches at Hogwarts are able to conjure up many things, such as food for the feasts, chairs and sleeping bags. . .if this is so, why does the wizarding world need money? What are the limitations on the material objects you can conjure up? It seems unnecessary that the Weasleys would be in such need of money. . . (Jan Campbell)
A: Very good question (well done, Jan!!). There is legislation about what you can conjure and what you can't. Something that you conjure out of thin air will not last. This is a rule I set down for myself early on. I love these logical questions! - South West News Service Interview with J.K. Rowling (July 8th, 2000)

Therefore, wizards wouldn't be able to conjure new Snidgets because they'd  disappear soon enough again. Wizards also don't seem to be able to create life - no animals that were originally an object that was Transfigured into an animal are shown lasting long-term.


text:
Q: Tensorflow source build configuration fails: Could not find any cuda.h matching version and dictionary value error I am trying to build Tensorflow from source as I have a 6.1 compute capability GPU, however my CPU does not support AVX commands. My first try with docker containers failed as the Tensorflow could not be imported on tensorflow:latest-jupyter-gpu either. I have already installed and verified CUDA drivers with manual installation of the cuda driver from nvidia website. Current installation is  NVIDIA-SMI 450.51.05    Driver Version: 450.51.05    CUDA Version: 11.0 according to nvidia-smi output. Additionally I have installed and verified installation of cudnn-8.0.1 for CUDA 11 by following this guide. My system runs Linux Mint 19.1.
I have downloaded TF source and checked out branch r2.2 to build the corresponding version. Despite the proposed method of installing Bazel through Bazelisk (from this guide) the only method which worked was by applying the command
cd "/home/user/.bazel/bin" && curl -LO https://releases.bazel.build/2.0.0/release/bazel-2.0.0-linux-x86_64 && chmod +x bazel-2.0.0-linux-x86_64

However in configuration build I have to deal with two issues:

*

*When choosing about the supported libraries, if only select CUDA out of the 4 questioned libraries, I get the following error:

File "./configure.py", line 1440, in main
    if validate_cuda_config(environ_cp):
  File "./configure.py", line 1323, in validate_cuda_config
    tuple(line.decode('ascii').rstrip().split(': ')) for line in proc.stdout)
ValueError: dictionary update sequence element #9 has length 1; 2 is required

Consequently, I have to select at least two libraries (CUDA and TensorRT).

*In  case of selecting the two libraries then the script proceeds, however, the following message occurs
Could not find any NvInferVersion.h matching version '' in any subdirectory. After providing CUDA and cudnn versions at the corresponding script prompts I have managed to proceed further by finding in my system cudnn.h and cuda.h paths and adding their paths in the additional scripts prompt:

Please specify the comma-separated list of base paths to look for CUDA libraries and headers. [Leave empty to use the default]: /usr/local/cuda-11.0/targets/x86_64-linux/include/cuda.h,/usr/include/hwloc/cuda.h,/usr/local/cuda-11.0/targets/x86_64-linux/include/cudnn.h,/usr/include/cudnn.h,/usr/include/linux,/usr/local/cuda/include

However I cannot proceed any further as the script keeps failing with the message:
Could not find any cuda.h matching version '11' in any subdirectory:
        ''
        'include'
        'include/cuda'
        'include/*-linux-gnu'
        'extras/CUPTI/include'
        'include/cuda/CUPTI'
of:
        '/usr/include/hwloc/cuda.h'
        '/usr/local/cuda-11.0/targets/x86_64-linux/include/cuda.h'
        '/usr/local/cuda-11.0/targets/x86_64-linux/include/cudnn.h'
Asking for detailed CUDA configuration...

Any hints on how to continue? Which should be the paths that I have to provide?
Thank you!

A: i recently met the same problem of this:
File "./configure.py", line 1440, in main
    if validate_cuda_config(environ_cp):
  File "./configure.py", line 1323, in validate_cuda_config
    tuple(line.decode('ascii').rstrip().split(': ')) for line in proc.stdout)
ValueError: dictionary update sequence element #9 has length 1; 2 is required`

I think that means my version of CUDA and Cudnn do not match the require of the needs of build tensorflow-gpu. Please install their right version where you can find in the 'configure.py'. TensorRT is not the indispensable one.

A: So CUDA 11 apparently misses to refer the cudnn version in some header as stated by a previous answer, which in fact hinders the creation of a tuple. This happens because the second element is missing (the actual version number) and then the configuration crashes.
So somehow you have to parse that cudnn version number to the configure file from tensorflow. What I did was to hardcode the cudnn version, just replace the '8.1' with your version.
I replaced that 1323 line from the configure.py file tuple(line.decode('ascii').rstrip().split(': ')) for line in proc.stdout) with the following code. I am sure there's a much efficient way to do write this.
  config = {}
  for line in proc.stdout:

    parameter_split = line.decode('ascii').rstrip().split(': ')
    if len(parameter_split) == 1:
        # had to manually add here the cudnn version
        config[parameter_split[0][:-1]] = '8.1'
    else:
        config[parameter_split[0]] = parameter_split[1]

A: Copy this file: /tensorflow/tensorflow/core/platform/cuda.h into one of the directories listed.


text:
Q: How to add a jump event using Javascript on Wordpress So in short, I have this page I created on a wordpress site. The issue, the content on the page, divided in different rows, is quite large and I wanted to enable on the beguinning of the page a jump to section link (and jump back to top link) for each section (in this case, row).
I'm in doubt, though, on what is the best way to do this on wordpress and wether I shoudl add an even type like scroll to or jump to. Also, I  want to create a function that does this to multiple sections... in order to have a neat and simple code, is there any function(s) options you could recomment me to search and try to use?
thank you =)

A: The easiest way you can create a link to "jump to" a section of the page is with anchor links. This page has an example:
https://www.rapidtables.com/web/html/link/html-anchor-link.html
Notice that the browser URL gets updated when you click the anchor link, this is how you can share links to specific sections of your page.
How to create anchor links in Wordpress (Visual Edit Mode):

*

*Begin by adding the anchor tag. This will go on the section header that you want to jump to (ie, the destination of the link). In Wordpress Visual Edit mode, on the right-hand side of the screen you should see an Advanced section. In the "HTML Anchor" field, add your tag. Use dashes (-) instead of spaces. Here's an example: my-section

*Now create the link to the tag. Highlight the text that will link to the anchor tag. Click the "link" button in the toolbar and add the anchor tag with a pound symbol (#) in front of it. Example: #my-section
Save and publish. Now when you click the link you created in step 2, it should jump you to the section you tagged in Step 1.
For more detailed instructions, please see the Wordpress.com guide:
https://wordpress.com/support/splitting-content/page-jumps/


text:
Q: Conformal Coating Shielded RF Module Re: Conformal coating of shielded RF modules
I have an IoT device that consists of a PCB that goes inside a watertight enclosure. The device will operate under constant water, since it will be installed below sprinklers. For an added layer of protection, mainly due to possible human errors when closing the case, I want to add a silicone conformal coating to protect against moisture or small amounts of water that may leak inside. However, my PCB uses a Microchip RN2903 LoRa module, which has an RF metallic shielding as shown below:

As you can see, the module has three small holes on the top, as well as vertical gaps in each corner. My main question is: If I completely cover the holes in the metal shield, could the trapped air inside the shield then cause problems to the module? Maybe due to the pressure of temperature change? The inside temperature of the device is about 15 Celsius at night and 40 Celsius in the day. Then again, the whole inside of the device would have these temperature changes, not just the RF module, so maybe it would be fine?
If you have any ideas, or suggestions on conformal coating modules with an RF shield, please let me know!

A: You mustn't have coating inside the can, or on the RF traces to the connector.
Air has a lower \$\varepsilon_\text{r}\$ than coating material. The physics of controlled impedance RF traces depend on the surrounding medium having an \$\varepsilon_\text{r}\$ much lower than that of the board material. Things might simply stop working if you coat such traces!
At 433 MHz such effects are likely to be benign. However, if the module uses e.g. MEMS oscillators, then that might quickly become a problem. It feels like the three holes in the module are there on purpose.
I'd definitely contact Microchip about this. Conformal coating is certainly something their application engineers have dealt with before.


text:
Q: angular testing multiple files in sequence - Error while waiting for Protractor to sync with the page Started with Angular E2E, and tried to test multiple files (divided the test cases module wise).
Changes made in protractor.conf.js
specs: [
     "./src/login/login.component.e2e-spec.ts",
     "./src/customs-portal/home.component.e2e-spec.ts",
],

this runs the test cases of both files in the same sequence.
In the home test case file I have written
beforeAll(() => {
     homePage= new HomePage();
     helperService = new HelperService();

     CSS = homePage.CSS;
     helperService.navigate("/home");

     helperService.skipIntro();
});

i navigate to /home, on home page there is skip button that i clicks to avoid intro phase about the page. Here is how skipIntro function looks like
async skipIntro(): Promise<any> {
    const _skipBtn = await element(by.css(this.CSS.SKIP_INTRO));
    console.log("HelperService -> _skipBtn", _skipBtn);
    if (_skipBtn) {
        _skipBtn.click();
    }
}

but it shows error and fails the test case
it("dummy test always paas", async () => {
        expect(true).toEqual(true);
});

here is the error
- Error: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined.  This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping.  See http://git.io/v4gXM for details"

here is helperService.navigate
navigate(path: string): promise.Promise<any> {
        return browser.get(path);
}

any help on this, not much experience on Angular E2E.

A: Try this it should work
     beforeAll(async () => {
     homePage= new HomePage();
     helperService = new HelperService();
     CSS = homePage.CSS;

    await helperService.navigate("/home");
    await  helperService.skipIntro();
});

async skipIntro(): Promise<any> {
 const _skipBtn =await element(by.css(this.CSS.SKIP_INTRO));
    console.log("HelperService -> _skipBtn", _skipBtn);
    if (_skipBtn) {
        await _skipBtn.click();
    }
}

async navigate(path: string): promise.Promise<any> {
        await return browser.get(path);
}

async skipIntro(): Promise<any> {
    const _skipBtn = await element(by.css(this.CSS.SKIP_INTRO));
    console.log("HelperService -> _skipBtn", _skipBtn);
    if (_skipBtn) {
        await _skipBtn.click();
    }
}

async navigate(path: string): promise.Promise<any> {
        await return browser.get(path);
}

A: By looking at the error, I am assuming that the application under test is not Angular application. Protractor is mostly used to test angular applications but to test non-angular applications you can do following configuration change and you probably won't get this error
browser.waitForAngularEnabled(false);

This will disable searching for angular components in application and tests will get executed.

A: seems like async and control flow is mixed that seems to be an issue


text:
Q: Volley throwing AuthFailureError (401) with Basic HTTP Authentication I'm trying to make a GET request in an Android application using the Volley library. This GET request is to verify account credentials using Basic HTTP Authentication. I verified the URL with credentials works in my browser as it returns successful XML. The format is:
http://username:password@myanimelist.net/api/account/verify_credentials.xml
where username and password obviously represent real user credentials. Volley throws this error:
 BasicNetwork.performRequest: Unexpected response code 401 for http://username:password@myanimelist.net/api/account/verify_credentials.xml

Here is my Android code that handles the request:
private static final String HTTP_PRE = "http://";
private static final String VERIFY_CREDENTIALS = "myanimelist.net/api/account/verify_credentials.xml";

public void verifyCredentials(String username, String password) {
    RequestQueue queue = Volley.newRequestQueue(context);
    String url = HTTP_PRE + username + ":" + password + "@" + VERIFY_CREDENTIALS;

    StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {

        @Override
        public void onResponse(String response) {
            processResponse(response);
        }
    }, new Response.ErrorListener() {

        @Override
        public void onErrorResponse(VolleyError error) {
            // handle error
            Log.d(TAG, "error: " + error.getMessage());
        }
    });

    queue.add(stringRequest);
}

This solution to override the getHeaders() method provided the same result:
How does one use Basic Authentication with Volley on Android?.
Here is my implementation of that solution:
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
    Map<String, String> params = super.getHeaders();
    if (params == null){
        params = new HashMap<>();
    }
    String creds = String.format("%s:%s", username, password);

    params.put("Authorization", creds);

    return params;
}

Which returned this error without the credentials built directly into the URL:
BasicNetwork.performRequest: Unexpected response code 401 for http://myanimelist.net/api/account/verify_credentials.xml

If someone could provide advice, I'd really appreciate it. This is my first time using Basic HTTP Authentication so I could be missing something obvious.

A: I solved this problem following the first answer here: Http Authentication in android using volley library. I had tried something similar and many other solutions but this was the only one that worked.

A: Basic Authentication uses BASE64 encoding. You're missing
String creds = String.format("%s:%s", username, password);
creds = Base64.encodeToString(creds.getBytes(), Base64.NO_WRAP);

The Authorization HTTP header requires to indicate the method used (Basic|Digest). At last you headers should look like this:
GET http://username:password@myanimelist.net/api/account/verify_credentials.xml
Accept: text/xml,text/plain
...
Authorization: Basic XXXXXXXXXXXXXX==


text:
Q: Flash CS6 Error #1009 - Button disappears I'm starting to use Flash CS6 for the first time to try and make Scaleform UI's for UDK. I'm following this simple tutorial: http://goo.gl/yedMU. I've followed it to the letter but can't seem to get it to work. I even have tried it again in a new project but it ends up with the same error. I've triple checked each name and instance but it just refuses to work. Here is the really simple code of the two frames in the file:
import flash.events.MouseEvent;
import flash.system.fscommand;
import flash.display.MovieClip;

subMenu_btn.addEventListener(MouseEvent.CLICK, subMenu);
exit_btn.addEventListener(MouseEvent.CLICK, exitGame);

var cursor:cursor_mc = new cursor_mc();
addChild(cursor);
     cursor.x = mouseX;
     cursor.y = mouseY;
cursor.startDrag();

stop();

function subMenu(event:MouseEvent):void
{
     gotoAndStop('Sub Menu');
}
function exitGame(event:MouseEvent):void
{
     fscommand('ExitGame');
}

and
play_btn.addEventListener(MouseEvent.CLICK, playGame);
back_btn.addEventListener(MouseEvent.CLICK, backBtn);

function playGame(event:MouseEvent):void
{
     fscommand('PlayMap');
}
function backBtn(event:MouseEvent):void
{
     gotoAndStop('Main Menu');
}

I used the debugger and the code breaks at
exit_btn.addEventListener(MouseEvent.CLICK, exitGame);

Any ideas? The whole thing works until I used the 'Back' button to go back to the first frame, when the 'Exit' button is gone and I get that error. The 'Submenu' button remains however and the menu is still operable.
This is the error using the debugger:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Menu_fla::MainTimeline/frame1()[Menu_fla.MainTimeline::frame1:6]
at flash.display::MovieClip/gotoAndStop()
at Menu_fla::MainTimeline/backBtn()[Menu_fla.MainTimeline::frame2:10]

A: Okay, so I might have been wrong in what I said in the comments above, the solution is this:
For your first frame's AS3:
import flash.events.MouseEvent;
import flash.system.fscommand;
import flash.display.MovieClip;

var cursor:cursor_mc = new cursor_mc();

subMenu_btn.addEventListener(MouseEvent.CLICK, subMenu);
exit_btn.addEventListener(MouseEvent.CLICK, exitGame);

addChild(cursor);
     cursor.x = mouseX;
     cursor.y = mouseY;
cursor.startDrag();
Mouse.hide();

stop();

function subMenu(event:MouseEvent):void
{
    subMenu_btn.removeEventListener(MouseEvent.CLICK, subMenu);
    exit_btn.removeEventListener(MouseEvent.CLICK, exitGame);
    removeChild(cursor);
     gotoAndStop('Sub Menu');
}
function exitGame(event:MouseEvent):void
{
     fscommand('ExitGame');
}

For your second frame's AS3:
play_btn.addEventListener(MouseEvent.CLICK, playGame);
back_btn.addEventListener(MouseEvent.CLICK, backBtn);

cursor = new cursor_mc();
addChild(cursor);
     cursor.x = mouseX;
     cursor.y = mouseY;
cursor.startDrag();
Mouse.hide();

function playGame(event:MouseEvent):void
{
     fscommand('PlayMap');
}
function backBtn(event:MouseEvent):void
{
    removeChild(cursor);
     gotoAndStop('Main Menu');
}

You were instantiating the cursor each time you hit frame 1, which I believe would create a namespace problem. The solution was to remove the cursor from the stage, and add it back in for each frame. There may be a more elegant solution, but as I never use multiple frames with AS (for this very reason), this is the best I could do. I also hid the mouse cursor to give your cursor_mc more focus.
Let me know if you have any other questions.
Happy coding!

A: Another solution would be to create a new layer, and put the cursor code on that layer only. That layer would have one keyframe, and extend to cover the entire timeline, so it is always alive.
Or, create a menu movie clip that exists on frame 1. And inside that movie clip, have your different frames for each part of the menu (options, etc.). And the cursor would exist at the same level as the menu movie clip. So it always exists and is only initialized once.


text:
Q: "Among the flavors" or "from the flavors" or "of the flavors" I have a question about the preposition you can use when you are choosing something from a group of things.
When you are talking about the time when someone went to an ice cream parlor and had to choose from many flavors, which sentence can you use?

Among the flavors available at the store, mint and pecan looked good
to him.
From the flavors available at the store, mint and pecan looked good to
him.
Of the flavors available at the store, mint and pecan looked good to
him.


text:
Q: Node.js Global Scope Below is list of debugger queries, and responses, executed in a node.js at the global scope level:

this.toString()
    "[object Object]"
Object.getPrototypeOf(this).toString()
    "[object Object]"
Object.getPrototypeOf(Object.getPrototypeOf(this))
    null
this.constructor
    function Object() { [native code] }
Object.prototype.toString()
    "[object Object]"
Object.prototype.toString.call(this)
    "[object Object]"

Function.prototype.toString()
    "function () {}"
Function.prototype.toString.call(this)
    TypeError: Function.prototype.toString is not generic

The first set of responses suggests that the global scope is represented by an object that extends Object.prototype, as might be expected. So I'd expect that calling Function.prototype's .toString() on this would fail, as indeed it does (see the last query). I was expecting the query preceding that to pass an implicit this and so fail likewise, but it returns function () {}.
Why the difference, and what function is being referenced in the response?

A: In a function call, this is bound to either the object that "the function was called on" or the global object, for example:
const obj = {
  foo() {
    console.log(this);
  },
};

obj.foo(); // this is bound to obj
const obj2 = {};
obj2.bar = obj.foo;
obj2.bar(); // this is bound to obj2
const g = obj.foo;
g(); // this is bound to the global object

Therefore, Function.prototype.toString() is exactly the same as Function.prototype.toString.call(Function.prototype). That's the matter of implementation of this function that it throws if called on anything other than a Function.


text:
Q: What happens if a Jar is updated while it is still being used by a JVM? I know that, under typical conditions, a class is only loaded once. I also know that classes are immutable. Thus, once the class is loaded, it cannot be changed unless it is reloaded (which typically doesn't happen).
Does the same thing hold true for Jars? What happens if a Jar is updated while a JVM is still running that had previously loaded classes from the Jar?

A: Nothing, if a class in that jar is used, the same definition remains, if a new class is loaded in the updated jar it will be taken.


text:
Q: How to reuse original frame information from a methodNode in asm to create `org.objectweb.asm.tree.analysis.Frame` How can I construct a org.objectweb.asm.tree.analysis.Frame for each instruction in a method using only FrameNodes and LocalVariableNodes from the MethodNode?
Context
While instrumenting some code I need all the locals and stack types for some of the original instructions.
Currently I get this by doing:
Analyzer analyzer = new Analyzer(new MyBasicInterpreter());
Frame[] frames = analyzer.analyze(ownerClass, methodNode);

This gives me a Frame for each instruction in the methodNode.
However, to have the exact types means properly implementing BasicInterpreter.merge and that requires resolving the common super class for arbitrary types. This escalates quickly to having to know super classes and interfaces for a bunch of classes (i.e. having to read more information from the classloader).
So I am wondering if I can avoid using an Analyzer and just use the original frame information to reconstruct the data I need.
The original classes are always jdk 1.8.0 classes and have frame information.
And I really need to know the types in the stack.

A: You can't avoid the analyzation entirely as the StackMapTable contains only information about branch targets and merge points. However, for the linear flow, the BasicInterpreter already contains the necessary operations and you indeed don't need to implement a merge operation if you extract the resulting information from the StackMapTable.
The only drawback is that you have to re-implement the construction of the method entry's initial frame as that operation is buried inside the Analyzer and ASM doesn't seem to provide a node for the implicit stack map frame that formally exists at the beginning of a method.
Here is the full code:
static List<Frame<BasicValue>> analyze(
    String ownerClass, MethodNode methodNode) throws AnalyzerException {

  final BasicValue ownerType=toBasicValue(null, ownerClass);
  BasicInterpreter interpreter = new BasicInterpreter() {
    @Override
    public BasicValue newValue(Type type) {
      return type==null || isPrimitive(type.getSort())? super.newValue(type):
             type.equals(ownerType.getType())? ownerType: new BasicValue(type);
    }
    private boolean isPrimitive(int sort) {
      return sort!=Type.OBJECT&&sort!=Type.ARRAY;
    }
  };
  List<Frame<BasicValue>> frames=new ArrayList<>();

  Frame<BasicValue> current = methodEntryFrame(methodNode, ownerType, interpreter);

  for(int ix=0, num=methodNode.instructions.size(); ix<num; ix++) {

    AbstractInsnNode i=methodNode.instructions.get(ix);

    if(i.getType() == AbstractInsnNode.FRAME) {
      current = extractFrame(methodNode, ownerType, (FrameNode)i);
      continue;
    } else if(i.getOpcode()<0) continue;//pseudo instruction node
    frames.add(new Frame<>(current));
    current.execute(i, interpreter);
  }

  return frames;
}

private static Frame<BasicValue> extractFrame(
    MethodNode methodNode, BasicValue ownerType, FrameNode fn) {

  Frame<BasicValue> current = new Frame<>(methodNode.maxLocals, methodNode.maxStack);
  int locals = fn.local!=null? fn.local.size(): 0;
  for(int lIx=0, lCount=locals; lIx<lCount; lIx++)
    current.setLocal(lIx, toBasicValue(ownerType, fn.local.get(lIx)));
  for(int lIx=locals; lIx<methodNode.maxLocals; lIx++)
    current.setLocal(lIx, BasicValue.UNINITIALIZED_VALUE);
  if(fn.stack!=null)
    for(Object obj: fn.stack) current.push(toBasicValue(ownerType, obj));
  return current;
}

private static Frame<BasicValue> methodEntryFrame(
    MethodNode methodNode, BasicValue ownerType, BasicInterpreter interpreter) {

  Frame<BasicValue> current = new Frame<>(methodNode.maxLocals, methodNode.maxStack);
  current.setReturn(interpreter.newValue(Type.getReturnType(methodNode.desc)));
  Type[] args = Type.getArgumentTypes(methodNode.desc);
  int local = 0;
  if((methodNode.access & Opcodes.ACC_STATIC) == 0)
    current.setLocal(local++, ownerType);
  for(int ix = 0; ix < args.length; ix++) {
    Type type = args[ix];
    current.setLocal(local++, interpreter.newValue(type));
    if(type.getSize() == 2)
      current.setLocal(local++, BasicValue.UNINITIALIZED_VALUE);
  }
  while(local < methodNode.maxLocals)
    current.setLocal(local++, BasicValue.UNINITIALIZED_VALUE);
  return current;
}

private static BasicValue toBasicValue(BasicValue owner, Object object) {
  if(object instanceof String) return refType(owner,(String)object);
  if(object instanceof Integer)
    switch((Integer)object) {
      case 0: return BasicValue.UNINITIALIZED_VALUE;
      case 1: return BasicValue.INT_VALUE;
      case 2: return BasicValue.FLOAT_VALUE;
      case 3: return BasicValue.DOUBLE_VALUE;
      case 4: return BasicValue.LONG_VALUE;
      case 5: return BasicValue.REFERENCE_VALUE;// null
      case 6: return owner;// uninitialized_this
      default: throw new IllegalStateException();
  }
  // uninitialized object, object is a LabelNode pointing to the ANEW instruction
  return BasicValue.REFERENCE_VALUE;
}

static final BasicValue OBJECT = new BasicValue(Type.getObjectType("java/lang/Object"));

private static BasicValue refType(BasicValue owner, String name) {
  if(name.equals("java/lang/Object")) return OBJECT;
  if(owner!=null && owner.getType().getInternalName().equals(name))
    return owner;
  return new BasicValue(Type.getObjectType(name));
}


text:
Q: Differences of mins Proof Consider real numbers $x$ and $y$. Prove the following:
$$\min(x,y)-min(0,x+y)=min(|x|,|y|)sgn(x)sgn(y)$$
I am not even sure how to start the problem. Maybe using $|x+y|=|x|+|y|$ in some way?

A: Look at the different cases. Suppose $x,y>0$. Then the equality is trivial. If $x>0,y<0$, then there are again two cases: $|x|>|y|$ or the other way around. You can check that for both cases the equality holds. Then the fourth case is $y,x<0$, where checking the minimums again yields that the equation is correct.


text:
Q: Multiple alignments within align environment My minimum working example:
\documentclass{report}

\usepackage{amsmath}

\begin{document}

\begin{align}
\dot{x}_2 =  \dot{x}_{2,0}&+\frac{\partial f_2(x_1)}{\partial x_1} \bigg|_{x_1=x_{1,0}}       (x_1-x_{1,0})+\\
&+ \frac{1}{2}\frac{\partial {f_2}^2(x_1)}{\partial {x_1}^2} \bigg|_{x_1=x_{1,0}}       (x_1-x_{1,0})^2+ \\
&+ \frac{1}{6}\frac{\partial {f_2}^3(x_1)}{\partial {x_1}^3} \bigg|_{x_1=x_{1,0}}       (x_1-x_{1,0})^3+ \\
&+   g_2  (u-u_0)
\end{align}

\end{document}

The result:

Now I would like to obtain the following result instead:

Any ideas?

A: Yep! alignat
\documentclass{report}

\usepackage{amsmath}

\begin{document}

\begin{alignat}{3}
\dot{x}_2 =  \dot{x}_{2,0} \,& + \,& \,\frac{\partial f_2(x_1)}{\partial x_1} \bigg|_{x_1=x_{1,0}} &       (x_1-x_{1,0}) &+\\
&+& \,\frac{1}{2}\frac{\partial {f_2}^2(x_1)}{\partial {x_1}^2} \bigg|_{x_1=x_{1,0}}  &     (x_1-x_{1,0})^2 &+ \\
&+& \,\frac{1}{6}\frac{\partial {f_2}^3(x_1)}{\partial {x_1}^3} \bigg|_{x_1=x_{1,0}}  &     (x_1-x_{1,0})^3 &+ \\
&+ \protect\makebox[0pt][l]{\,\,$g_2  (u-u_0)$}\,
\end{alignat}

\end{document}

Note: you should take care with the number in curly brackets - it's to do with the total number of ampersands. I think it's supposed to be total + 1 divided by 2, but I have four... I had just copied and pasted from a bit of my own code. Perhaps someone will explain the number of ampersands thing better! The first ampersand marks an alignment point, and the next column will be right aligned. If you put in another, it will then be left aligned for the subsequent column so you can put && in if you want to immediately left align.
Note I put a few \, spacing commands in to line stuff up with slightly bigger gaps to match what you were looking for.
Now tell me, I'm confused: since you have uploaded exactly what you wanted - how did you generate that?

A: Use alignat and \mathrlap from the mathtools package for the last line.
The alignat environment has an implicit {rlrl...rlrl} alignment. The argument is the number of the r columns.
The command \mathrlap puts its argument in a zero width box and
aligns it left.
\documentclass{report}

\usepackage{mathtools}% loads amsmath

\begin{document}
\begin{alignat}{3}
\dot{x}_2 =  \dot{x}_{2,0}&+{}&\frac{\partial f_2(x_1)}{\partial x_1} \bigg|_{x_1=x_{1,0}}
       &(x_1-x_{1,0})&{}+{}\\
&+{}& \frac{1}{2}\frac{\partial {f_2}^2(x_1)}{\partial {x_1}^2} \bigg|_{x_1=x_{1,0}}       &(x_1-x_{1,0})^2&{}+{} \\
&+{}& \frac{1}{6}\frac{\partial {f_2}^3(x_1)}{\partial {x_1}^3} \bigg|_{x_1=x_{1,0}}       &(x_1-x_{1,0})^3&{}+{} \\
&+\mathrlap{g_2(u-u_0)}
\end{alignat}
\end{document}

I have used &+{}& and &{}+{} to get the right spacing around the +.

A: Here, I did it with a tabular stack.  Note, however, that it will only allow a single equation number to be applied to the result.  However, since it is a single equation, I thought that might be okay (if you want the vertical position of the number to be adjusted, that can be done).
The only real quirk to the solution was getting the g_2 term left aligned in a right-aligned column.  For that, I just grafted it to the right side of the preceding + sign.
\documentclass{report}
\usepackage{tabstackengine}
\stackMath
\usepackage{amsmath}
\begin{document}
\begin{equation}
\setstackgap{S}{6pt}
\TABbinary
\setstacktabulargap{0pt}
\tabularShortstack{rcrlc}{
\dot{x}_2 =  \dot{x}_{2,0}&+&\dfrac{\partial f_2(x_1)}{\partial x_1} \bigg|_{x_1=x_{1,0}}&       (x_1-x_{1,0})&+\\
&+& \dfrac{1}{2}\dfrac{\partial {f_2}^2(x_1)}{\partial {x_1}^2} \bigg|_{x_1=x_{1,0}}&       (x_1-x_{1,0})^2&+ \\
&+& \dfrac{1}{6}\dfrac{\partial {f_2}^3(x_1)}{\partial {x_1}^3} \bigg|_{x_1=x_{1,0}}&       (x_1-x_{1,0})^3&+ \\
&+ \protect\makebox[0pt][l]{$g_2  (u-u_0)$}& &&&
}
\end{equation}
\end{document}

A: You can keep the alignment points in the align environment as they are now, and just insert a couple of \phantom instructions in the first row to achieve the needed spacing adjustments.
By the way, I would recommend you omit the + symbols at the ends of rows 1, 2, and 3 since they're made redundant by the + symbols at the start of rows 2, 3, and 4.

\documentclass{report}
\usepackage{amsmath}
\begin{document}
\begin{align}
\dot{x}_2 =  \dot{x}_{2,0}&+\phantom{\frac{1}{2}}\frac{\partial {f_2}\phantom{^1}(x_1)}{\partial x_1} \bigg|_{x_1=x_{1,0}}       (x_1-x_{1,0})\\
&+ \frac{1}{2}\frac{\partial {f_2}^2(x_1)}{\partial {x_1}^2} \bigg|_{x_1=x_{1,0}}       (x_1-x_{1,0})^2\\
&+ \frac{1}{6}\frac{\partial {f_2}^3(x_1)}{\partial {x_1}^3} \bigg|_{x_1=x_{1,0}}       (x_1-x_{1,0})^3\\
&+   g_2  (u-u_0)
\end{align}
\end{document}

However, if these + symbols must be there, I would recommend you (a) write +{} instead of just + for these symbols to get proper spacing and (b) append \phantom{^1} to (x_1-x_{1,0}) in the first row to further fine-tune the spacing.
Finally, if you wanted the vertical space between the third and fourth row to be the same as between the other rows, you could add the instruction \phantom{\bigg|} after g_2  (u-u_0). With this adjustment made, and the + symbols at the ends of the first three rows not deleted, your equations would look like this:

\documentclass{report}
\usepackage{amsmath,}
\begin{document}
\begin{align}
\dot{x}_2 =  \dot{x}_{2,0}&+\phantom{\frac{1}{2}}\frac{\partial {f_2}\phantom{^1}(x_1)}{\partial x_1} \bigg|_{x_1=x_{1,0}}       (x_1-x_{1,0})\phantom{^1} +{}\\
&+ \frac{1}{2}\frac{\partial {f_2}^2(x_1)}{\partial {x_1}^2} \bigg|_{x_1=x_{1,0}}       (x_1-x_{1,0})^2 +{}\\
&+ \frac{1}{6}\frac{\partial {f_2}^3(x_1)}{\partial {x_1}^3} \bigg|_{x_1=x_{1,0}}       (x_1-x_{1,0})^3 +{}\\
&+   g_2  (u-u_0)\phantom{\bigg|}
\end{align}
\end{document}


text:
Q: Can I configure a network interface (eth0, eth1, etc.) to be down by default, but still be available? Can I configure a network interface (eth0, eth1, etc.) to be down by default, but still be available?
I would like my eth0 interface to be "down" after a fresh boot. With the option of using ifup eth0 from the command line to bring it up later.

A: /etc/network/interfaces is repsonsible for getting it up.
Comment out auto eth0 (add a # in front of it) and it will not start on boot.


text:
Q: How can i add data-title with jquery AUSTRALIAN AGRICULTURAL COMPANY LIMITED.

I'm using datatable with ajax how can i add data-title when table loading

A: use .data():
$('td').data('title','some title');

A: or attr()
$("td").attr("data-title","some title");


text:
Q: Replace for loop with apply function My question is how to use "apply" function to do what "for loop" does in this example:
mtcars

for (i in colnames(mtcars)){
    print(head(mtcars[i]))
}

What I need is to get R to read one column after the other, ideally by index (ie mtcars[1], then mtcars[2], then mtcars[3]...) rather than colnames.
Your help is highly appreciated.
Thanks

A: Use the apply function
apply(mtcars, 2 ,head)

this is the result
                   mpg cyl disp  hp drat    wt  qsec vs am gear carb
Mazda RX4         21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
Mazda RX4 Wag     21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
Datsun 710        22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
Hornet 4 Drive    21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2
Valiant           18.1   6  225 105 2.76 3.460 20.22  1  0    3    1

Explanation
2 in the parameter of apply function means you're going to pass each column to your defined function , if you pass 1 instead of 2 this means that you're going to send each row instead of column


text:
Q: Can't install Windows 7 on Mac Pro 3,1 I cant install Windows 7 on my MP3,1.
I burned original iso with Windows 7 on USB using Rufus (GPT partition).
Booted with holding Option key, chosen EFI and got freeze.
I tried to run Win7 installer in rEFIt and got message "Starting bootx64.efi" and got freeze again. The same is with rEFInd.
I think the problem is in Bootloader.
I don't want to install it with BootCamp, because I don't need MacOS installed.
Earlier I have installed Debian without any problems.
What's wrong?

A: Apple still has the info and software available but it is not an obvious find. Look here:
https://support.apple.com/en-us/HT205016
You will ned to download Version 4 of Apple's BootCamp software and use that to install Windows 7 on your MacPro 3,1.
The rest of that page gives you all the info you need to do so.
BE AWARE that Microsoft has set end of life for Windows 7 for January of 2020 (the 15th, I think...) which means that Windows 7 will no longer get any updates after that day. It will still work but no updates. So going online should either be done with extreme caution or not at all.

A: I am fairly sure you cannot install Windows directly onto a MAC. Apple rules and restrictions.
You need:  (a) Boot Camp  (b) Virtual Machine or (c) Windows box.


text:
Q: IE 9 font width rendering I am building a carousel that shows 3 items of news on a website. it shows the news title and the first 150 characters of the news story, all items in the carousel have to be the same height so i have set each news item to height:182px; width:210px;
It all looks good in every browser apart from IE 9 as it seems to render the fonts a little wider than all other browsers, so because all items have a set height and width, the text in IE 9 goes onto 4 lines instead of the 3 lines all other browsers use. Then this knocks everything else out of place.
So I am wondering if there is something that can be done to make the text the same as all other browsers?
Thanks for any help.
J.

A: I've noticed this too and it's quite an irritation. I've had to create css fixes for things I'm working on. Why is it IE can never get it right! It slows down development time no end.

A: I've actually found the problem in case anyone else has the same issue.
Not sure if anyone else does this but it's what caused the problem.
in my css on body I usually put font-size:64.5% so that any em fonts I use after that are basically a 10th of the pixel size, so 14px would be a font size of 1.4em etc etc...
but doing so seem to make IE9 up scale the font slightly when using 1.1em, so i've now put the body css to font-size:100% then used http://pxtoem.com/ to find the specific em font sizes and all seems to be working well in all browsers...hope this helps someone else :)
This may also be of some use http://msdn.microsoft.com/en-us/library/hh237264%28v=vs.85%29.aspx#using_spp_on_your_site


text:
Q: Print Several Outlook MailItems I have a pst that has a bunch of emails I want to print using the Microsoft Document Image Writer so that I have a folder, //lawyers/ediscovery/emails/ that has 00001.tiff 00002.tiff etc. In Word or Excel, I can pass the Workbook or Document a filepath to the PrintOut method, but the Outlook MailItem interop's PrintOut doesn't take any arguments, instead only uses the default printer's attributies. I don't have time to type the Bates number for every email (thousands to tens of thousands). Any help on how to tell Outlook where to print to?

A: This not possible inside of outlook as you say the printout command is not that useful.
I think the only way would be to use a 3rd party pst > tiff tool.