text:
Q: Ayuda tengo el siguiente error en una actividad que lista datos en un ListView El error que arroja es el siguiente:

E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.example.bastiancorps.geoassistance, PID: 17445
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.bastiancorps.geoassistance/com.example.bastiancorps.geoassistance.productoActivity}:
  java.lang.NullPointerException: Attempt to invoke virtual method
  'com.google.firebase.database.DatabaseReference
  com.google.firebase.database.DatabaseReference.child(java.lang.String)'
  on a null object reference

Este es el código de la actividad:
public class productoActivity extends AppCompatActivity {
    private List<producto> listaproductos = new ArrayList<producto>();
    ArrayAdapter<producto> arrayAdapterproducto;
    private EditText codigop, nombrep, preciop, stockp, tiendap;
    private FirebaseDatabase midb;
    private DatabaseReference midr;
    private ProgressDialog progressDialog;
    private FirebaseAuth mAuth;
    private ListView milistap;
    producto productosected;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_producto);
        listarDatosproducto();
        codigop = (EditText) findViewById(R.id.ETcodigop);
        nombrep = (EditText) findViewById(R.id.ETnombrep);
        preciop = (EditText) findViewById(R.id.ETpreciop);
        stockp = (EditText) findViewById(R.id.ETstockp);
        tiendap = (EditText) findViewById(R.id.ETtiendap);
        milistap = (ListView) findViewById(R.id.listadeproductos);
        progressDialog = new ProgressDialog(this);
        mAuth = FirebaseAuth.getInstance();
        midb = FirebaseDatabase.getInstance();
        midr = FirebaseDatabase.getInstance().getReference();

        milistap.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                productosected = (producto) parent.getItemAtPosition(position);
                //codigop.setText(productosected.getCodigo());
                nombrep.setText(productosected.getNombre());
                preciop.setText(productosected.getPrecio());
                stockp.setText(productosected.getStock());
                tiendap.setText(productosected.getTienda());
            }
        });
    }

    private void listarDatosproducto() {
        midr.child("producto").addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                listaproductos.clear();
                for (DataSnapshot datasnap : dataSnapshot.getChildren()){
                    producto p = datasnap.getValue(producto.class);
                    listaproductos.add(p);
                    arrayAdapterproducto = new ArrayAdapter<producto>(productoActivity.this, android.R.layout.simple_list_item_1, listaproductos);
                    milistap.setAdapter(arrayAdapterproducto);
                }

            }

            @Override
            public void onCancelled(@NonNull DatabaseError databaseError) {

            }
        });
    }

este es el Xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="12dp"
    tools:context=".productoActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_margin="10dp"
        android:text="Ingrese un producto"
        android:textSize="22dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        tools:ignore="MissingConstraints"
        tools:layout_editor_absoluteY="0dp" />

    <EditText
        android:id="@+id/ETcodigop"
        android:layout_width="336dp"
        android:layout_height="35dp"
        android:layout_marginEnd="8dp"
        android:background="@drawable/txt_color"
        android:hint="codigo"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.6"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.109"
        tools:ignore="MissingConstraints" />

    <EditText
        android:id="@+id/ETnombrep"
        android:layout_width="336dp"
        android:layout_height="35dp"
        android:background="@drawable/txt_color"
        android:hint="nombre del producto"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.207"
        tools:ignore="MissingConstraints" />

    <EditText
        android:id="@+id/ETpreciop"
        android:layout_width="337dp"
        android:layout_height="35dp"
        android:layout_marginEnd="8dp"
        android:background="@drawable/txt_color"
        android:hint="precio de venta"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.615"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.296"
        tools:ignore="MissingConstraints" />

    <EditText
        android:id="@+id/ETstockp"
        android:layout_width="336dp"
        android:layout_height="35dp"
        android:background="@drawable/txt_color"
        android:hint="Stock"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.38"
        tools:ignore="MissingConstraints" />

    <EditText
        android:id="@+id/ETtiendap"
        android:layout_width="336dp"
        android:layout_height="35dp"
        android:layout_marginEnd="8dp"
        android:background="@drawable/txt_color"
        android:hint="tienda"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.55"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.474"
        tools:ignore="MissingConstraints" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_margin="10dp"
        android:text="Lista de productos"
        android:textSize="22dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.586"
        tools:ignore="MissingConstraints" />

   <ListView
       android:id="@+id/listadeproductos"
       android:layout_width="match_parent"
       android:layout_height="match_parent"></ListView>

</LinearLayout>

A: El problema podría ser que llamas a la función de listarDatosproducto() antes de instanciar lo que es la variable midr. Esto hace que en el momento que intentas crear el evento, la aplicación no sepa lo que es midr.
La solución sería llamar a la función listarDatosproducto() después de instanciar la variable midr.
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_producto);
        //listarDatosproducto(); esto habría que moverlo más abajo
        codigop = (EditText) findViewById(R.id.ETcodigop);
        nombrep = (EditText) findViewById(R.id.ETnombrep);
        preciop = (EditText) findViewById(R.id.ETpreciop);
        stockp = (EditText) findViewById(R.id.ETstockp);
        tiendap = (EditText) findViewById(R.id.ETtiendap);
        milistap = (ListView) findViewById(R.id.listadeproductos);
        progressDialog = new ProgressDialog(this);
        mAuth = FirebaseAuth.getInstance();
        midb = FirebaseDatabase.getInstance();
        midr = FirebaseDatabase.getInstance().getReference();

        listarDatosproducto(); //Aquí la aplicación ya sabe lo que es el midr

        milistap.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                productosected = (producto) parent.getItemAtPosition(position);
                //codigop.setText(productosected.getCodigo());
                nombrep.setText(productosected.getNombre());
                preciop.setText(productosected.getPrecio());
                stockp.setText(productosected.getStock());
                tiendap.setText(productosected.getTienda());
            }
        });
    }

A: Agregando a la solucion de Iñigo que es correcta, para que te quede mejor reflejado los elementos que cargas en la lista, setea el adapter y crealo luego de loopear y obtener todos los datos para la lista
cambia esto
for (DataSnapshot datasnap : dataSnapshot.getChildren()){
                producto p = datasnap.getValue(producto.class);
                listaproductos.add(p);
                arrayAdapterproducto = new ArrayAdapter<producto>(productoActivity.this, android.R.layout.simple_list_item_1, listaproductos);
                milistap.setAdapter(arrayAdapterproducto);
            }

por esto
  for (DataSnapshot datasnap : dataSnapshot.getChildren()){
                    producto p = datasnap.getValue(producto.class);
                    listaproductos.add(p);

                }
                    arrayAdapterproducto = new ArrayAdapter<producto>(productoActivity.this, android.R.layout.simple_list_item_1, listaproductos);
                    milistap.setAdapter(arrayAdapterproducto);

De esta forma prevenis setear de a un dato a la vez en tu listview mientras loopeas y los setea a todos de una sola vez cuando termina.


text:
Q: How to use same session on two laravel project? I try to use same session on my project 1 into project 2 . when user login into first project and second project login with role access that i have setup like admin or user the second project will filter the content base on  role in project 1 .

A: I think it's really an anti-pattern and bad practice in general to share cookies and sessions. Take a look at laravel passport for example. You could implement an authorization server, which controls access for the two apps, these in turn will receive tokens to verify and allow/block users.
This will scale much better and will allow for further extension in the future. But more important, this is a tested solution for these problems.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Como fazer os dados retornarem em php array Preciso retornar os dados em um array.
Estou fazendo isso, mas os dados não retornam:
<?php
ini_set('display_errors', true);
error_reporting(E_ALL);

include_once("conexao.php");
$pdo = conectar();

header('Content-Type: application/json');
header("Access-Control-Allow-Origin: *");

/*$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$idCategoria = $request->idCategoria;*/

$id_categoria = $_GET['idCategoria'];
echo $id_categoria;

$buscarSubcategoria=$pdo->prepare("SELECT * FROM sub_cat_entrada WHERE id_categoria = :id_categoria");
$buscarSubcategoria->bindValue(':id_categoria', $id_categoria, PDO::PARAM_INT);
$buscarSubcategoria->execute();

//$buscarSubcategoria->debugDumpParams();

$return = array();

while ($linha=$buscarSubcategoria->fetch(PDO::FETCH_ASSOC)) {
    $return[] = array(
    'id_subcategoria'   => $linha['id_subcategoria'],
    'subcategoria'  => utf8_encode($linha['subcategoria']),
);
}
echo json_encode($return);


text:
Q: How do I use non-image/signal dataset to do classification problem via Convolution Neural Network I googled most of topics over the Internet, and Convolution Neural Network is prevailing to apply to image/pattern recognition. Perhaps, it is more easily to understand the concept of this methodology.
What if my dataset is composed of quantitative variable e.g., age,duration: last contact duration, in seconds (numeric), campaign: number of contacts performed during this campaign and for this client. Also, categorical variables are job ( type of job) , marital status, and education. More detail information, https://archive.ics.uci.edu/ml/datasets/Bank+Marketing
One can use classic logistic regression or SVM on Bank Marketing, How about deep learning approach? How to implement? Any good explanation from image concept to non-image problem like Bank Marketing or other cases?


text:
Q: Do "twice as high xxxxx as" , "twice as high" and "twice higher" mean the same thing? What do the following sentences actually mean?
Are they the same in meaning?

*

*The cost of living is twice as high in New York as it is in Tokyo.

*The cost of living in New York is twice as high in Tokyo.

*The cost of living in New York is twice higher than in Tokyo.

*The cost of living in New York is two times higher than in Tokyo.

If they have the same meaning, then can I actually use them as a basis for composing other sentences having the same meanings? Such as:

1a. Your child is a hundred times as adorable as your pet dog.
  1b. Your child is a hundred times adorable than your pet dog.
2a. Her room is twice as large as mine.
  2b. Her room is twice larger than mine.

A: Let CNY = the cost of living in New York, and CT = the cost of living in Tokyo.
Sentences Nos. 1 & 2:

The cost of living is twice as high in New York as it is in Tokyo.
The cost of living in New York is twice as high in Tokyo.

these mean: CNY = 2 × CT
e.g., if it costs $500 per week to live in Tokyo, it would cost $1000 per week to live in NY

Sentence No. 3:

The cost of living in New York is twice higher than in Tokyo.

I would say this one is a non-standard way of making the comparison, and, of your options, it would be better to avoid this one.

Sentence No. 4:

The cost of living in New York is two times higher than in Tokyo.

Again, that's CNY = 2 × CT, but remove the than:

The cost of living in New York is two times higher in Tokyo.

and it means 2 × CNY = CT
e.g., if it costs $500 per week to live in Tokyo, it would cost $250 per week to live in NY

Sentences Nos. 1a & 1b:

Your child is a hundred times as adorable as your pet dog.
Your child is a hundred times adorable than your pet dog.

The first one is okay, but the second one needs an extra word:

Your child is a hundred times more adorable than your pet dog.

Sentences Nos. 2a & 2b:

Her room is twice as large as mine.
Her room is twice larger than mine.

Once again, I'd avoid the second one. However, when dealing with cost, we can use the expression twice as much as:

The cost of living in New York is twice as much as in Tokyo. (CNY = 2 × CT)


text:
Q: Show that the following graphs are isomorphic I have the following problem to resolve:

If $X=\{1,2,3,4,5\}$ and $V$ is the set of all the subsets of 2
  elements of $X$. If $A$ is the set of pairs of elements of $V$ that are
  disjoint  (as subsets of $X$). Show that the graph $G=(V,A)$ is
  isomorphic to the graph shown below:

From this, we know that:
$$X=\{1,2,3,4,5\}$$
And from what I understand:
$$
V=\{\{1,2\},\{1,3\},\{1,4\},\{1,5\},\{2,1\}\{...\}\}
$$
But this seems incorrect  as since $X$ appears to be representing the nodes of the graph, that set of subsets above would be $A$ and here is where I start getting confused.
Any suggestions on better understanding the concept of the problem and at the same time the steps in resolving it?

A: This is the Petersen graph. The set of vertices are the two element subsets of $\{1,2,3,4,5\}$ and two vertices are adjacent iff they are disjoint as sets. For example there is an edge between $\{1,2\}$ and $\{3,4\}$ (since $\{1,2\}\cap \{3,4\}=\varnothing$ but not an edge between $\{1,2\}$ and $\{2,3\}$ (since $\{1,2\}\cap \{2,3\}\neq\varnothing$). This graph has $\binom{5}{2}=10$ vertices.

A: You just need to label the vertices and observe that the edges are "disjoint pairs". It is of course the Petersen graph.


text:
Q: Best method to identify and replace outlier for Salary column in python What is best method to identify and replace outlier for ApplicantIncome,
CoapplicantIncome,LoanAmount,Loan_Amount_Term column in pandas python.
I tried IQR with seaborne boxplot,  and tried to identified the outlet and fill with  NAN record after that take mean of ApplicantIncome and filled with NAN records.
Try to take group of below combination column ex: gender, education, selfemployed, Property_Area
And having below column in my dataframe
Loan_ID              LP001357
Gender                   Male
Married                   NaN
Dependents                NaN
Education            Graduate
Self_Employed              No
ApplicantIncome          3816
CoapplicantIncome         754
LoanAmount                160
Loan_Amount_Term          360
Credit_History              1
Property_Area           Urban
Loan_Status                 Y

A: Outliers
Just like missing values, your data might also contain values that diverge heavily from the big majority of your other data. These data points are called "outliers". To find them, you can check the distribution of your single variables by means of a box plot or you can make a scatter plot of your data to identify data points that don't lie in the "expected" area of the plot.
The causes for outliers in your data might vary, going from system errors to people interfering with the data through data entry or data processing, but it's important to consider the effect that they can have on your analysis: they will change the result of statistical tests such as standard deviation, mean or median, they can potentially decrease the normality and impact the results of statistical models, such as regression or ANOVA.
To deal with outliers, you can either delete, transform, or impute them: the decision will again depend on the data context. That's why it's again important to understand your data and identify the cause for the outliers:

*

*If the outlier value is due to data entry or data processing errors,
you might consider deleting the value.

*You can transform the outliers by assigning weights to your
observations or use the natural log to reduce the variation that the
outlier values in your data set cause.

*Just like the missing values, you can also use imputation methods to
replace the extreme values of your data with median, mean or mode
values.

You can use the functions that were described in the above section to deal with outliers in your data.
Following links will be useful for you:
Python data cleaning
Ways to detect and remove the outliers


text:
Q: Find lowest value and update other table with that value I have 2 tables in SQL : Event and Swimstyle
The Event table has a value SwimstyleId which refers to Swimstyle.id
The Swimstyle table has 3 values : distance, relaycount and strokeid
Normally there would be somewhere between 30 and 50 rows in the table Swimstyle, which would hold all possible values (these are swimming distances like 50 (distance), 1 (relaycount), FREE (strokeid)).
However, due to a programming mistake the lookup for existing values didn't work and the importer of new results created a new swimstyle entry for each event added...
My Swimstyle table now consists of almost 200k rows, which ofcourse is performance wise not the best idea ;)
To fix this i want to go through all Events, get the swimstyle values that are attached, lookup the first existing row in Swimstyle that has the same distance, relaycount and strokeid values and update the Event.SwimstyleId with that value.
When this is all done i can delete all orphaned Swimstyle rows, leaving a table with only 30-50 rows.
I have been trying to make a query that does this, but not getting anywhere. Anyone to point me in the right direction ?

A: These 2 statements should fix the problem, if I've read it right. N.B. I haven't been able to try this out anywhere, and I've made a few assumptions about the table structure.
UPDATE event e
set swimstyle_id = (SELECT MIN(s_min.id)
                    FROM   swimstyle s_min,swimstyle s_cur
                    WHERE  s_min.distance   = s_cur.distance
                    AND    s_min.relaycount = s_cur.relaycount
                    AND    s_min.strokeid   = s_cur.strokeid
                    AND    s_cur.id         = e.swimstyle_id);

DELETE FROM swimstyle s
WHERE NOT EXISTS (SELECT 1
                  FROM   event e
                  WHERE  e.swimstyle_id = s.id);


text:
Q: About strtok and tokens in C so i have a question about strtok in C.Is it possible to use strtok to reform a string without the specific token u remove from it ?For example i have a string that i get from main with argc,argv.
void main(int argc,char *argv[]){
//so i get the string ok let's say its the string my-name-is-Max
//so i want to strtok with "-" so i get the string without the "-"
//the prob is i can;t seem to reform the string meaning making it
mynameisMax

// its just "Max" or "my" sometimes , is there a way i can like combine them
//together using token method ?
}

A: strtok is an overkill for finding a single character. And does not serve you right in this case. If you want to overwrite your arguments then just use strchr and memmove (because it's overlapping memory) or strpbrk if you search for a range of characters.
char* s = argv [i];
char* d = argv [i];
char* pos;

while ((pos = strchr (s, '-')) != NULL)
{
    memmove (d, s, pos-s); /* Copy (overlapping) all but the dash */
    d += pos-s;            /* Advance the destination by the copied text. */
    s = pos+1;             /* Advance the source past the dash */
}
memmove (d, s, strlen (s) + 1); /* Copy the rest of the string including the NULL termination. */


text:
Q: Comparing a user entered value to that stored in an array? Currently I have a file reader that reads in the data from a file line by line and will check to make sure that they are entered in the format required and if they are then it will add them to the array and add output them to the console. What I want to do is make it so that the user can enter a specific team and it will go through the file and only record the relevant data to that team but I'm not sure how I would do this. Here is the code I have that will record and print the data from the text file:
String hteam;
    String ateam;
    int hscore;
    int ascore;
    int totgoals = 0;

    Scanner s = new Scanner(new BufferedReader(
            new FileReader(fileName))).useDelimiter("\\s*:\\s*|\\s*\\n\\s*");

    while (s.hasNext()) {
        String line = s.nextLine();
        String[] words = line.split("\\s*:\\s*");
        //splits the file at colons

        if(verifyFormat(words)) {
            hteam = words[0];       // read the home team
            ateam = words[1];       // read the away team
            hscore = Integer.parseInt(words[2]);       //read the home team score
            totgoals = totgoals + hscore;
            ascore = Integer.parseInt(words[3]);       //read the away team score
            totgoals = totgoals + ascore;
            validresults = validresults + 1;

My question is how would i make it so that the user can enter a team name then it will compare that to the names for either hteam or ateam and carry on reading each line of the loop.

A: When you're interested in counting the amount of matches of a team in your file I'd use a Map. First, populate the map:
Map<String, Integer> teams = new HashMap<>();

String team = "team A";
if(teams.containsKey(team)) {
    teams.put(team, teams.get(team) + 1);
} else {
    teams.put(team, 1);
}

Then, retrieve the amount of matches:
String userTeam = "...";
if(teams.containsKey(userTeam)) {
    System.out.println(userTeam + ": " + teams.get(userTeam));
} else {
    System.out.println(userTeam + " unknown");
}


text:
Q: Как прижать fixed блок к правому краю? Блок nav-right, который находится сейчас слева, должен быть прижат к правому краю. Мне нужно что бы у него остался position: fixed, но когда я с ним пытаюсь переместить этот блок к правому краю, то ничего не происходит. Но при этом, когда я убираю position: fixed;, я не могу выставить height: 100%;.

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');
body {
  font-family: 'Roboto', sans-serif;
  background-color: #F0F1F4;
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
  padding: 0;
}

li {
  padding-left: 20px;
}

a {
  text-decoration: none;
  color: #D1D4E4;
}

a:hover {
  color: #fff;
}

input {
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 400;
  color: #323546;
  background-color: #D1D4E4;
  opacity: .7;
}

input:hover {
  opacity: .8;
  transition: .3s;
}

input:focus {
  outline: none;
  background-color: #fff;
  color: #000;
  transition: .3s;
  opacity: 1;
}

input::placeholder {
  color: #323546;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus {
  outline: none;
}

/* Header */

.header {
  display: flex;
  align-items: center;
  width: 100%;
  height: 50px;
  left: 0px;
  top: 0px;
  background: #323546;
  box-shadow: 0px 4px 9px -2px rgba(0, 0, 0, 0.15);
}

.header-nav {
  display: flex;
  margin-left: auto;
  padding-right: 30px;
  font-size: 14px;
  font-weight: 400;
}

.logo {
  margin-left: 10px;
}

.search {
  width: 141px;
  height: 22px;
  margin-right: 10px;
  padding-left: 25px;
  background-image: url(../icons/search.svg);
  background-repeat: no-repeat;
  background-position: center left 5px;
}

/* Side Bar */

.nav-right {
  position: fixed;
  display: block;
  width: 50px;
  height: 100%;
  margin-left: auto;
  background-color: #323546;
}

.nav-item {
  width: 100%;
  height: 50px;
  background-color: #323546;
  background-repeat: no-repeat;
  background-position: center;
}

.nav-item:hover {
  background-color: #41455C;
}

.nav-item-setting {
  background-image: url(../icons/cog.svg);
}

.nav-item-calendar {
  background-image: url(../icons/calendar.svg);
}

.nav-item-bell {
  background-image: url(../icons/bell.svg);
}

.nav-item-trash {
  background-image: url(../icons/trash.svg);
}

Заказы

Контрагенты

Поставщики

Справочники

  <input type="search" class="search" placeholder="Поиск">

    <button class="nav-item-setting nav-item"></button>
    <button class="nav-item-calendar nav-item"></button>
    <button class="nav-item-bell nav-item"></button>
    <button class="nav-item-trash nav-item"></button>

A: Добавить right: 0px; для .nav-right

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');
body {
  font-family: 'Roboto', sans-serif;
  background-color: #F0F1F4;
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
  padding: 0;
}

li {
  padding-left: 20px;
}

a {
  text-decoration: none;
  color: #D1D4E4;
}

a:hover {
  color: #fff;
}

input {
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 400;
  color: #323546;
  background-color: #D1D4E4;
  opacity: .7;
}

input:hover {
  opacity: .8;
  transition: .3s;
}

input:focus {
  outline: none;
  background-color: #fff;
  color: #000;
  transition: .3s;
  opacity: 1;
}

input::placeholder {
  color: #323546;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus {
  outline: none;
}

/* Header */

.header {
  display: flex;
  align-items: center;
  width: 100%;
  height: 50px;
  left: 0px;
  top: 0px;
  background: #323546;
  box-shadow: 0px 4px 9px -2px rgba(0, 0, 0, 0.15);
}

.header-nav {
  display: flex;
  margin-left: auto;
  padding-right: 30px;
  font-size: 14px;
  font-weight: 400;
}

.logo {
  margin-left: 10px;
}

.search {
  width: 141px;
  height: 22px;
  margin-right: 10px;
  padding-left: 25px;
  background-image: url(../icons/search.svg);
  background-repeat: no-repeat;
  background-position: center left 5px;
}

/* Side Bar */

.nav-right {
  position: fixed;
  right: 0px;
  display: block;
  width: 50px;
  height: 100%;
  margin-left: auto;
  background-color: #323546;
}

.nav-item {
  width: 100%;
  height: 50px;
  background-color: #323546;
  background-repeat: no-repeat;
  background-position: center;
}

.nav-item:hover {
  background-color: #41455C;
}

.nav-item-setting {
  background-image: url(../icons/cog.svg);
}

.nav-item-calendar {
  background-image: url(../icons/calendar.svg);
}

.nav-item-bell {
  background-image: url(../icons/bell.svg);
}

.nav-item-trash {
  background-image: url(../icons/trash.svg);
}

Заказы

Контрагенты

Поставщики

Справочники

  <input type="search" class="search" placeholder="Поиск">

    <button class="nav-item-setting nav-item"></button>
    <button class="nav-item-calendar nav-item"></button>
    <button class="nav-item-bell nav-item"></button>
    <button class="nav-item-trash nav-item"></button>


text:
Q: Xamarin Form - TaskCanceledException thrown on ScanFilesToFolderAsync in my UWP application i am working on scan functionality. in this application user can scan the document through scanner by selecting flatbed or auto feeder.Now problem is when i am trying to scan it gives the en exception a Task was canceled.
please help..
thanks in advance. :)
have a great day... :)
private async void Btnscan_Click(object sender, RoutedEventArgs e)
    {

        FolderPicker folderPicker = new FolderPicker();
        folderPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
        folderPicker.FileTypeFilter.Add("*");

        StorageFolder folder = await folderPicker.PickSingleFolderAsync();
//set the destination folder name for scan images.

        DeviceInformationDisplay selectedScanner = CmbScannerList.SelectedItem as DeviceInformationDisplay; // here i got the selected scanner.

        // scanner id is := "\\\\?\\ROOT#IMAGE#0000#{6bdd1fc6-810f-11d0-bec7-08002be2092f}"

        ScanToFolder(selectedScanner.id, folder);

    }

function Scan To folder
 public async void ScanToFolder(string deviceId, StorageFolder folder)
    {
        try
        {
 cancellationToken = new CancellationTokenSource();

            ImageScanner myScanner = await ImageScanner.FromIdAsync(deviceId);

            if (myScanner.IsScanSourceSupported(ImageScannerScanSource.Flatbed))
            {
                var result = await myScanner.ScanFilesToFolderAsync(ImageScannerScanSource.Flatbed, folder).AsTask(cancellationToken.Token); // through an exception(A Task Was Canceled):(
Utils.DisplayImageAndScanCompleteMessage(result.ScannedFiles, DisplayImage);

            }

        }

        catch (Exception ex)
        {
            // here i got the exception.
        }

    }

Updated :
Now i am set the DeviceClass to ALL.
   private void StartWatcher()
    {
        resultCollection.Clear();
        DeviceWatcher deviceWatcher;

        deviceWatcher = DeviceInformation.CreateWatcher(DeviceClass.All); // set Image scanner to all.
       deviceWatcherHelper.StartWatcher(deviceWatcher);
  }

After run the project in scanner list i got the all connected devices in which i got my scanner name This : when i am trying to pass this name it gives error in imagescanner System.Exception: 'Exception from HRESULT: 0x80210015' means device not found.
Now i am chnage all to ImageScanner i got nothing in scanner list.

and in scanner HP application i got this name. and IT Scan Well :( in scanner list i don't got this name in my application. :(

on my pc setting -> devices -> scanner and printers i got those name.

A: Rewriting the resolution of the problem as an answer. I tested the code on my machine where it behaved correctly and argued the problem is most likely a driver issue. This has been confirmed by the OP and reinstall of the driver helped make the scanning work again.


text:
Q: Post request with payload and headers returns error page I am trying the get the content from a tvguide source https://sinematv.com.tr/Yayin-Akisi
With the below code, I receive an html page but it is just a runtime error message.
Most probably I am making a mistake when posting payload or headers.
What could be the problem?
url = 'https://sinematv.com.tr/Yayin-Akisi'
session = requests.Session()
request = session.get(url)
token = request.cookies['__RequestVerificationToken']
cookies = request.cookies

headers = {
    "authority": "sinematv.com.tr",
    "path": "/Asset/GetTvGuide/",
    "scheme": "https",
    "accept": "*/*",
    "accept-encoding": "gzip, deflate, br",
    "accept-language": "tr-TR,tr;q=0.9,en-TR;q=0.8,en;q=0.7,en-US;q=0.6",
    "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
    "origin": "https://sinematv.com.tr",
    "referer": "https://sinematv.com.tr/Yayin-Akisi",
    "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36",
}

payload = {"date": "16.10.2020", "__RequestVerificationToken":token}

response = requests.post(
    "https://sinematv.com.tr/Asset/GetTvGuide",
    data=payload,
    headers=headers,
    cookies=cookies,
)

print(response.content)

A: Wrong logic in getting token. It comes not from cookie, but from hidden element on page.
Try this:
import requests
from bs4 import BeautifulSoup

url = 'https://sinematv.com.tr/Yayin-Akisi'
session = requests.Session()
request = session.get(url)
soup = BeautifulSoup(request.content, "html.parser")
token = soup.find("input", {"name": "__RequestVerificationToken"})["value"]

payload = {
    "date": "16.10.2020",
    "__RequestVerificationToken": token
}

response = session.post(
    "https://sinematv.com.tr/Asset/GetTvGuide",
    data=payload
)

print(response.content)


text:
Q: How to store the timezone? Hi i am using PHP to store the timezone.The timezone coming from dropdown and when I try to store it if its (GMT+5.30) or (GMT+anything) the plus symbol doesnt stored on database.It **stored as (GMT 5.30).**How can I store it correctly?

A: Store all your times in UTC, that way you can easily convert them to any timezone that you require.
As for the timezone - I would store this in a seperate column either with the offset from UTC or even better store the locale of the timezone e.g. "America/New_York" that way you can accomodate for daylight saving times also.

A: $url_safe = urlencode($string);


text:
Q: How can I add "<" or other sign to the item that already started in the past [Timeline]? I'd like to add a sign to let the users know that this item has already started in the past. How can I do that?
My idea is to check for the current window and compare to the item start date and then redraw that item. But how can I do this?
Thank you very much.

A: I got my own answer.

timeline.on('changed', function (properties) {
    var visibleItems = timeline.getVisibleItems();
    $.each(visibleItems, function(index, value){
        var itemTest = $("div[data-id="+value+"]").find(".vis-item-content");
        var itemText = itemTest.text();
        if (itemTest.position().left > 0){
            if (itemText.search("<<<") == -1){
                itemTest.text("<<< " + itemText);
                }
            }else{
                itemTest.text(itemText.replace("<<< ", ""));
            }
        });
    });
};


text:
Q: How to periodically add/remove markers to google map from javafx? I am new to javaFx and trying to create a simple app that periodically add markers and remove markers on google map. I got my javaFx to load google map but i can't get it to add a marker. The error is:

netscape.javascript.JSException: ReferenceError: Can't find variable:
  clearMarkers

Here is my java code:
public class WebMap extends Application {

    private Scene scene;
    private MyBrowser myBrowser;
//    private LocationClickHandler handler;
//    private Vector<Button> buttons;

    @Override
    public void start(Stage primaryStage) {

//        buttons = new Vector<Button>();
        //moderator = new Moderator();
//        handler = new LocationClickHandler();
        primaryStage.setTitle("tracking-simulator");

        myBrowser = new MyBrowser();
        //moderator.registerAddIconListener(myBrowser);
        VBox mainbox = new VBox();
        mainbox.getChildren().add(myBrowser);

        // mainbox.getChildren().add(generateEntitiesButtonBox());
//  mainbox.getChildren().add(generateSensorsButtonBox());
        scene = new Scene(mainbox, 1280, 760);

        primaryStage.setScene(scene);

        primaryStage.show();

    }

    public static void main(String[] args) {
        Application.launch(args);
    }

    class MyBrowser extends Region {

        HBox toolbar;

        WebView webView = new WebView();
        WebEngine webEngine = webView.getEngine();
//        ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);

        public MyBrowser() {
            webView.setMinSize(1280, 400);
            final URL urlGoogleMaps = getClass().getResource("googlemap.html");
            webEngine.load(urlGoogleMaps.toExternalForm());

            getChildren().add(webView);

            for (int n = 0; n < 10; n++) {
                Platform.runLater(new UpdateGroupTrack());
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException ex) {
                    Logger.getLogger(WebMap.class.getName()).log(Level.SEVERE, null, ex);
                }
            }

        }

        private class UpdateGroupTrack implements Runnable {

            @Override
            public void run() {
                try {
                    double lat = 37.39822;
                    double lon = -121.9643936;
                    Random ran = new Random();

                    lat = lat + 100.0 / ran.nextInt(1000);
                    lon = lon + 100.0 / ran.nextInt(1000);
                    System.out.println("RUNNING===============");
//                    webEngine.executeScript("addMarker('" + lat + "', '" + lon + "');");
                    webEngine.executeScript("clearMarkers()");
                } catch (Throwable t) {
                    t.printStackTrace();
                }
            }
        }
    }
}

And here is my html:
<!DOCTYPE html>

        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />

Can you show me what is wrong?
Thanks,


text:
Q: ExportMenu Kartik doesn't work in yii2 GridView widget The export dropdown and toggle dropdown do not appear on click. I can't see any errors in console of developer tool.
I have used exactly same code in another project and that seems to work, the only difference is in the column set.
 <?php
        $exportColumns=[
            'name',
            'email',
            'username',
        ];

    echo  ExportMenu::widget([
        'dataProvider' => $dataProvider,
        'columns' =>$exportColumns,
        'dropdownOptions' => [
            'label' => 'Export All',
            'class' => 'btn btn-secondary'
        ]
    ]);
    ?>

A: I had a similar issue with my own Yii2 project. In my project the dropdown menu worked, but the buttons that appeared were unresponsive and the entire page froze without any console error.
My own mistake was that I required two bootstrap versions in my composer.json (I left in yiisoft/yii2-bootstrap in my case, removed the other).
Double Bootstrap


text:
Q: Positioning of a View at runtime i want to use a unknown (at begin) number of Views in my CustomView, so I have to set the position of each of them programatically. The problem is that I cannot use setX()/... or seTop()/... , because Im developing for froyo. But how can I set the position else?

A: With RelativeLayout you can do the following:
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)child.getLayoutParams();

layoutParams.leftMargin = x;
layoutParams.topMargin = y;

child.setLayoutParams(layoutParams);


text:
Q: Is $f$ sequentially continuous? Let $f\colon \mathbb{R}\to\mathbb{R}$ be a function. Aussume that for all sequences $(x_n)_{n\in\mathbb{N}}\subset\mathbb{R}$ with $x_n\to x$ in $\mathbb{R}$ there exists a subsequence $(x_{n_k})_k$ with $f(x_{n_k})\to f(x)$ for $k\to \infty$. Does it follow that $f$ is sequentially continuous?
Under these assumptions, one has to check that $f(x_n)\to f(x)$ for $n\to \infty$. However, I don't know how to do it. Any help will be appreciated.

A: Yes.
Assume that $x_n\to x$ while $f(x_n)\to f(x)$ is not true.
Then some $\epsilon>0$ exists together with a subsequence $(x_{n_k})$ such that $|f(x_{n_k})-f(x)|\geq\epsilon$ for every $k$.
This sequence $(x_{n_k})_k$  satisfies $x_{n_k}\to x$ but cannot have a subsequence $(x_{n_{k_i}})$ with $f(x_{n_{k_i}})\to f(x)$.
So a contradiction is found.

A: As a general rule if you have a sequence $(y_n)$ such that for any subsequence $(y_{n_k})$ there exists a further subsequence $(y_{n_{k_j}})$ that converges to $y_0$ then the original sequence, $(y_n)$, converges.
Proof. It should be clear that if $(y_n)$ is to converge, it must converge to $y_0$. The criterion for convergence says that for any $\varepsilon > 0$,
$$ y_n \in (y_0 - \varepsilon, y_0 + \varepsilon) $$
for all $n \ge$ some $N$.
If this is not the case, then there is some bad $\varepsilon_0$ such that for infinitely many $n$,
$$ y_n \notin (y_0 - \varepsilon, y_0 + \varepsilon). $$
But now, because we have infinitely many $n$'s, we obtain a subsequence $(y_{n_k})$ with
$$ y_{n_k} \notin (y_0 - \varepsilon, y_0 + \varepsilon), \forall k. \tag{$*$} $$
On the other hand, our hypothesis is that we can take a subsequence of $y_{n_k}$ that converges to $y_0$. But this is impossible if $(*)$ holds. This finishes the proof.
This result implies what you want. Let $x_n \to x$ and put $y_n = f(x_n)$. Then if $(x_{n_k})$ is a subsequence then it is in particular a sequence and by hypothesis there is a subsubsequence $(x_{n_{k_j}})$ such that $y_{n_{k_j}} = f(x_{n_{k_j}}) \to y_0 = f(x)$. Thus by the result above, $y_n = f(x_n) \to y_0 = f(x)$.


text:
Q: How to find the k value for K-Means clustering using scikit in python I have a Pandas DataFrame which looks like this:
          1         2         3         4         5         6         7         8         9         10        11   ...       467       468       469       470       471       472       473       474       475       476       477
1    1.000000  0.014085  0.134615  0.053030  0.109756  0.092105  0.095238  0.058824  0.104167  0.043478  0.135135  ...  0.045752  0.084112  0.098039  0.060870  0.000000  0.127273  0.043716  0.084615  0.068323  0.122449  0.172414
2    0.014085  1.000000  0.026667  0.039735  0.038095  0.074468  0.134021  0.084337  0.092593  0.184211  0.030303  ...  0.092025  0.107438  0.120690  0.021898  0.098361  0.176471  0.105820  0.127660  0.085714  0.132743  0.100000
3    0.134615  0.026667  1.000000  0.058824  0.054945  0.011494  0.089888  0.040541  0.078947  0.040541  0.141026  ...  0.050955  0.052174  0.063636  0.016000  0.000000  0.098361  0.048128  0.057971  0.072727  0.074766  0.068182
4    0.053030  0.039735  0.058824  1.000000  0.113924  0.056604  0.059880  0.039735  0.094170  0.039735  0.076433  ...  0.113636  0.104396  0.070652  0.072539  0.015152  0.042553  0.108434  0.081340  0.070833  0.059783  0.083333
5    0.109756  0.038095  0.054945  0.113924  1.000000  0.237113  0.102564  0.048077  0.120000  0.101010  0.090090  ...  0.064865  0.077465  0.111940  0.152174  0.011765  0.076087  0.070423  0.126582  0.082902  0.139535  0.145695
..        ...       ...       ...       ...       ...       ...       ...       ...       ...       ...       ...  ...       ...       ...       ...       ...       ...       ...       ...       ...       ...       ...       ...
473  0.043716  0.105820  0.048128  0.108434  0.070423  0.062802  0.150754  0.123656  0.333333  0.100000  0.110553  ...  0.178571  0.258706  0.257576  0.074689  0.033333  0.137143  1.000000  0.235556  0.202335  0.187500  0.147059
474  0.084615  0.127660  0.057971  0.081340  0.126582  0.118421  0.209459  0.074324  0.294737  0.135714  0.285714  ...  0.165094  0.215569  0.326667  0.071795  0.054264  0.221311  0.235556  1.000000  0.269608  0.287582  0.225275
475  0.068323  0.085714  0.072727  0.070833  0.082902  0.069149  0.337580  0.117647  0.259091  0.172840  0.286624  ...  0.139344  0.187817  0.204188  0.048035  0.050314  0.111111  0.202335  0.269608  1.000000  0.280899  0.175926
476  0.122449  0.132743  0.074766  0.059783  0.139535  0.130081  0.345455  0.132743  0.343750  0.361702  0.166667  ...  0.173913  0.312977  0.302326  0.059524  0.071429  0.229167  0.187500  0.287582  0.280899  1.000000  0.246753
477  0.172414  0.100000  0.068182  0.083333  0.145695  0.122449  0.200000  0.076923  0.248705  0.157895  0.144828  ...  0.157895  0.222222  0.220126  0.133333  0.065041  0.142857  0.147059  0.225275  0.175926  0.246753  1.000000

This is an example, but the number of row and columns may vary for other DataFrames.
I need to cluster the values using K-Means in scikit, but I have no idea of how to find the correct number of cluster for my dataFrame.
Any suggestion? Also, as I am new to python and being this the first time I use sci-kit, any easy explanation of how to perform the K-Means clustering would be much appreciated.

A: Very common is the Elbow method (https://www.geeksforgeeks.org/elbow-method-for-optimal-value-of-k-in-kmeans/), where you fit your data to the KMeans model and use the .inertia_ attribute to create a plot with the cluster value.
#Creating models for k from 2 to 14
inertia = []
for k in range(2,15):
    model = KMeans(n_clusters=k, random_state=12).fit(df)
    inertia.append(model.inertia_)

#Plotting the inertia of the models
k_values = range(2,15)
plt.plot(k_values, inertia, 'o-')
plt.xlabel('Number of Clusters')
plt.ylabel('Inertia')

You should see something similar to this, indicating that, for this specific data frame I have created for this exercise, the ideal K value would be 3, as this is where you see the "elbow" - and the following k values do not bring much change in inertia:

A: We usually use Elbow Method to find the value of "K" in K-means.
inertias=[]
for k in K:
    clf= KMeans(n_clusters=k)
    clf.fit(X)
    inertias.append(clf.inertia_)

plt.plot(inertias)

Now from the plot, you have to find the breakpoint. For the provided image, from point 1-3, the inertia changes drastically. The rate of change reduces from point 4. That means, 4 will be the elbow point, i.e., k=4
For a detailed explanation, you may visit,

*

*Elbow Method for K Means

*GFG


text:
Q: Rails 3.0 - PCI compliant? Does anyone know if Rails 3.0 passes PCI compliance scans?

A: Frameworks that are used are not the issue, it the applications that are built on the framework. So essentially PCI is framework - rails in this case - agnostic.
Just make sure you code a secure app using rails and you will be fine.

A: I suspect that depends deeply on how you write your application on top.
I could write an application that didn't store credit card data encrypted, or was otherwise filled with security holes, and then it wouldn't be PCI-DSS compliant, regardless of the framework underneath.

A: I'm not sure about Rails 3.0 specifically, but the majority of Braintree's payment gateway is using Rails 2.x, and Braintree is a PCI compliant service provider.


text:
Q: Distribution on $(0, \infty)$ which cannot be extended to $\mathbb{R}$ I am working on exercises from Friedlander's Introduction to the Theory of Distributions and I am stuck in a particular problem.
The question is: "Show that $\langle u, \phi\rangle = \sum_\limits{k \geq 1} \partial^k \phi(1/k)$ is a distribution on $(0, \infty)$, but that there is no $v\in \mathcal{D}'(\mathbb{R})$ whose restriction to $(0, \infty)$ is equal to $u$."
I believe I have managed to prove the first part: Given any compact $K \subset (0,\infty)$, take a test function $\phi\in C^{\infty}_c(0, \infty)$ with $\operatorname{supp} \phi \subset K$. Take then $N$ such that $\frac{1}{N+1} < \min \operatorname{supp} \phi$. We have that $\langle u, \phi\rangle = \sum_\limits{k = 1}^N \partial^k \phi(1/k)$, since $\phi(1/k) = 0, \forall k>N+1$. And so it is clear that $\exists C$ and $\exists N$ such that $u$ satisfies the seminorm estimates $|\langle u, \phi\rangle| \leq \sum\limits_{k=1}^N |\sup\partial^k \phi|$ for any $\phi$.
Now, the second part is troubling me. I believe the way is to suppose there is a distribution $v\in \mathcal{D}'(\mathbb{R})$ with $v|_{(0,\infty)} = u$, and show that it would not satisfy the seminorm estimate because of the restriction. However, I am struggling to see how that should be done.
Note: I have recognized this distribution to be equivalent to $\sum\limits_{k\geq 1} \delta^{(k)}(x-1/k)$ but I am not sure how this helps!

A: To close the question, Willie Wong's suggestion was to choose a test function which is equal to $\exp(x)$ within $\{x:|x|<1\}$. Then $\langle u, \phi\rangle = \sum\limits_{k\geq 1} \exp(1/k) > \sum\limits_{k\geq 1} \exp(0)$ which is unbounded as $k\to\infty$. And so $|\langle u, \phi\rangle|$ cannot be bound by seminorm estimates for our chosen $\phi$.


text:
Q: How do I print that the type of a variable is interface {} package main

import (
    "fmt"
    "reflect"
)

func main() {

    fmt.Println("doing typeSwitchFunc(nil):")
    typeSwitchFunc(nil)

    fmt.Println("\ndoing typeSwitchFunc(22):")
    typeSwitchFunc(22)

}

func typeSwitchFunc(i interface{}) {
    switch j := i.(type) {

    case nil:
        // How do I print the type of j as interface{} ? Below only gives me the information on underlying type stored in j  -- (A)
        fmt.Printf("case nil: j is type %T, j value %v, i is type %T, i value %v\n", j, j, i, i)
        fmt.Printf("case nil: j is type: %v, j value: %v, j kind: %v\n", reflect.TypeOf(j), reflect.ValueOf(j), reflect.ValueOf(j).Kind())
    default:
        // How do I print the type of j as interface{} ? Below only gives me the information on underlying type stored in j -- (B)
        fmt.Printf("default: j is type %T, j value %v, i is type %T, i value %v\n", j, j, i, i)
        fmt.Printf("default: j is type: %v, j value: %v, j kind: %v\n", reflect.TypeOf(j), reflect.ValueOf(j), reflect.ValueOf(j).Kind())

    }
}

output:
$ go run type-switch-minimal-example.go
doing typeSwitchFunc(nil):
case nil: j is type <nil>, j value <nil>, i is type <nil>, i value <nil>
case nil: j is type: <nil>, j value: <invalid reflect.Value>, j kind: invalid

doing typeSwitchFunc(22):
default: j is type int, j value 22, i is type int, i value 22
default: j is type: int, j value: 22, j kind: int

$ go version
go version go1.17.4 darwin/amd64

How do I print the type of j as interface {} ?

A:
How do I print the type of j as interface {} ?

You can't.
Source: fmt docs:

Regardless of the verb, if an operand is an interface value, the internal concrete value is used, not the interface itself.

Why would you be interested in spelling out "interface{}" anyway? This behavior of the fmt package is what allows it to work with any type right away without special magic.
In @mkopriva's example:
fmt.Println(reflect.TypeOf((*interface{})(nil)).Elem())

the output is interface {} because that's the string representation of *interface{} element type, which is truthfully interface {}. But in this case you're getting there via reflection, not fmt verbs.


text:
Q: Calculate new 2D vector translated perpendicularly from initial vector I have a vector in 2D that is defined by two sets of points, (x1, y1) and (x2, y2). I need to calculate a new vector that is translated perpendicularly by H distance.
For example if my points are (0, 0) and (0, 10) a perpendicular translation of H=5 would result in a new vector (5, 0) and (5, 10).
I am trying to find a more generic formula. I know I should probably use the heading (or azimuth) angle. That is the angle from the y axis clockwise to my vector. But I can not wrap my head around the trig.
Ideally I would like to have H > 0 be a right translation and H < 0 a left translation (assuming standing at x1/y1 looking at x2/y2).

A: Start with the two endpoints of you line segment, A=(x1, y1) and B=(x2, y2). (Note that vectors and line segments are not the same thing.)
Calculate the vector: v = B-A = (x2-x1, y2-y1)
Calculate its magnitude: |v| = sqrt(v12  +v22)
Normalize it (that is, change its magnitude to one, leaving its direction unchanged): v' = v/|v| = (v1/|v|, v2/|v|)
Rotate it 90 degrees clockwise: v'' = (v'2, -v'1)
Multiply it by H: z = Hv'' = (Hv''1, Hv''2)
Add that to your two endpoints: A' = A+z = (x1+z1, y1+z2) B'= B+z = (x2+z1, y2+z2)
The subscripts may look a little confusing. That's because you and I are using different conventions: You are using letters for dimensions and subscripts for points; I am doing it the other way around. Ordinarily I try to use the language of the person whose question I'm trying to answer, but in this case your convention gets confusing when there are several points involved. If it's really unclear, I can try to rewrite it.


text:
Q: How to make Image pop up when my ball hits STRIKE or SPARE? Hello guys here I am trying to make a bowling game. What I want is to pop up image of Strike when ball hits strike or spare image when hits spare.
please help me out your help will be appreciated.
please answer me as soon as possible.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;

public class ScoreDisplay : MonoBehaviour {

public  Image strick;
public Text[] rollTexts, frameTexts;

public void FillRolls (List<int> rolls) {
    string scoresString = FormatRolls (rolls);
    for (int i = 0; i < scoresString.Length; i++) {
        rollTexts[i].text = scoresString[i].ToString();
    }
}

public void FillFrames (List<int> frames) {
    for (int i = 0; i < frames.Count; i++) {
        frameTexts[i].text = frames[i].ToString();
    }
}

public static string FormatRolls (List<int> rolls) {
    string output = "";

    for (int i = 0; i < rolls.Count; i++) {
        int box = output.Length + 1;                            // Score box 1 to 21

        if (rolls[i] == 0) {                                    // Always enter 0 as -
            output += "-";
            strick.enabled = true;
            Debug.LogError("Better Luck Next Time");
        } else if (box % 2 == 0 && rolls[i-1]+rolls[i] == 10) { // SPARE anywhere
            output += "/";
            Debug.LogError("Its Spare");
        } else if (box >= 19 && rolls[i] == 10) {               // STRIKE in frame 10
            output += "X";
            Debug.LogError("Congo you got Strick");
        } else if (rolls[i] == 10) {                            // STRIKE in frame 1-9
            output += "X ";
            Debug.LogError("Its Strick");
        } else {
            output += rolls[i].ToString();                      // Normal 1-9 bowl
            Debug.LogError("Try Your Hard");
        }
    }

    return output;
}

}

A: What you could do is put the image as a child of an empty gameobject,
this will turn it into a gameObject which you can easily instantiate in your code using the Instantiate(object,position,rotation) function.
You can declare a public GameObject, drag your prefab (Gameobject with your image as child) into the inspector then use Instantiate on it, I recommend doing this because then you have more control over your gameobject after it's been instantiated.
for (int i = 0; i < rolls.Count; i++) {
    int box = output.Length + 1;                            // Score box 1 to 21

    if (rolls[i] == 0) {                                    // Always enter 0 as -
        output += "-";
        Instantiate(GameObjectYouWantToInstantiate, location, rotation);

        //strick.enabled = true;
        Debug.LogError("Better Luck Next Time");
    } else if (box % 2 == 0 && rolls[i-1]+rolls[i] == 10) { // SPARE anywhere
        output += "/";
        Debug.LogError("Its Spare");
    } else if (box >= 19 && rolls[i] == 10) {               // STRIKE in frame 10
        output += "X";
        Debug.LogError("Congo you got Strick");
    } else if (rolls[i] == 10) {                            // STRIKE in frame 1-9
        output += "X ";
        Debug.LogError("Its Strick");
    } else {
        output += rolls[i].ToString();                      // Normal 1-9 bowl
        Debug.LogError("Try Your Hard");
    }
}

Use Destroy(Strick) when you want to destroy it.


text:
Q: What is php PECL oauth module? I have to use "php PECL oauth module" in my code but I dont know anything about it. Like what is it andwhat are its uses. Please guide me and tell me about it and how to use it in my iPhone project. My question could be wrong but I think u will understand what I want to know. Answer with some code snippet will be appreciated. Thanks,

A: OAuth is a is a token based iauthorization system. Once you have your security token you can identify yourself on different websites without handing out your credentials. OAuth is used by many webservice providers including Google.
You should read this:

*

*Google API:
http://code.google.com/intl/de-DE/apis/accounts/docs/OAuth.html

*OAuth Documentation: http://oauth.net/documentation/

*Wikipedia http://en.wikipedia.org/wiki/OAuth
If this does not help you feel free to ask a specific question on anything you can not handle.


text:
Q: radio button check selection change event in jquery this is my html

     <input name="Names" type="radio" class="VoteAns" id="VoteAns_269_1" value="Values" contenteditable="false"/>
     6 : 00 PM

     <input name="Names" type="radio" class="VoteAns" id="VoteAns_269_2" value="Values" contenteditable="false"/>
     7 : 00 PM

     <input name="Names" type="radio" class="VoteAns" id="VoteAns_269_3" value="Values" contenteditable="false"/>
     8 : 00 PM

     <input name="Names" type="radio" class="VoteAns" id="VoteAns_269_4" value="Values" contenteditable="false"/>
     9 : 00 PM

     <input name="Names" type="radio" class="VoteAns" id="VoteAns_269_5" value="Values" contenteditable="false"/>
     10 : 00 PM

     <input name="Names" type="radio" class="VoteAns" id="VoteAns_269_6" value="Values" contenteditable="false"/>
     11 : 00 PM

this is js
 /*
    $jq("input[name=Names]:radio").on('change', function(){
        console.log("dfdfd");
    });
    $jq("input[name=Names]:radio").click(function(){
        console.log("dfdfd");
    });
    console.log($jq("#VoteAns_268_1").val());
    $jq('.VoteAns').change(function (){
    console.log("vote Answers");
    });
    */
  /*  $jq("input[name=Names]:radio").change(function () {
        conosle.log("radiobutton changes");
    })*/

 /*   $jq(".VoteAns").change(function(){
        conosle.log("VoteAns");
    });*/
    /*$jq(".VoteAns").on('change',function(){
        conosle.log("VoteAns");
    });
    $jq("#VoteAns_269_1_lbl").on('change',function(){
        conosle.log("VoteAns123");
    });*/
    /*$jq(".VoteAns").click(function(){
        alert("kk");
    })*/
     $jq("input:radio[name='Names']").change(function(){
        alert("input11!!");
    });

As u can see in comments I have tried all these code but none of this working form me. tired of searching and trying different codes whats the problem please help.
I want to display  specific html on different radio option click

A: You have incorrect syntax. you have not closes the square bracket while using attribute equals selector:
$("input:radio[name='Names']").change(function(){
   alert("input11!!");
});

Working Demo

A: See this fiddle
HTML
<input type="radio" name="greeting" id="hi" checked="checked" value="hi">hi
<input type="radio" name="greeting" id="hello" value="hello">hello

JS
$(document).ready(function () {
    $('input:radio[name=greeting]').change(function () {
        if (this.value == 'hi') {
            alert("hi");
        } else if (this.value == 'hello') {
            alert("hello");
        }
    });
});

in your code, you are missing a ].That is, your new code would be like
$("input:radio[name='Names']").click(function(){
    alert("input!!");
});

See the fiddle

A: Fiddle
$("input[name='Names']").change(function () {
    alert($(this).next().text());
});

change your jq to $ and a bit cleaner selector from "input:radio[name='Names']" to "input[name='Names']"

A: Try this it works for me.
         $("input[name='Names']:radio").change(function () {
              alert('input!!');
          });

if you are using $jq then make sure that u have that line on top.
           $jq = jQuery.noConflict();

           $jq("input[name='Names']:radio").change(function () {
              alert('input!!');
           });


text:
Q: Protege DataMaster: Table records cannot be shown or imported There are some records in my tables stored in MySQL, and the Protege DataMaster plugin can be successfully connected to the database. Tables can be listed on the left. But when I click any one of them, no table data is shown on the right, i.e. the Preview part.
I'm importing the table example_table as "Relational.OWL instances", and I also checked "import table content". All I want is transforming MySQL records into Protege instances. After I clicked "Import",
dbs:Database
dbs:Table
dbs:Column
dbs:PrimaryKey
example_table

appeared in the class hierarchy, but in the Individuals tag, no instances were added, i.e. the records in example_table were not imported. Anybody has some idea about what's wrong here?

A: Well...I think it's an encoding issue. I'm previously using Chinese for the table name and table contents. However if I change the table name to roman characters the table will work well in DataMaster.


text:
Q: How to identify the file type even though the file-extension has been changed? Files are categorized by file-extension. So my question is, how to identify the file type even the file extension has been changed.
For example, i have a video file with name myVideo.mp4, i have changed it to myVideo.txt. So if i double-click it, the preferred text editor will open the file, and won't open the exact content. But, if i play myVideo.txt in a video player, the video will be played without any problem.
I was just thinking of developing an application to determine the type of file without checking the file-extension and suggesting the software for opening the file. I would like to develop the application in Java.

A: One of the best libraries to do this is Apache Tika. It doesn't only read the file's header, it's also capable of performing content analysis to detect the file type. Using Tika is very simple, here's an example of detecting a file's type:
import java.net.URL;
import org.apache.tika.Tika; //Including Tika

public class TestTika {

    public static void main(String[] args) {
        Tika tika = new Tika();
        String fileType = tika.detect(new URL("http://example.com/someFile.jpg"));
        System.out.println(fileType);
    }

}

A: Structure, magic numbers, metadata, strings and regular expressions, heuristics and statistical analysis... the tool will only be as good as the database of rules behind it.
Try DROID (Digital Record Object IDentification tool) for identifying file types; Java, Net BSD-licensed. It is a free project of the National Archives UK, unrelated to Android. Source is available on Github and Sourceforge. The DROID documentation is good, there's also a getting started guide from the Digital Preservation Coalition.
See also Darwinsys file and libmagic.

A: There's a tool called TrID that does what you are after - it current supports 5033 different file types - and can be trained to add new types. On *nix systems, there's also the file command, which does something similar.

A: well, its like having a database of file-format you want to read without looking for extension  in your app. Exactly as Linux does. So whenever you open a file, you need to check file-format database which type it belongs to. Though Not sure how will it work for different file types, but most of files have fixed header format, be it zip, pdf, mpg, avi, png, etc.. so this approach should work

A: You could try MimeUtil2, but it's quite old and though not up2date. The best way is still the file extension.
But the solution from Adam is not as bad as you think. You could build your platform independent solution using a wrapper around command line calls. I think you will get much better results using this method.

A: The following code snippet retrieves information about the file type
final File file = new File("file.txt");
System.out.println("File type is: " + new MimetypesFileTypeMap().getContentType(file));

Hopefully, it may help you


text:
Q: VBA to open MyComputer at a specific folder Ive just inherited an MS Access 2003 system and need a bit of VBA to put behind a command button to open MyComputer at a specific folder to view the files there.
The folder name will come from a field on a form.
I did have
Application.FollowHyperLink "C:\" & Me![ref]    (ref is in the format abcd-1234)
when its hard-coded it works fine, but i cant seem to get it to open when picking the foldername up from the form.
any hints? (other than binning access!)
thanks

A: See what the text looks like as you're submitting it to FollowHyperlink.  You can insert a line like this in your code:
MsgBox "C:\" & Me![ref]

Perhaps it's not what you expect.  It's always good to check.
What happens when it doesn't work.  Do you see any error messages or any other symptoms which could help us nail this down?
My first thought was spaces in a folder name might create problems.  But I don't think that's the answer because FollowHyperlink works fine for me in this example:
Application.FollowHyperlink "C:\Access\spaces in name\"

So the best I can offer is to see what you're asking FollowHyperlink to use.  If that effort doesn't lead you to the answer, add a specific example which fails to your question.

A: This code always work for me:
Dim filePath = <"Insert the path of the directory to open inside of opening and closing parenthesis">

Application.FollowHyperlink filePath, vbNormalFocus

Normally, I store a few directories in a table inside the DBMS, which helps when linking hundreds of images to a database instead of embedding.  For instance, I have a table called, "dbLocations."  Inside this table, there are only two fields: 1) picLocation 2) Description.
The field picLocation has the value of the network path, i.e, C:\My Documents or G:\Whatever Directory or \\groups1\for UNC paths.
The field Description is what it implies, a description of the picLocation.
I use tables to store directory locations because they linking to files (.jpg, .png) stored on a network drive.  As time evolves, directories can get changed (I move a folder to another location, or if the UNC changes, etc.).
If you hard code the location(s) over several subs or modules, you will need to change each one; which is very inefficient.  So, in order to save time and a lot of headaches, I use the Domain Lookup function which allows me to only change the file location just once and in an easy to find place, namely, the dbLocations table.
In essence, I am looking up the value of the location inside the table where the picLocation matches the description of, Alert Pics.  (I am creating a database that will be used to track Trespassers and other vagrant persons for work)
Dim filePath as String

filePath = DLookup("picLocation", "dbLocations", "[Description] = 'Alert Pics'")
Application.FollowHyperlink filePath, vbNormalFocus

With these three lines of simple code, you can navigate to a specific directory.


text:
Q: Google maps js api v3: add delay to markers function setMarkers(map, markers) {

var bounds = new google.maps.LatLngBounds();

for (var i = 0; i < markers.length; i++) {

    var siteLatLng = new google.maps.LatLng(markers[i][2], markers[i][3]);

    var marker = new google.maps.Marker({
        position: siteLatLng,
        map: map,
        animation: google.maps.Animation.DROP,
        title: markers[i][1],
        html: markers[i][0]
    });

    google.maps.event.addListener(marker, "click", function () {
        $('.imglink').attr('href', 'img/' + this.html);
        $('.imglink').click();
    });

    bounds.extend(siteLatLng);
    map.fitBounds(bounds);

}

}

Is there any way to make a delay between each marker? Thanks

A: You can set a timeout between the creation of one marker and the next like so (the example below makes a 500ms pause):
setTimeout(function(){}, '500');


text:
Q: VB find out number is mod of which number I'm trying to find the number that gives me the result, here's the equation:
x=y mod z
y=?

In this equation, I know values of x and z but I need to find of y too, does anyone has an idea?

A: There are many solutions to your problem because mapping integers to values in ring Zz (z integer numbers: 0, 1, ..., z - 1) is not a bijection:
y = { x + n * z : n is integer }

So, the simplest function that will provide you with an answer can be as simple as that:
Function solution( ByVal x As Integer) As Integer
    Return x
End Function

You can also write something that will return you next possible solution:
Function solution_next( ByVal x As Integer, ByVal z As Integer) As Integer
    Static n As Integer = 0
    i + z * n
    n += 1
    Return i
End Function

You can adjust this further given more conditions.


text:
Q: How to force developers to use a specific commit message Our product documentation tells our developers to run git config commmit.template .gitmessage. However, many developers have not done so and are not following our commit template.
I'm using the following husky hook to stop a commit if they haven't set commit.template.
"husky": {
    "hooks": {
        "pre-commit": "if `git config commit.template` | grep -q '.gitmessage'; then lint-staged; else echo 'Commit template not being used. Please run git config commit.template .gitmessage' && exit -1; fi"
    }
},

However, I get the following error when running it on Windows.
> if `git config commit.template` | grep -q '.gitmessage'; then lint-staged; else echo 'Commit template                                             not being used. Please run git config commit.template .gitmessage' && exit -1; fi

config was unexpected at this time.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gittest@1.0.0 gitcommit: `if `git config commit.template` | grep -q '.gitmessage'; then lint-st                                            aged; else echo 'Commit template not being used. Please run git config commit.template .gitmessage' && e                                            xit -1; fi`

Is there an approach I can take that works for both Windows and Unix?


text:
Q: Matrix to image with exactly 1 pixel for each element I am interested in converting a matrix to an image (element value = pixel intensity), a bit like:
R - image of a pixel matrix?
However I need the size of the image to be exactly (in pixels) the size of the matrix. So if the matrix is 234x14 so should be the generated image.
Preference for a solution using no additional R package (like in answer to question lined above), but everything would be fine as well.

A: One way is to avoid the R devices completely, and rely on the GDAL drivers in rgdal.
m <- matrix(rep(1:234, each = 14), ncol = 14, byrow = TRUE)
l <- list(x = 1:nrow(m), y = 1:ncol(m), z = m)

library(rgdal)
x <- image2Grid(l)
writeGDAL(x, "out.tif")

There are other drivers in GDAL, but "GeoTIFF" is the default, and the defaults will preserve the values accurately (within the numeric limits of R and GDAL). This is just a single band raster, but it will work the same for multiple attributes.
The real limit here is the target you have for the file, and whether it can read the resulting image in the way that you want. GDAL has all the options you would need, but whether the defaults are right and what you really need depends on details.
y <- readGDAL("out.tif")
all.equal(as.image.SpatialGridDataFrame(y)$z, m)
[1] TRUE

Here is a floating point example that shows the numeric limits more realistically:
set.seed(1)

m <- matrix(runif(234 * 14), ncol = 14)
l <- list(x = 1:nrow(m), y = 1:ncol(m), z = m)

library(rgdal)
x <- image2Grid(l)
writeGDAL(x, "out.tif")

y <- readGDAL("out.tif")

all.equal(as.image.SpatialGridDataFrame(y)$z, m)
[1] "Mean relative difference: 1.984398e-08"

Another way is the pnm format that is used by pixmap. See
library(pixmap)

?write.pnm

A: It is an extra package, but you could try pixmap: http://cran.r-project.org/web/packages/pixmap/index.html
If you want animated images, you can write animated gifs from matrices using caTools.

A: Here is an alternative way to solve the problem. Included in the example are ways to add margins with axes information, how to normalize and floor the data to be plotted + use a colour (blue) for a specific level (zero). Substitute  and  with the specific data you want to use and change {lm, bm, tm, rm} to different values to resize the four margins (all measures in pixels):
maxv <- 500

v <- t(<matrix>)
d <- <vector>
di <- <vector>
dm <- <vector>
nr <- nrow(v)
nc <- ncol(v)

library(grid)
vnorm <- v
for (r in 1:nr) {
  for (c in 1:nc) {
    vnorm[r,c] <- min(1, v[r, nc-c+1]/500)
    if (vnorm[r,c] == 0) {vnorm[r,c] <- "blue"}
    else {vnorm[r,c] <- grey(vnorm[r,c])}
  }
}
vnorm <- t(vnorm)

x <- seq(1, nr)
y <- rep(1, nr)
xrange <- range(d)
yrange <- c(0, 24)

bm <- 90
lm <- 40
tm <- 12
rm <- 12

png(file="graph.png", width=nr+lm+rm, height=nc+tm+bm)
par(mai=c(bm/72, lm/72, tm/72, rm/72))
plot(d, y, ann=FALSE, xlim=xrange, ylim=yrange, axes=FALSE, xaxs="i", yaxs="i")
axis(1, at=dm,labels=dm, col.axis="black", las=2)
axis(2, at=seq(0,24),labels=seq(0,24), col.axis="black", las=2)
rasterImage(vnorm, xrange[1], yrange[1], xrange[2], yrange[2], interpolate=FALSE)
dev.off()


text:
Q: Retrieve a list of users based on some conditions What am I doing wrong on this query? The main issue is the var_dump returns null. The query works fine in phpMyAdmin.
global $wpdb;
$users = $wpdb->get_results(
    $wpdb->prepare(
        "SELECT
            u.ID AS id,
            u.user_login AS name,
            AVG(b.star) AS rating,
            COUNT(b.star) AS reviews,
            m.meta_value AS roles
        FROM
            wp_users AS u
                LEFT JOIN
            wp_usermeta AS m ON u.ID = m.user_id
                LEFT JOIN
            wp_bp_activity AS b ON u.ID = b.usercheck
        WHERE
            (m.meta_key = 'wp_capabilities' AND m.meta_value LIKE '%subscriber%')
        AND
            (b.is_activated is null or b.is_activated = 1)
        GROUP BY u.ID
        ORDER BY reviews DESC
        LIMIT %d", $limit
    )
);
return var_dump($users);

A: Be careful with the '%subscriber%' part, inside the wpdb::prepare() method.
Use '%%subscriber%%' instead.
Otherwise $limit will match the %s part and the  %d part will be unmatched.


text:
Q: How can I reconstruct a QM probability curve using a truncated cos curve? I have a curve that represents a quantum mechanical probability.  I am interested in finding an algorithm (or calc I/II type formula) to compute a weighting function, k(), that will reconstruct this curve using truncated cos(). I don't think this is Fourier problem ...
The reconstruction is to study the how quantum probabilities might be represented by coupled classical rotational motion.
The curve itself, f(x)^2, takes two parameters $k_1 , k_2$ as arbitrary inputs, but all other constants are calculated from them.
$f(x)^2=(A cos(k_1 x) + B sin(k_1 x))^2$ for x<0
$f(x)^2=(C cos(k_2 x) + D sin(k_2 x))^2$ for x>=0
Where:
$B={1 \over \sqrt{ k_2 + k_1 }}$
$A=\sqrt{1-B^2}$
$C=A$
$D={k_1 \over k_2} B$
f(x)^2 is defined over $[x_1:x_2]$
$x_1 = {atan(-{A \over B}) \over k_1}$,
$x_2 = {atan(-{C \over D}) + \pi) \over k_2}$
The way I need to reconstruct $f(x)^2$ is by the following summation of truncated cos functions:
$isubpx(x)=scale \cdot \Sigma_{n=1}^{1000} cos_t(2 k(X_n)(x-X_n)) $
Where:
$X_n=x_1+{\pi \over {4 k_1}} + (x_2-x_1-{\pi \over {4 k_1}} - {\pi \over {4 k_2}}){n \over 1000} $
$cos_t(x) = cos(x)$  for $-{\pi \over 2} < x < {\pi \over 2}$
$cos_t(x) = 0 $    elsewhere.
$scale \approx 0.01822385 \cdot k_1$
Note:
If constant $k_1=k_2$, then the k() function becomes constant over x.  In general, the k() function will likely start at $k_1$ and end at $k_2$
As an example, if I choose $k_1=2$ and $k_2=1$, the following plot shows the function (in purple), and it shows my first attempted weighting function (in blue), and the sum of the 1000 localized cosine functions in green.

The associated cos() function's width is set by the blue line's height; 1/k() -- so the blue line's height measures the area each cos() will add to the green curve.


text:
Q: How to search for texts There is a particular column in a table where staff narrates the nature of payment or receipt.
Write something like 'PAYMENT OF SALARIES FOR THE MONTH OF NOVEMBER 2018'.I want to be able to have code (ORACLE SQL) that will just pick the months out of those narrations.

A: You can use regexp-based functions (_replace,_substr,_count) consecutively to extract the month name, assuming all data with the same format model as ending with "month year" combination
with t(str) as
(
 select 'PAYMENT OF SALARIES FOR THE MONTH OF NOVEMBER 2018' from dual
), t2 as
(
select rtrim(str,regexp_replace(str,'(\D)')) as str
  from t
), t3 as
(
select regexp_substr(str,'[^ ]+',1,level) as str,
       regexp_count(str,'[^ ]+') as cnt,
       level as lvl
  from t2
 connect by level <= regexp_count(str,'[^ ]+')
)
select str
  from t3
 where lvl = cnt;

STR
--------
NOVEMBER

A: even this will work as the text format you specified is same :
 select * from (select rownum, regexp_substr("column1",'[^ ]+', 1, level) from Table1
 connect by regexp_substr("column1", '[^ ]+', 1, level) is not null) where rownum<=8
 minus
 select * from (select rownum, regexp_substr("column1",'[^ ]+', 1, level) from Table1
 connect by regexp_substr("column1", '[^ ]+', 1, level) is not null) where rownum<8;

http://sqlfiddle.com/#!4/560dc/13

A:  where
  Date >= to_date(substr(:from_date ,1,10),'YYYY/MM/DD')
  and
  Date <= to_date(substr(:last_date,1,10),'YYYY/MM/DD')


text:
Q: How to login to postgresql db - After session kill (for copy database) I tried to copy a database within the same server using postgresql server
I tried the below query
CREATE DATABASE newdb WITH TEMPLATE originaldb OWNER dbuser;

And got the below error
ERROR:  source database "originaldb" is being accessed by 1 other user

So, I executed the below command
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'originaldb' AND pid <> pg_backend_pid();

Now none of us are able to login/connect back to the database.
When I provide the below command
psql -h 192.xx.xx.x -p 9763 -d originaldb -U postgres

It prompts for a password and upon keying password, it doesn't return any response
May I understand why does this happen?  How can I connect to the db back? How do I restart/make the system to let us login back?
Can someone help us with this?

A: It sounds like something is holding an access exclusive lock on a shared catalog, such as pg_database.  If that is the case, no one will be able to log in until that lock gets released.  I wouldn't think the session-killing code you ran would cause such a situation, though.  Maybe it was just a coincidence.
If you can't find an active session, you can try using system tools to figure out what is going on, like ps -efl|fgrep postgre.  Or you can just restart the whole database instance, using whatever method you would usually use to do that, like pg_ctl restart -D <data_directory> or sudo service postgresql restart  or some GUI method if you are on an OS that does that.


text:
Q: Parse.com : Not able to receive notification My code is as below
AndroidManifest.xml
    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.aaa"
    android:versionCode="2027"
    android:versionName="5.1.5" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="18" />

    <uses-permission
        android:name="android.permission.GET_TASKS"
        android:protectionLevel="normal" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_OWNER_DATA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

    <permission
        android:name="com.aaa.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

     <uses-permission android:name="com.aaa.permission.C2D_MESSAGE" />

    <application
        android:name="com.aaa.application.SalesEnablementApplication"
        android:allowBackup="true"
        android:icon="@drawable/ic_app_icon_new"
        android:label="@string/app_name"
        tools:replace="android:label"
        android:largeHeap="true"
        android:theme="@style/AppTheme" >

        <meta-data
            android:name="com.parse.APPLICATION_ID"
            android:value="@string/application_id_stage" />
        <meta-data
            android:name="com.parse.CLIENT_KEY"
            android:value="@string/client_key_stage" />

        <receiver
            android:name="com.xxx.util.NetworkStateReceiver"
            android:enabled="false"
            android:label="NetworkStateReceiver" >
            <intent-filter>
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            </intent-filter>
        </receiver>

       .
       .
       .

        <receiver android:name="com.aaa.pushNotification.PushBroadcastReceiver" >
            <intent-filter>
                <action android:name="com.aaa.Notification_ACTION" />
            </intent-filter>
            <!-- <category android:name="android.intent.category.DEFAULT" /> -->
        </receiver>

        <service android:name="com.parse.PushService" />

        <receiver android:name="com.parse.ParseBroadcastReceiver" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.USER_PRESENT" />
            </intent-filter>
        </receiver>
        <receiver
            android:name="com.aaa.receiver.CustomParsePushBroadcastReceiver"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.parse.push.intent.RECEIVE" />
                <action android:name="com.parse.push.intent.DELETE" />
                <action android:name="com.parse.push.intent.OPEN" />
            </intent-filter>
        </receiver>
        <receiver
            android:name="com.parse.GcmBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <!-- IMPORTANT: Change "com.parse.starter" to match your app's package name. -->
                <category android:name="com.aaa" />
            </intent-filter>
        </receiver>
        <receiver
            android:name="com.aaa.receiver.MyReceiver"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.parse.starter.UPDATE_STATUS" />
                <action android:name="com.aaa.UPDATE_STATUS" />
                <!--
                <action android:name="com.push.intent.RECEIVE" />
                <action android:name="com.push.intent.DELETE" />
                <action android:name="com.push.intent.OPEN" />
                -->
            </intent-filter>
        </receiver>

        <!--
        <receiver
            android:name="com.aaa.receiver.MyReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="com.aaa" />
            </intent-filter>
        </receiver>
        -->

    </application>

</manifest>

My Application Class:
public void onCreate() {
    super.onCreate();

    // Enable Local Datastore.
    Parse.enableLocalDatastore(this);

    // Init Parse App after checking the current environment
    Parse.initialize(this);
    /*if(Environment.ENV.equalsIgnoreCase(Environment.ENV_STAGE)){
        Parse.initialize(this,     getResources().getString(R.string.application_id_stage), getResources().getString(R.string.client_key_stage));
    }else{
        Parse.initialize(this, getResources().getString(R.string.application_id_prod), getResources().getString(R.string.client_key_prod));
    }*/

    ParseInstallation.getCurrentInstallation().saveInBackground();

    ParseACL defaultACL = new ParseACL();
    defaultACL.setPublicReadAccess(true);
    defaultACL.setPublicWriteAccess(true);

    ParseACL.setDefaultACL(defaultACL, true);
    // used to store temp objects
    dataStore = new DataStore();

    eventCaptureHandler = new EventCaptureHandler(this);
}

I am using parse SDK version 1.13.0.
Testing on Android 6.0.1 (Sony Xperia Z2).
I try to send push message from the Parse Dashboard. I do not receive the notification sent. I noticed that DeviceType and pushType, in the Installation table, is set to (Undefined).


text:
Q: RxJava 2 assembly process I have a question about assembly process of RxJava2. What is the main purpose of this process? When is attribute onObservableAssembly (RxJavaPlugins) set to null or to reference? And is possible to watch implementation of functional interface with apply method which is used in onAssembly method? You can explain case with Observable.just(1,2,3) and with filter. Thanks

A: The assembly process is when operator chains are established to form a template for the dataflow realized later via a subscribe() call. Assembly hooks are advanced concepts, typically not needed by most users, to inject custom operators when the static/final methods of Observable are called.
Use cases could be:

*

*Adding debug operators that capture the current stacktrace when the assembly happened, possibly giving extra information where to look in case of crashes.

*Replacing specific operators with other custom operators.

*Shimming custom operators that validate the flow for protocol adherence.

The default assembly hooks are null which means the originally intended operators will carry on.
Example usages can be found in the extensions project. With just and filter, you could do such things:
RxJavaPlugins.setOnObservableAssembly(o -> {
    if (o instanceof ObservableFromArray) {
        return new ObservableFromArray<>(new Integer[] { 4, 5, 6 });
    }
    return o;
});

Observable.just(1, 2, 3)
.filter(v -> v > 3)
.test()
.assertResult(4, 5, 6);

RxJavaPlugins.setOnObservableAssembly(null);


text:
Q: EF7 reverse engineering tool does not generate POCOs as partials Entity Framework 7 reverse engineering tool does not generate the POCOs as partials. Is there a specific reason for that?
Before EF7 we used to get partial classes so I could extend the functionality of POCOs. I was using partial classes to map the Id property to the Primary key property as shown below;
public partial class User: EntityBase
{
    public override int Id
    {
        get { return UserId; }
        set { UserId= value; }
    }
}

How can I do that in EF7?
Thank you.

A: dnx ef dbcontext scaffold-templates  EntityFramework.SqlServer
scaffold-templates command can be used to generate the EntityFramework.SqlServer.Design.DbContextTemplate.cshtml and EntityFramework.SqlServer.Design.EntityTypeTemplate.cshtml template files in the project directory to be used during scaffolding.
EntityTypeTemplate customization example to add partial class support:
....
....
@:namespace @Model.Namespace
@:{
@:    public partial class @Model.EntityType.Name
@:    {...
....
....
....

A: It was just an oversight. An Entity Framework bug was raised on this (see https://github.com/aspnet/EntityFramework/issues/3428). It was fixed today (Oct 16, 2015) - and will be in tonight's nightly build.
As a workaround the scaffold-templates approach mentioned above should work for now.
Or you are also free to just manually search and replace to add the word partial into any POCO class once it has been generated (though it would get overwritten every time you generated them again).

A: I am using 6.1.3 and models are generated as partials.


text:
Q: Check if there are any string values in whole dataframe I am trying to apply Zscore function on my dataframe like this:
x_columns = df.columns.drop('Label')
for col in x_columns:
    df[col] = zscore(df[col])

and i had got this error:
TypeError: unsupported operand type(s) for +: 'float' and 'str'

I understand that there are string values in my dataframe Although i made the data cleaning on all columns
Is there an easy way to check if there are any string values and where they are located in my dataframe???


text:
Q: formatted sql query doesn't work in python my code is:
engine = sqlalchemy.create_engine("credentials")
connection = engine.connect()

day = 180601
query = "select * from Data where Name like '%{0}%'".format(str(day))
df = pd.DataFrame(connection.execute(query).fetchall())

but this doesn't work. when i type:
query =  "select * from Data where Name like '%180601%'"

then repeat the same process, this works fine although they produce same queries. i want to change the days in a for loop.
Any ideas would be appreciated. Thanks in advance!

A: I discovered there is no problem with the python itself. The problem is sql cannot get top 100 of the rows without order by clause. I think this is another bug but adding "order by col1" at the end of query solved the problem.
Thanks for your time.


text:
Q: Can you setup access to NetezzaSQL servers for Jenkins to automate a job virtually? We are trying to get all of our scripts to run in cloud through Jenkins, however Jenkins seems to have an issue with connecting\identifying the ODBC connections for NetezzaSQL. We have setup a VM where we dump our files in a bitbucket repository and then reference in Jenkins Jobs.
I've done research to see if Jenkins supports NetezzaSQL, or if it even can update on cloud with no conclusive evidence.
Our general connection code is
conn_string = "DRIVER={NetezzaSQL};SERVER=NDWNetezzaProd;DATABASE=%s;UID=%s;PWD=%s" % (database, user, Password)
conn = pyodbc.connect(conn_string, AutoCommit=False)

And here I believe that Jenkins should identify the credentials and still run the update?
The error I get is as folows:

pyodbc.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver
  Manager] Data source name not found and no default driver specified
  (0) (SQLDriverConnect)')