text:
Q: Why can't Tomcat and Spring see my jsp file? I started learning Spring MVC.I connected all required dependencies with maven and downloaded Tomcat.But when i run Tomcat my jsp file is not opening. What the problem? Annotations seem to be correct
My applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<context:component-scan base-package="com.ildar" />
<mvc:annotation-driven/>

<bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/WEB-INF/view/" />
    <property name="suffix" value=".jsp" />
</bean>

Web.xml:
  <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         id="WebApp_ID" version="3.1">
    <display-name>spring-cource-mvc</display-name>
     <absolute-ordering />
  <servlet>

    <servlet>
    <servlet-name>dispatcher</servlet-name>
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/applicationContext.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

     <servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

</web-app>

Controller class:
      @Controller
public class MyController {
    @RequestMapping("/")
    public String showMyView(){
        return "first-view";
    }
}

And when I run Tomcat , i just see eror 404 not found in browser


text:
Q: Getting every table data content inside table i'm having some problem with getting my td-content. Some cells contain "-"
and if they, they should have text-align: center.
having some problem with my jquery code especially the if statement, i'm getting always false. need some help!
jquery code:
$(document).ready(function(){
  $('#listTable tr td').each(function(){
    var cellText = $(this).text();
    if(cellText == "-") {
        $(this).addClass('textCenter');
    }
  });
});

A: HTML: A basic table with various content - one of which contains the char "-" in the cell.

One	Two	Three

One A	Two-B	Three C

One D	Two E	Three F

CSS: As you likely have already, a simple class
.textCenter { text-align: center; }

JavaScript: If your requirements are as simple as described, then this will select all of the  elements that contain the char "-" within.
$('td:contains("-")').addClass('textCenter');

jsFiddle example: https://jsfiddle.net/likestothink/42xqg5bj/

A: You can use .includes on a string like so:
if (cellText.includes("-")) {
    $(this).addClass('textCenter');
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: coloring a 3D scatterplot I have a function to plot 3D scatter plots, it works fine but I don't see how I can give a color to specific data points based on a condition for example:
in The following code I am plotting 3 features; nbActionsD30, avgActionsMonth and actionSHR.
I want to give a specific color to the data points where actionsSHR value >= 50
the parameters of the function are f1, f2, f3 the feature names. data is the dataframe
that contains the features.
here is my function's code :
def plot3D(f1, f2, f3, data):

%matplotlib widget
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

xs = data[f1]
ys = data[f2]
zs = data[f3]

fig = plt.figure()
ax = Axes3D(fig)

plot = ax.scatter(xs, ys, zs, s=50, color = 'blue', edgecolors = "white")
ax.set_xlabel(f1)
ax.set_ylabel(f2)
ax.set_zlabel(f3)
plt.show()

plot3D("avgActionsMonth", "nbActionsD30", "actionSHR", data)

A: import matplotlib.pyplot as plt
import numpy as np

fig, ax = plt.subplots(subplot_kw=dict(projection="3d"))
x, y, z = np.random.normal(size=(3, 1000))
ax.scatter(x, y, z, c=z>1)
plt.show()

gives


text:
Q: How Exactly Updating Play Apps Occur The Question is how exactly google play updates apps.
I mean does it remove older app exactly from files or it just append on it .
For example in my app i have a local database ,after update, will my older local database become removed?

A: Your old application is definitely deleted. Your app is compiled and packaged, it won't be opened by Google.
As far your database, if you made changes to your database you need to change the "database version" before publishing. And put code inside the onUpgrade() method of your SQL database. This is how you can successfully change your database. If you want to delete the old database, you can delete it inside the method. The database is on the user's device, and will stay there forever until they delete your app or your code deletes it.
I hope I'm understanding your question.


text:
Q: Theme Installation I downloaded a free theme Ves Fasony.
I copied and pasted the file in this directory app/design/frontend/
But in the theme that I downloaded, there is a code folder and is no code folder under app folder in magento 2.1.3
Where should I put it? Am I installing it in a wrong way?

A: To install the theme in magento 2 manually you must need to know about directory structure of magento2.

*

*like for design you need to put files in app/design folder

*like for modules you need to put files in app/code folder

*also for sql file you need to import that sql file in your database

*For images you need to put your images file in pub/media folder

So here if code folder is not there you need to create it .
For more reference how to install theme manually follow this link - https://stackoverflow.com/questions/39995942/installing-magento2-theme

A: You have to create it. So it will look like:
App/code/Ves/Setup/

App/design/frontend/Venustheme/fasony/


text:
Q: как добработать DateAdapter для jaxb парсинга дат? Как преобразовать входную дату 2019-03-04T18:55:05.591+03:00 в timestamp для сохранения в базу oracle?
Я использую simpleDateFormat чтобы распарсить дату  2019-03-04T18:55:05.591+03:00 и получить Date.
public class DateAdapter extends XmlAdapter<String, Date> {
    private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");

    @Override
    public String marshal(Date v) throws Exception {
        synchronized (dateFormat) {
            return dateFormat.format(v);
        }
    }

    @Override
    public Date unmarshal(String v) throws Exception {
        synchronized (dateFormat) {
            return dateFormat.parse(v);
        }
    }
}

Но, есть случай когда присылают дату без указания милисекунд и я получаю ошибку парсинга.  2019-03-04T18:55:05+03:00
Как этого можно избежать?

A: public class DateAdapter extends XmlAdapter<String, Date> {

    private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");

    @Override
    public String marshal(Date v) throws Exception {
        synchronized (dateFormat) {
            return dateFormat.format(v);
        }
    }

    @Override
    public Date unmarshal(String v) {
        return Date.from(java.time.ZonedDateTime.parse(v).toInstant());
    }
}

Я бы предложил такое решение. На мой взгляд это проще, чем указывать 2 формата...

A: Как дополнительный вариант решения, это написать утилитарный метод, который будет подбирать нужный шаблон:
 private static final List<SimpleDateFormat> dateFormats = Arrays.asList(
            new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"),
            new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX")
    );

public static Date parseToDate(String input) {
        if (input != null) {
            for (SimpleDateFormat dateFormat : dateFormats) {
                try {
                    return dateFormat.parse(input);
                } catch (ParseException e) {
                }
            }
        }
        return null;
    }

 public static Timestamp parseToTimestamp(String input) {
    if (input != null) {
        for (SimpleDateFormat dateFormat : dateFormats) {
            try {
                Date date = dateFormat.parse(input);
                return new Timestamp(date.getTime());
            } catch (ParseException e) {
            }
        }
    }
    return null;
}


text:
Q: Is $1\neq a\in Z(\Omega_6^{+}(5))\cong C_2$ a square element in $\Omega_6^{+}(5)$? Is $1\neq a\in Z(\Omega_6^{+}(5))\cong C_2$ a square element in $\Omega_6^{+}(5)$?
In other words, I wonder if there is an element $x\in S$ such that $x^2=a$ and forthermore $x\in \Omega_6^+(5)$, where $S$ is a Sylow 2-subgroup of the orthogonal group ${\rm GO}_6^+(5)$?
A. The following notations and consequces are followed from page 78 of 'Classical groups and geometric algebra' by Larry C. Grove.

*

*Let us sketch an alternative approach to $\theta|_{SO(V)}$. Define the Clifford group $\Gamma=\Gamma(V)$ to be the normalizer in the group $U(C)$ of units in $C$ of the subspace $V$ of $C$, i.e.
$$\Gamma=\{x\in U(C): xvx^{-1}\in V, {\rm all}~\in V\}.$$
Define the even Clifford group to be $\Gamma_0=\Gamma\cap C_0$. If $x\in V$ is nonzero and anisotropic, and $v\in V$, then $xvx^{-1}=-\sigma_xv\in V$ by Proposition 8.3, so $O(V)\leq \Gamma$. It follows easily that $SO(V)\leq \Gamma_0$.

*If $x\in \Gamma$ and $v\in V$ define $\chi_x(v)=xvx^{-1}\in V$. Then
$$Q(\chi_xv)=Q(xvx^{-1})=(xvx^{-1})^2=xv^2x^{-1}=xQ(v)x^{-1}=Q(v),$$
so $\chi(x)\in O(V)$. In fact $\chi$ is a homomorphism from $\Gamma$ into $O(V)$, called the vector representation of $\Gamma$. It can be shown that $\chi$ maps $\Gamma_0$ onto $SO(V)$, with ${\rm Ker}(\chi|{\Gamma_0})=F^\ast$.

*If $\alpha$ is the unique anti-automorphism of $C$ with $\alpha_V=1_V$ discussed in Proposition 8.15, then we may define a homomorphism $N: \Gamma_0\rightarrow F^{\ast}$ via $N(x)=\alpha(x)x$. The kernel of $N$ is called the spin group ${\rm Spin}(V)$. Then $\chi({\rm Spin}(V))=\mho(V)$, the reduced orthogonal group. If $\sigma\in SO(V)$, then there exists $x\in \Gamma_0$ with $\chi(x)=\sigma$, and then $\theta(\sigma)=N(x)F^{\ast 2}$ gives the spinor norm of $\sigma$.
The following consequence follows form page 241 of 'Basic algebra II' by Nathan Jacobson.

*Theorem 4.16. Let $Q$ be of positive Witt index. Then the reduced orthogonal group $O'(V,Q)$ coincides with the commutator subgroup $\Omega$ of $O(V,Q)$ and $$O^+(V,Q)/{O'(V,Q)}\cong F^{\ast}/{F^{\ast 2}}.$$
The following consequence follows from page 392 of 'Basic algebra I' by Nathan Jacobson.

*In the case of a finite field the Witt index is always positive if $n\geq 3$.

The following notation follows form page 359 of 'Basic algebra I' by Nathan Jacobson.

*If $B$ is a non-degenerate symmetric bilinear form, then $B$ is called isotropic or a null form if there exists a vector $u\neq 0$ such that $B(u,u)=0$. Such a vector is called isotropic.

The following is Proposition 8.15 (page 73) of 'Classical groups and geometric algebra' by Larry C. Grove.

*Proposition 8.15. If $V$ is a quadratic space there is a unique anti-automorphism $\alpha: C(V)\rightarrow C(V)$ with $\alpha_V=1_V$.

B. Firstly, we suppose that $n=2m$ and $q^m\equiv 1~(\rm mod~4)$, then the following are some quoted and inferred results:

*

*${\rm GO}_{2m}^+(q)=\{T^tA_1T=A_1, T\in {\rm GL}(2m,q)\}$, where $A_1=\left(
                                                             \begin{array}{cc}
                                                               0 & I_m \\
                                                               I_m & 0 \\
                                                             \end{array}
                                                           \right)
$.

*Let $S$ be a Sylow $2$-subgroup of ${\rm GO}_{2m}^{+}(q)$, then $S$ is isomorphic to a Sylow $2$-subgroup of ${\rm GO}_{2m+1}^{+}(q)$ by page 147 of 'The sylow 2-subgroups of the finite classical groups' of Roger Carter and Paul Fong.

*Let $S$ be a Sylow $2$-subgroup of ${GO}_{2m+1}^{+}(q)$ and let
$$2m=2^{r_1}+2^{r_2}+...+2^{r_t},~~~r_1<r_2<...<r_t.$$
Then $S\cong W_{r_1}\times W_{r_2}\times ... \times W_{r_t}$, where $W_r$ is a Sylow $2$-subgroup of ${\rm GO}_{2^r+1}^{+}(q)$ by page 146 of 'The sylow 2-subgroups of the finite classical groups' of Roger Carter and Paul Fong.

*Let $W$ be a Sylow 2-subgroup of ${\rm GO}_3^+(q)$, $W_r=W\wr T_{r-1}$. Then $W_r$ is a Sylow $2$-subgroup of ${\rm GO}_{2^r+1}^+(q)$, where $T_{r-1}=C_2\wr C_2\wr ... \wr C_2$ is the wreath product of $C_2$ $r-1$ times by page 146 of 'The sylow 2-subgroups of the finite classical groups' of Roger Carter and Paul Fong.

*The orthogonal group ${\rm GO}_2^{+}(q)$ is a dihedral group of order $2(q-1)$ by page 146 of 'The sylow 2-subgroups of the finite classical groups' of Roger Carter and Paul Fong.

*${\rm P\Omega}_6^+(q)\cong {\rm PSL}_4(q)$ by page 96 of 'the finite simple groups' of Robert A. Wilson.

*$\Omega_n^+(q)$ has a centre of order 2 by page 80 of 'the finite simple groups' of Robert A. Wilson.

*When $n=2m$ is even and $\epsilon=+$, then $|{\rm P\Omega}_n^+(q)|=N/d,$ where $$N=q^{m(m-1)}(q^m-1)(q^{2m-2}-1)(q^{2m-4}-1)...(q^2-1)$$
and $d=(4,q^m-1)$. Therefore $|{\rm P\Omega}_6^+(5)|=2^7\cdot 3^2\cdot 5^6\cdot 13\cdot 31$.
Then in particular, for $\Omega_6^{+}(5)$, we have $S\cong W_1\times W_2=(W\wr T_{1-1})\times (W\wr T_{2-1})=W\times (W\wr C_2)=D_4\times (D_4\wr C_2),$ where $W\cong D_4$ is a Sylow 2-subgroup of ${\rm GO}_3^+(5)$ or ${\rm GO}_2^{+}(5)$.
Therefore $Z(S)\cong C_2\times C_2$. Hence there is an element $a\in S$ such that $a^2=-1$, Now however is $a\in \Omega_6^+(5)$?
Analysis. If $a\in \Omega_6^+(5)$,
In general, for ${\rm GO}_{2m}^+(q)$, we have
$S\cong W_{r_1}\times ...\times W_{r_t}=(W\wr T_{r_1-1})\times ...\times (W\wr T_{r_t-1})=[D_{q-1}\wr (C_2\wr C_2\wr ...\wr C_2)_{r_1-1}]\times ...\times [D_{q-1}\wr (C_2\wr C_2\wr ...\wr C_2)_{r_t-1}],$
where $W=D_{q-1}$ is a Sylow $2$-subgroup of ${\rm GO}_2^+(q)$ or ${\rm GO}_3^+(q)$ and
$$W_{r_i}=W\wr T_{r_i-1}=[D_{q-1}\wr (C_2\wr C_2\wr ...\wr C_2)_{r_i-1}]$$
is a Sylow $2$-subgroup of ${\rm GO}_{2^{r_i}}^{+}(q)$ or ${\rm GO}_{2^{r_i}+1}^{+}(q)$.


text:
Q: Spring WebFlow can I understand the previous state I have a simple Spring WebFlow, which has a couple of states.
Is it possible when you reach a certain state to know which one was the previous one?
I need this because I want to detect when the user refresh the page, so in this case my previous state will be the same as my current state.

A: you could set a variable like this:
<var name="comingFrom" class="java.lang.String"/>

<on-start>
    <set name="comingFrom" value="''"/>
<on-start>

<state id="state1">
    <transition on="transition1" to="current">
        <set name="comingFrom" value="'state1'"/>
    </transition>
</state>

<state id="current">
    /* do what you want in your state with "comingFrom" */
    <transition on="transistion2">
        <set name="comingFrom" value="'current'"/>
    </transition>
</state>

but that requires you set this variable on every transition that goes to your "current" state.
[Edit] Example of decision-state:
<decision-state id="decisionState">
    <if test="comginFrom != 'current'" then="state1" else="state2"/>
</decision-state>


text:
Q: Replacement of QueryString web part in SharePoint Modern UI Is there any replacement of QueryString Web Parts in Modern UI? SPFx is the last option.

A: It seems that there is not a OOTB client web part to replacement of QueryString Web Parts in Modern UI, we have to create a custom SPFx web part to achieve it.
The following articles for your reference.
SPFX obtaining the URL Query Parameters
SharePoint Framework Client-Side Web Part Samples & Tutorial Materials


text:
Q: simple_html_dom.php I am using "simple_html_dom.php" to scrap the data from the Wikipedia site. If I run the code in scraperwiki.com it's throwing an error as exit status 139  and if run the same code in my xampp sever, the server is hanging.

*

*I have a set of links

*I'm trying to get Literacy value from all the sites

*If I run the code with one link there is no problem and it's returning the expected result

*If I try to get data from all the sites in one go I'm facing the above problem

The code is:
<?php
  $test=array
  (
   0 => "http://en.wikipedia.org/wiki/Andhra_Pradesh",
   1 => "http://en.wikipedia.org/wiki/Arunachal_Pradesh",
   2 => "http://en.wikipedia.org/wiki/Assam",
   3 => "http://en.wikipedia.org/wiki/Bihar",
   4 => "http://en.wikipedia.org/wiki/Chhattisgarh",
   5 => "http://en.wikipedia.org/wiki/Goa",

   for($ix=0;$ix<=9;$ix++){

     $content = file_get_html($test[$ix]);
     $tables = $content ->find('#mw-content-text table',0);
     foreach ($tables ->children() as $child1) {
        foreach($child1->find('th a') as $ele){
        if($ele->innertext=="Literacy"){
                foreach($child1->find('td') as $ele1){
                   echo $ele1->innertext;
   }}}  }}

Guide me where am wrong. Is there any memory problem??? Is there any xampp configuration???

A: <?php
  require 'simple_html_dom.php';
  $test = array(
   0 => "http://en.wikipedia.org/wiki/Andhra_Pradesh",
   1 => "http://en.wikipedia.org/wiki/Arunachal_Pradesh",
   2 => "http://en.wikipedia.org/wiki/Assam",
   3 => "http://en.wikipedia.org/wiki/Bihar",
   4 => "http://en.wikipedia.org/wiki/Chhattisgarh",
   5 => "http://en.wikipedia.org/wiki/Goa");

  for($ix=0;$ix<=count($test);$ix++){
    $content = file_get_html($test[$ix]);
    $tables = $content ->find('#mw-content-text table',0);
    foreach ($tables ->children() as $child1) {
      foreach($child1->find('th a') as $ele){
        if($ele->innertext=="Literacy"){
          foreach($child1->find('td') as $ele1){
            echo $ele1->innertext;
          }
        }
      }
    }
    $content->clear();
  }
?>

but these URLs are too much. You may get a fatal error of max execution time execeeded or you may get error 324.


text:
Q: Why JS code doesn't work when we use variable as an object key, and then use destructuring (without alias) to get value of this object key? Imagine this scenario where I keep my field name in a variable like this -
const NAME_FIELD = 'name';

Then, I go ahead and use this inside an object like this -
let state = {
  [NAME_FIELD]: 'ashwani'
}
console.log(state) // Output - { name: "ashwani" }

All good till now. Now, later in my code, I want to get value of this same key. Ofcourse the easy way out is to simply use something like state[NAME_FIELD]. I am using destructuring though.
With destructuring, this works -
const { [NAME_FIELD]: x } = state;
console.log(x) // Output - ashwani

But, my first attempt to this was like this -
const { name } = state; // This works as expected
const { [NAME_FIELD] } = state; // I was expecting this to work too, but it didn't

I expected the above code const { [NAME_FIELD] } = state; to work but it didn't while the other ones worked. Will be really great if someone can help me understand that :)
I know that JS throws a parse error when I say const { [NAME_FIELD] } = state;. With my question, I am trying to understand why ECMAScript team would have made this decision and what is it I am missing in my understanding. In the later comments, some of SO members have provided certain useful views on this.

A: One of the issues with the syntax of:
const { [NAME_FIELD] } = state;

... is that it assumes that the value held in NAME_FIELD is a valid identifier which is not always the case. In the case of NAME_FIELD = "name", name is a valid identifier, so it's easy to assume that NAME_FIELD can be made into a valid variable, however, this is not always the case. Consider if you had:
const NAME_FIELD = "my-key";
const { [NAME_FIELD] } = state; // which would be interpreted as { my-key }

this wouldn't work as it would mean creating a variable with a hyphen -, which isn't valid. Similar issues occur with other valid object keys that aren't considered valid identifiers, such as "123", "my key", and symbols.
As a result, an alias needs to be used to assign the destructured value to a valid identifier.

A:
const { [NAME_FIELD] } = state;
console.log(x) // I was expecting it to print my name, but it didn't

this doesn't work because why would javascript log the name when you try to log the value of a variable that's not defined

const { [NAME_FIELD]: x } = state;
console.log(x) // Output - ashwani

this works because when you use : x you're asking javascript to rename the destructured prop to 'x'
Edit:

const { [NAME_FIELD] } = state;
// I was expecting the above code to work too, but it didn't

this won't work because it is invalid syntax, and what variable would javascript use in this case as you're destructuring using a dynamic key?

A: The reason behind avoiding this functionality is because it would bring in dynamically named variables into a blocked scope. Which is extremely dangerous. It has been removed from ES5 strict mode.
Javascript MDN suggests not to use dynamic eval. You may end up running malicious code.
You can refer to @Ginden's answer here.


text:
Q: im having a problem with this everytime i run my code.. heres my code class DB
    {
      private  MySqlConnection connection = new MySqlConnection("server=localhost;port:3306;username=root;password=;database=users_db");
        public void openConnection()
        {
            if (connection.State == System.Data.ConnectionState.Closed)
            {
                connection.Open();
            }
        }
        public void closeConnection()
        {
            if (connection.State == System.Data.ConnectionState.Open)
            {
                connection.Close();
            }
        }
        public MySqlConnection getConnection()
        {
            return getConnection();
        }
    }
}

it succesfully run but after the login process.. theres an exception

*

*System.ArgumentException: 'Keyword not supported.
Parameter name: port:3306;username'

A: The problem is in the ":" in the "port" parameter, you must specify the parameter by "=" like in this example:
"Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"

Do you have tons off examples in this page,

A: now i am getting this problem in
public MySqlConnection getConnection()
        {
            return getConnection();
        }

System.StackOverflowException: 'Exception of type 'System.StackOverflowException' was thrown.'


text:
Q: index was out of range in vb .net while executing crystal report I have a vb.net code like this: i am working on vb.net windows form, am trying to execute crystal report that included 3 subreports..i given my code like this:
Dim locid As Integer = RecordID("Locid", "Location_tbl", "LocName", CmbLocations.Text)
        Dim ptime As Integer = TxtTime.Text
        'ViolatedRequested
        Dim cmd23 As New SqlCommand("IBS_Delivarysummaryviolatedrequested", con.connect)
        cmd23.CommandType = CommandType.StoredProcedure
        cmd23.Parameters.Add("@locid", SqlDbType.Int).Value = locid
        cmd23.Parameters.Add("@time", SqlDbType.Int).Value = ptime
        da.SelectCommand = cmd23
        da.Fill(ds)
        Dim rpt As New DelivarySummerystatuswiserpt
        ' If (ds.Tables(0).Rows.Count > 0) Then

        rpt.SetDataSource(ds.Tables(0))
        ' CrystalReportViewer1.ReportSource = rpt
        '  End If
        'requested
        Dim cmdreqstd As New SqlCommand("IBS_Delivarysummaryrequested", con.connect)
        cmdreqstd.CommandType = CommandType.StoredProcedure
        cmdreqstd.Parameters.Add("@locid", SqlDbType.Int).Value = locid
        cmdreqstd.Parameters.Add("@time", SqlDbType.Int).Value = ptime
        da.SelectCommand = cmdreqstd
        da.Fill(ds1)
        rpt.Subreports(1).SetDataSource(ds1.Tables(0))
        ' CrystalReportViewer1.ReportSource = rpt

        ''  Parked
        Dim cmdparked As New SqlCommand("IBS_Delivarysummaryparked", con.connect)
        cmdparked.CommandType = CommandType.StoredProcedure
        cmdparked.Parameters.Add("@locid", SqlDbType.Int).Value = locid
        da.SelectCommand = cmdparked
        da.Fill(ds2)
        rpt.Subreports(2).SetDataSource(ds2.Tables(0))
        ' CrystalReportViewer1.ReportSource = rpt

        'violated Detaild
        Dim cmdvolatedDetaild As New SqlCommand("IBS_DelivarysummaryviolateDetaild", con.connect)
        cmdvolatedDetaild.CommandType = CommandType.StoredProcedure
        cmdvolatedDetaild.Parameters.Add("@locid", SqlDbType.Int).Value = locid
        cmdvolatedDetaild.Parameters.Add("@time", SqlDbType.Int).Value = ptime
        da.SelectCommand = cmdvolatedDetaild
        da.Fill(ds3)
        If (ds3.Tables(0).Rows.Count > 0) Then
            rpt.Subreports(3).SetDataSource(ds3.Tables(0))
            CrystalReportViewer1.ReportSource = rpt
        End If

while executing i am getting error in  this line  rpt.Subreports(3).SetDataSource(ds3.Tables(0))
getting error like this:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
what is wrong with my code,,if any know please help me to find out

A: If you say that you have 3 subreports, then your subreport indexes are 0,1, and 2. So there is no index 3 and that's why you are getting the error. It should be
rpt.Subreports(0)
rpt.Subreports(1)
rpt.Subreports(2)


text:
Q: Android Eclipse Multiple Dex Files Error I have been getting this error when trying to launch my android project, it didn't happen before, and started to happen randomly.  I didn't even update anything between when it was working and now.  The error is:
[2013-01-24 18:06:28 - Dex Loader] Unable to execute dex: Multiple dex files define Lorg/opendatakit/sensors/AbstractSensorDriverDiscovery;
[2013-01-24 18:06:28 - opendatakit.sensors] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/opendatakit/sensors/AbstractSensorDriverDiscovery;

I know people have experienced this problem before, but most of the issues I have seen were from over a year ago, typically dealing with ADT r14.  I am using Eclipse 4.3.0 with ADT r17.  I have not seen anyone dealing with these problems with these versions.  Has this been solved by anyone?
The other solutions I have seen, in posts like Unable to execute dex: Multiple dex files define Lcom/myapp/R$array;, have not been of any use to me.
If anyone has any advice on the subject I would greatly appreciate it.

A: I ended up finding the error to this problem after much heartache.  For some reason, a global folder had been included in my project and was being built into my project each time.  This folder contained the same jar that I had in my libs folder and that was causing a conflict.
If anyone else has this problem, ensure you only have one jar file in the project.


text:
Q: When is Inline CSS executed? When exactly is inline CSS like this applied?

A new background and
 font color with inline CSS

onDomReady, onDomLoaded, instantly...?

A: It's before onDomReady or onDomLoaded.  Those style attributes will be set on the DOM node as the element is parsed, along with all of the other inline attributes.  If you were to inspect the element in JavaScript in the very next line (w/out waiting for a load/ready event), you would see that the style properties are already set.

Edit: here's a quick jsfiddle demonstrating the immediate application of the style properties: http://jsfiddle.net/QZbMv/

A: It's applied as soon as the DOM element is created, before both DomReady and DomLoaded.
See http://jsfiddle.net/HZXXp/

A: When DOM parse your HTML file.It first parse your element then parse inline css. I think all browser follow this technique.


text:
Q: Terminate a python script using an exit code, but does not exit and gives an error code instead Here is my code for the exit statement
            if "shutdown" in query:
            speak("Ok, See you")
            sys.exit(0)

These are the modules I have:
    from googlesearch import search
    import pyttsx3
    import datetime
    import wikipedia
    import pywhatkit
    import webbrowser
    import speech_recognition
    import requests
    from bs4 import BeautifulSoup
    import sys

When I execute the command, I get this error code
    Exception ignored on calling ctypes callback function: <function catch_errors.<locals>.call_with_this at 0x0000020FBDAE5C60>
Traceback (most recent call last):
  File "C:\Users\adith.LAPTOP-K9TNBR9N\AppData\Local\Programs\Python\Python310\lib\site-packages\comtypes\_comobject.py", line 97, in call_with_this
  File "C:\Users\adith.LAPTOP-K9TNBR9N\AppData\Local\Programs\Python\Python310\lib\logging\__init__.py", line 1505, in error
  File "C:\Users\adith.LAPTOP-K9TNBR9N\AppData\Local\Programs\Python\Python310\lib\logging\__init__.py", line 1734, in isEnabledFor
TypeError: 'NoneType' object is not callable

Process finished with exit code 1

Please let me know if you need any more information.
I have tried doing exit() sys.exit() os.exit(). Nothing worked, I keep getting the same error codes no matter what I try.

A: You will have to find a different way to do this.  Your callback is being called from C++ code.  That code is trapping all exceptions, because the C++ code doesn't know how to pass through exceptions.  sys.exit(0) works by raising an exception.  The C++ code traps and ignore that exception, but sys.exit has already begun a shutdown, so when your code gets back to the logging module, stuff isn't there.
You'll need to set a flag in your callback that other code in your app checks, and do the shutdown that way.
Followup
So, you have everything in a big while True loop.  You just need a flag:
    running = True
    while Running:

Then
            elif "shutdown" in query:
                speak("Ok, See you")
                running = False

HOWEVER, the fact that you have two nested while loops makes that more complicated.  I don't understand why you have the nested loops instead of one big loop, and I suggest you rewrite it to have one loop instead.


text:
Q: How to specify MX RR using djbdns? I want one of the domains I manage to have null MX records: i.e., MX RR.
I'm trying to figure out how to specify MX RR under djbdns, but my searches haven't yielded any information about how to do this.
I did the following for the moment, but I know this isn't the proper way to null out MX records ...
@example.com:127.0.0.1:a:0
@example.com:127.0.0.1:b:0

... and I'm pretty sure that the following is just as undesirable ...
@example.com:localhost:a:0
@example.com:localhost:b:0

Is there a djbdns-based syntax for creating MX RR records?
Thank you in advance for any suggessions.

A: Per the patience and valuable help from @Nikita-Kipriyanov (see the comments below my original Question), I now see that the following is the answer to my question:
@example.com:127.0.0.1:.:0

It generates this ...
example.com 86400 IN MX 0 .

... which is indeed a suitable Null MX record.
I also tried this ...
@example.com::.:

... and it also generates the same MX record.
I prefer this second one, because it doesn't deal with any spurious references to 127.0.0.1, and also, that syntax sort of appears to reference something that might be "Null" in some way, due to the absence of anything except that one dot. It will therefore be clearer to anyone examining my djbdns domain definitions that this is indeed probably a "Null MX" specification.


text:
Q: I can't create global variables in a class Python This is the code:
class command:
    OutF = str()
    def Out(outputRange: int, ArgsFormat: list):
        global OutF
        ArgsFormat[0] = None;
        for i in range(outputRange):
            OutF += " " + ArgsFormat[i]

list = ["zero", "one", "two", "three", "thisisjustexampleforwhathappend"]
command.Out(list.__len__(), list)
print(command.OutF)

And somehow when I'm trying to run the code it's saying:
NameError: name 'OutF' is not defined

Does someone know how to fix this?


text:
Q: Dynamically change column type when binding I have a DataGridView bound to one of my Binding Adapters. There's a column in my grid that corresponds to a "type" of an attachment (i.e ".pdf"). This is being displayed in the grid view column as text (as expected). I want to be able to change the value of the column to be an image to signify the type. For example, if the type is a PDF, I want there to be an image of a PDF document in the column rather than the text ".pdf".
Is there a way I can do this dynamically as the cells are added? Or would like have to be something that's done after all the cells are loaded?
Cheers.

A: Yes, just use an image and have a few icons with corresponding names.
E.g. pdf.png, word.png
Then build the link like this:
<img src="<%# LinkRoot + Eval("type").ToString() + ".png" %>" height="32" width="32" />

A: You have to draw the images on the column type yourself, of course the drawn image is corresponding to the text (describing file type, e.g: .pdf,.txt,...). You have to prepare all the images yourself, if there is not any corresponding image to an unknown file type, you can use a Unknown file type image. To draw an image on a cell, you have to handle the event CellPainting, here is the code you can try:
//Dictionary to store the pairs of `text` and the corresponding image
Dictionary<string, Image> dict = new Dictionary<string, Image>(StringComparer.CurrentCultureIgnoreCase);
//load data for your dict
dict["Unknown"] = yourUnknownImage;//This should always be added
dict[".pdf"] = yourPdfImage;
dict[".txt"] = yourTxtImage;
//.....
//CellPainting event handler for your dataGridView1
//Suppose the column at index 1 is the type column.
private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e){
   if(e.ColumnIndex == 1 && e.RowIndex > -1){
     var image = dict["Unknown"];
     if(e.Value != null) {
        Image img;
        if(dict.TryGetValue(e.Value.ToString(), out img)) image = img;
     }
     //Draw the image
     e.Graphics.DrawImage(image, new Rectangle(2,2, e.Bounds.Height-4, e.Bounds.Height-4));
   }
}


text:
Q: Unsetting an exported environment variable I am using export to set an environment variable.
export OPCON_VERBOS=${vb}

How can I then unset it later so that it stops being define anymore?

A: unset OPCON_VERBOS

or
OPCON_VERBOS=

or
OPCON_VERBOS=""

The unset removes the environment variable (and its value).  The others keep the environment variable, but set its value to the empty string, which in many use cases has the same result as removing the value.


text:
Q: Google Auth signIn is not working in webview android Help me if anyone passes from this situation.
I added all settings and user-agent strings too in my code. then how when I click on google sign the email and password screen will open but on successful the loaded will load infinite way. no other actions will be done.
here are some logs I can see in debug mode
chromium: [INFO: CONSOLE(276)] "Your client application uses libraries for user authentication or authorization that will soon be deprecated. See the Migration Guide for more information.", source: https://apis.google.com/_/scs/abc-static/_/js/k=gapi.lb.en.dzXZWX9QTbE.O/m=auth2/rt=j/sv=1/d=1/ed=1/rs=AHpOoo_epIQDPHdjFr3MLkazUi2Jmy50dQ/cb=gapi.loaded_0?le=scs (276)
I/chromium: [INFO:CONSOLE(0)] "Unrecognized Content-Security-Policy directive 'require-trusted-types-for'.", source: https://accounts.google.com/o/oauth2/iframe#origin=https%3A%2F%2Fwww.lidl.com&rpcToken=712640055.3159221 (0)


text:
Q: How to use salt-stack send files from VM datastore to a minion in that datastore I use salt-stack & vSphere Web to manage a vCenter server. There many virtual machines run in this, so I use one vm as salt-master.
There are some files in the vCenter's datastore. And I want to send these files to a minion.
Image of files
I have tried different ways many times. For example, I tried changing the datastore in cloud.profiles.d/.conf. Nothing has worked so far.
It's almost like I can't use salt to control datastore any more.

A: I tried using the mount.mounted. Nothing has worked so far.
So, I use the " virtual hard " on vSphere Web Client instead of it. It works.


text:
Q: Determine TLS certificate details with Microsoft Edge I purchased a new ASUS Q302 laptop from Best Buys for testing some software under the Intel Broadwell architecture (6th Gen i7). It looks like the machine has one of those Proxy/Interception certificates pre-installed. The machine does not appear to have anti-virus software installed, and I did not install any software.
I did not agree to be proxied or intercepted, so I'm not sure what package is doing it. I'm attempting to determine what software package owns it, but I can't get Microsoft Edge to give me the details on the certificate or the fake CA (below, I clicked on the red shield).

Edge also appears to lack other useful setting provided by Explorer, like a way to manage startup, a ways to reset the browser, and a way to manage browser helper object (BHO).
How, exactly, do I get the new-and-improved Internet Explorer to give me the basic information it used to provide?

Mozilla

Google

A: There currently isn't a way to view the certificate information from within Microsoft Edge.  You can use Internet Explorer 11 to view the information though.
Alex Mia, a Microsoft Contingent Staff, on September 09, 2015 9:05 AM said the following:

Hi,
So far, there is no way to view the certificates in the Microsoft Edge
  browser.

Source

A: The answer from Ramhound is accurate. The path to view de Certificate details in newer IE (11) as for Win10 is right-clicking anyplace on the SSL secured page, then >> properties >> certificates >> view certificate; there you go; As for today Microsoft really confirms there isn´t so far a method to do so in Edge;
If in Google-Chrome(v.60.x), click the 3 vertical diposed icon on the top-right > more tools > developer tools > and on the frame exposed with "elements, Console, Source, etc.." browse on the ">>" icon to reach "security", then you will get the "view certificate" icon to perform you checks;
If in Firefox (v.54.0.x) the SSL site will generate a green lock just before the link you´re in, then left-click the lock icon > the site name will appear and then a ">" icon that will lead you to the certificate details;


text:
Q: Is the hereditary version of this weak finiteness notion nontrivial? Say that a set $X$ is $\Pi^1_1$-pseudofinite if every first-order sentence $\varphi$ with a model with underlying set $X$ has a finite model. The existence of infinite $\Pi^1_1$-pseudofinite sets is consistent with $\mathsf{ZF}$, since indeed every amorphous set is $\Pi^1_1$-pseudofinite.
Perhaps surprisingly, it is not immediately clear whether the class of $\Pi^1_1$-pseudofinite sets need be closed under finite unions. My question is what happens when we fix this weakness by brute force:

Is it consistent with $\mathsf{ZF}$ that there is an infinite hereditarily $\Pi^1_1$-pseudofinite set - that is, an infinite set $X$ such that whenever $Y$ is $\Pi^1_1$-pseudofinite, $X\cup Y$ is also $\Pi^1_1$-pseudofinite?

Note that the hereditarily $\Pi^1_1$-pseudofinite sets are closed under finite unions, so this actually does "fix" the situation above. One natural hope is that amorphous sets do the trick again, but I don't see how - certainly the argument linked above doesn't suffice. (Of course there are finiteness notions stricter than amorphousness - e.g. "in any partition into infinitely many pieces, all but finitely many of those pieces are singletons" - but to my knowledge they're all significantly more finicky to work with, so it would be very nice if we didn't have to go there.)

A: It is consistent that there are infinite hereditarily $\Pi_1^1$-pseudofinite sets. I'll just say "pseudofinite" instead of "$\Pi_1^1$-pseudofinite" for the rest of this post.

Theorem 1. Let $N$ be a model of ZF-Foundation satisfying "pseudofinite violations of choice for pseudofinite sets": there is a pseudofinite set $A$ such that for all pseudofinite $X,$ there is an ordinal $\alpha$ and a surjection $A^{<\omega}\times\alpha\to X.$
In $N,$ the class of pseudofinite sets is closed under finite unions.

The reason I've stated it like this is because not only does the hypothesis hold in permutation models where the set of atoms is pseudofinite but, if I've stated it correctly now, it should also hold in typical ZF embeddings of these permutation models. In particular these hypotheses hold in the basic Fraenkel model, with $A$ being the set of atoms, and in the ZF model you get by applying Jech-Sochor to the basic Fraenkel model.
The theorem will follow from two easy observations. (Proof is at the bottom.)
Lemma 2. If $X$ is pseudofinite, $n\in\omega,$ and $f:X^n\to Y$ is a function, then $f[X]$ is pseudofinite.
This is because $f$ defines an interpretation of $f[X]$ in $X,$ and ZF lets us define the preimages of any relation on $Y.$
Corollary 3. If $X$ is pseudofinite then there is no surjection from $X$ to an infinite linearly ordered set.
Corollary 3 is what François G. Dorais' answer mentioned; Tarski's "II-finite". It follows from Lemma 2 with $n=1$ because if a linear order has an $n$'th element for each $n,$ then it contains a copy of $\omega,$ which is not pseudofinite. And if it doesn't have an $n$'th element, it satisfies the statement "has $\geq n$ elements but no $n$'th element" which also contradicts pseudofiniteness.
In terms of order properties, I think every pseudofinite set $X$ is "P-finite" in the terminology of [2]: every partial order on $X$ has a maximal element. This is the strongest notion of finiteness considered there for non-amorphous sets, and you know amorphous is strictly stronger than pseudofinite. But order properties might be a red herring. If you take a permutation model with a homogeneous vector space $V$ over $\mathbb F_2$ with a generic symmetric bilinear form then $V$ won't be pseudofinite; finite models satisfy $(\exists z)(\forall y) B(y,y)=B(y,z),$ but $V$ won't. A concrete model is $V=\mathbb F_2^{\oplus\omega}$ with $B(x,y)=\sum_i x_iy_i.$ There doesn't seem to be any ordering involved as far as I can see. And if you instead take a symplectic bilinear form $B$ - so $B$ is non-degenerate and satisfies $B(v,v)=0$ - then I think $V$ will be pseudofinite. Specifically, Duplicator can win an $n$-step Ehrenfeucht–Fraïssé game for $V$ and a $2n$-dimensional symplectic space, by ensuring the chosen elements span isomorphic subspaces at each step.

ZF models
Because of Corollary 3, the statement "if $x$ and $y$ are pseudofinite then so is $x\cup y$" is surjectively boundable and hence injectively boundable in the sense of [1]. So it transfers to ZF.
Ideally I'd want to rule out all models I can think of, not just Pincus'. Here is my sketchy understanding of how this should work for the Jech-Sodor embedding theorem. In these models, sets have a support of the form $(e,E)$ where $e$ is a set of indices for generic subsets of a regular cardinal $\kappa,$ and $E$ is a set of atoms of a permutation model. Not all permutation models have minimal supports, e.g. take an infinite homogenous vector space over $\mathbb F_3.$ But there is always a minimal set of reals $e.$ That part is where the work is; the section in Jech's "Axiom of Choice" on the embedding theorems has very similar statements though I don't see anything directly quotable. This gives a map $s:X\to \mathcal P^{<\omega}(\kappa)$ taking each $x\in X$ to the minimal set $e$ such that there is a pair $(e,E)$ that is a support for $x.$ The formal statement would be $p\Vdash \dot{r}\in \dot{s}(\dot{x})$ if there is a name $\dot{z}$ fixed by symmetries of the symmetric extension that fix $(e,E),$ satisfying $p\Vdash \dot{z}=\dot{x},$ and $\dot{r}$ is the canonical name for the set indexed by an element of $e,$ and we can't get a smaller set $e$ by refining $p$ and choosing a different $\dot{z}.$ Since the image of $s$ is linearly ordered, it has to be finite when $X$ is pseudofinite. Finite sets can be absorbed into "$\alpha$" so the only parameters that matter are the atoms.

Proof of Theorem 1.
The following are equivalent for non-empty sets $X\in N$:

*

*$X$ is pseudofinite

*There is a surjection $A^{p_1}\coprod \dots\coprod A^{p_k}\to X$ for some $k,p_1,\dots,p_k\in\omega.$

*There is a surjection $A^n\to X$ for some $n$.

1⇒2: By our small violations of choice axiom, there is a surjection $f:A^{<\omega}\times \alpha\to X.$ Define $g:X\to \omega\times \alpha$ by $g(x)=\min\{(|w|,\beta):g(w,\beta)=x\},$ using the ordinal product ordering. By Corollary 3, the image of $g$ is a finite set $I\subset\omega\times\alpha.$ After some reindexing, this is of the required form: the surjection is defined on $\coprod_{i\in I} A^{i_1}$ by sending $w\in A^{i_1}$ (in the $i$'th component of the disjoint union) to $f(w,i_2).$
2⇒3: set $n=2k+\max p_i$ and encode the component index $1\leq i\leq k$ using the equality relation on the first $2k$ variables
3⇒1: This is Lemma 2.
The class of sets defined by condition 2 is obviously closed under finite unions, as required. $\square$

[1]: David Pincus, Zermelo-Fraenkel Consistency Results by Fraenkel-Mostowski Methods, The Journal of Symbolic Logic, Vol. 37, No. 4 (Dec., 1972), pp. 721-743
[2]: Omar De la Cruz, Damir D. Dzhafarov, and Eric J. Hall, Definitions of finiteness based on order properties, Fundamenta Mathematicae (2006), Volume: 189, Issue: 2, page 155-172. https://eudml.org/doc/282771


text:
Q: Reading data from TV I'm trying to read data from a table view,I've created the following method:
/**
 Salva le nuove info dell'Evento modificato
*/
private func SalvaEventoModificato(){

    self.Effetto_blur.alpha = 1

    var IndexPath = NSIndexPath(row: 0, section: 0)

    //let nome_Evento = ((self.table_viewCosaVisualizzare.cellForRow(at: IndexPath as IndexPath)) as! cella_locale_modifica).NomeEvento.text!

    var nome_evento = ""
    var artista = ""
    var genere = ""
    var descrizione = ""
    var data_inizio:NSNumber? = nil
    var data_fine:NSNumber? = nil
    var Immagine_Evento:UIImage? = nil

    if let cell = ((self.table_viewCosaVisualizzare.cellForRow(at: IndexPath as IndexPath)) as? cella_locale_modifica){
        nome_evento = cell.NomeEvento.text!
        Immagine_Evento = cell.CopertinaLocale.image!
    }

    IndexPath = NSIndexPath(row: 2, section: 0)

    if let cella2 = ((self.table_viewCosaVisualizzare.cellForRow(at: IndexPath as IndexPath)) as? g_cella){

        artista = cella2.Artista.text!
        genere = cella2.Genere.text!

    }

    IndexPath = NSIndexPath(row: 4, section: 0)

    if let cella3 = ((self.table_viewCosaVisualizzare.cellForRow(at: IndexPath as IndexPath)) as? descrizione_cella){
         descrizione = cella3.descrizione.text
    }

    IndexPath = NSIndexPath(row: 8, section: 0)

    if let cella4 = ((self.table_viewCosaVisualizzare.cellForRow(at: IndexPath as IndexPath)) as? inizio_evento_cella){

        data_inizio = cella4.data_picker.date.timeIntervalSince1970 as NSNumber
    }

    IndexPath = NSIndexPath(row: 12, section: 0)

    if let cella5 = ((self.table_viewCosaVisualizzare.cellForRow(at: IndexPath as IndexPath)) as? inizio_evento_cella){

        data_fine = cella5.data_picker.date.timeIntervalSince1970 as NSNumber
    }

    let nuoviDati:[String:Any] = ["Nome Evento":nome_evento,"Artista":artista,"Genere":genere,"Descrizione":descrizione,"Inizio Evento":data_inizio!,"Fine Evento":data_fine]

    let storage = Storage.storage().reference().child("Eventi").child(self.EventoCorrente.Chiave!).child("Copertina").child("Copertina.jpg")

    IndexPath = NSIndexPath(row: 0, section: 0)

    if let dati = UIImageJPEGRepresentation(Immagine_Evento!, 0.6){
        print("salvo nuova copertina")

        storage.putData(dati, metadata: nil, completion: { (metadata, Error) in

            if Error != nil{

                let avviso = UIAlertController(title: "Errore", message: "Si è verificato un Errore con la modifica del tuo Evento, riprova più tardi.", preferredStyle: UIAlertControllerStyle.alert)

                let Ok = UIAlertAction(title: "Ok", style: .default, handler: { (UIAlertAction) in

                    self.Effetto_blur.alpha = 0

                    return

                })

                avviso.addAction(Ok)

                self.present(avviso, animated: true, completion: nil)

            }else{

                if let RemotePhoto = metadata?.downloadURL()?.absoluteString {

                    let url_copertina = RemotePhoto

                    let nuoviDati:[String:Any] = ["Nome Evento":nome_evento,"Artista":artista,"Genere":genere,"Descrizione":descrizione,"Immagine Copertina":url_copertina,"Inizio Evento":data_inizio!,"Fine Evento":data_fine!]

                    self.ref.child("Eventi").child(self.EventoCorrente.Chiave!).updateChildValues(nuoviDati)

                    self.Effetto_blur.alpha = 0

                }
            }

        })

    }

}

that works fine but it seems to read only the cell that are loaded in the current view of the user , for example:

output the following:
["Descrizione": "Benvenuto nella pagina dell\'Evento di debug", "Genere": "Debug", "Artista": "Debug", "Fine Evento": nil, "Inizio Evento": 1495058400, "Nome Evento": "Evento Dubig"]
Optional(<UIImage: 0x6000002914e0> size {1000, 1000} orientation 0 scale 1.000000)

instead this :

Output this:
["Descrizione": "Benvenuto nella pagina dell\'Evento di debug", "Genere": "", "Artista": "", "Fine Evento": Optional(1523764800), "Inizio Evento": 1495058400, "Nome Evento": ""]
nil

is there a way to read from ALL the cells?


text:
Q: Linux Global Includes Path I am trying to use OpenBabel and am experiencing great difficulty with setting up a global search path for include files. I have successfully linked to the libraries with $LD_LIBRARY_PATH, but when compiling with the GNU C++ compiler, it cannot find the include files. Is there a global include environment variable on Linux, and if so, what is it?

A: You could give the include path to GCC using the option -I:
g++ -I/path/to/the/include/dir blabla

Please note that also the library dir may be bassed via -L option -L/path/to/lib/dir. LD_LIBRARY_PATH is usually considered a dirty hack.
You can have multiple -I (and -L) options:
g++ -I/dir/include1 -I/dir/include2

A: If you check the manpage for cpp (the C Preprocessor), it state that it will treat the following environment variables like the -I option mentioned above:

*

*CPATH

*C_INCLUDE_PATH

*CPLUS_INCLUDE_PATH

Now, I believe that current g++ and gcc use an inbuilt cpp, but I would expect that it would function like the stand alone cpp, and respect these environment variables.


text: Q: Configure a DNS Server could not configure root hints I have a problem with my DNS .. I want set my client computer (win xp) to domain, but domain cannot be contacted, on the details, it said, my DNS is not responding. then I type nslookup on server command prompt, it said, RTO and default server unknown. I try to configure DNS server until complete, but when I click finish button there is notification "DNS server wizard could not be configure root hints", anyone can help me ?


text:
Q: Kubernetes: Multiple Services/Replication Controllers We're looking for direction on how to set up services and replication controllers for multiple microservices. I see a lot of examples on the internet that demonstrate a single service; I'm not sure how to configure each service separately. Are there examples out there that anyone can point to?

A: The Guestbook example shows a multi-tier web application that uses multiple services and multiple replication controllers.


text:
Q: async.eachSeries not working as expected with mongodb call in iterator I'm trying to insert an array in an ordered way into a mongodb database, for that i'm using async.eachSeries but the rows are not inserted in the order as they are in the array. Here is the code:
https://gist.github.com/r01010010/af8eeb39023ce1cc04f6#file-series-js-L16
  var server = new mongodb.Server('localhost', 27017, {auto_reconnect: true, safe: true});
  var db = new mongodb.Db('scjs', server);

  db.open(function(err, db) { if(err) throw err;

  async.eachSeries(

      // Collection
        mongo_provinces

      // Iterator
      , function(province, done){
          db.collection('provinces').insert(province, function(err, result) { if(err) throw err;
              console.log(result);
              done();
          });
      }

      // Callback when the iteration is finished
      , function(err){ if(err) throw err;
          process.exit();
      }
  );

  });

A: I would not rely on the order of insertion here, but on the retrieval instead. If no ordering is specified, then the default query will return documents in the natural order. If you want to get results in specific order, apply sort parameter:

*

*Using sort: http://docs.mongodb.org/manual/reference/method/cursor.sort/#cursor.sort

*Natural order: http://docs.mongodb.org/manual/reference/method/cursor.sort/#return-in-natural-order


text:
Q: Pandas - moving data between columns in a dataframe df1
Reference_Code   Last_Price   Price_Now
B0002EH2X2       NaN          9.99
B0075DRIAK       NaN          19.99
B0083F2XDQ       NaN          29.99
B009AS5VW0       NaN          39.99

df2
Reference_Code   Price_Now
B0002EH2X2       49.99
B0075DRIAK       19.99
B0083F2XDQ       29.99
B009AS5VW0       9.99

I would like to move the values from the Price_Now in df1 into the Last_Price column in df1, where the price is difference to df2. In the example above, I would expect the output to be;
df1
Reference_Code   Last_Price   Price_Now
B0002EH2X2       9.99         49.99
B0075DRIAK       NaN          19.99
B0083F2XDQ       NaN          29.99
B009AS5VW0       39.99        9.99

I am trying to use pandas, but have myself in a bit of a spin. The dataset is much larger than the tables shown above

A: Do a map:
s = df1['Reference_Code'].map(df2.set_index('Reference_Code')['Price_Now'])
mask = (s!=df1['Price_Now'])
df1['Last_Price'] = df1['Price_Now'].where(mask)
df1['Price_Now'] =  s.where(mask, df['Price_Now']

Output:
  Reference_Code  Last_Price  Price_Now
0     B0002EH2X2        9.99      49.99
1     B0075DRIAK         NaN      19.99
2     B0083F2XDQ         NaN      29.99
3     B009AS5VW0       39.99       9.99


text:
Q: Convert JSON to DataSet with TRESTResponseDataSetAdapter I need to consume a REST API that returns a JSON that resembles the following:
[
    {
        "purchaseCode": 1,
        "totalItems": 5,
        "totalPrice": 5102.04,
        "deliveryAddress": {
            "name": "Michael Jennette",
            "country": "Brazil",
            "state": "São Paulo",
            "postCode": "16",
            "landmark": ""
        }
    },
    {
        "purchaseCode": 2,
        "totalItems": 3,
        "totalPrice": 4312.65,
        "deliveryAddress": {
            "name": "David Samuel",
            "country": "Brazil",
            "state": "São Paulo",
            "postCode": "40",
            "landmark": ""
        }
    }
]

I can easily convert this JSON format to a class using TJSONObject.ParseJSONValue. The problem is that I need to print reports with this json's data. So it's more interesting to convert JSON to DataSet.
Before JSON existed, XML was heavily used. In XMLs that an object owned another object, the DataSet had to have a field of type DataSet that would be referenced by another DataSet. This way it is possible to convert all XML to DataSet.
I'm trying to do the same with JSON using the native component TRESTResponseDataSetAdapter. I have seen that I can specify the fields for ResponseDataSetAdapter and that each field can have "child fields".
Therefore, I defined "deliveryAddress" as the DataSet type and specified its "child fields". But when I run the request, I get an "Invalid Argument" error and then another "Invalid value for field "deliveryAddress" error.
Is it possible to convert this JSON format to DataSet using TRESTResponseDataSetAdapter? If yes, how? Or is there another way? I did not want to have to convert to classes and then manually fill each DataSet.

Sample project:
Server (WebBroker)
Project1.dpr
program Project1;
{$APPTYPE CONSOLE}

uses
  System.SysUtils,
  System.Types,
  IPPeerServer,
  IPPeerAPI,
  IdHTTPWebBrokerBridge,
  Web.WebReq,
  Web.WebBroker,
  WebModuleUnit1 in 'WebModuleUnit1.pas' {WebModule1: TWebModule},
  ServerConst1 in 'ServerConst1.pas';

{$R *.res}

function BindPort(Aport: Integer): Boolean;
var
  LTestServer: IIPTestServer;
begin
  Result := True;
  try
    LTestServer := PeerFactory.CreatePeer('', IIPTestServer) as IIPTestServer;
    LTestServer.TestOpenPort(APort, nil);
  except
    Result := False;
  end;
end;

function CheckPort(Aport: Integer): Integer;
begin
  if BindPort(Aport) then
    Result := Aport
  else
    Result := 0;
end;

procedure SetPort(const Aserver: TIdHTTPWebBrokerBridge; APort: String);
begin
  if not (Aserver.Active) then
  begin
    APort := APort.Replace(cCommandSetPort, '').Trim;
    if CheckPort(APort.ToInteger) > 0 then
    begin
      Aserver.DefaultPort := APort.ToInteger;
      Writeln(Format(sPortSet, [APort]));
    end
    else
      Writeln(Format(sPortInUse, [Aport]));
  end
  else
    Writeln(sServerRunning);
  Write(cArrow);
end;

procedure StartServer(const Aserver: TIdHTTPWebBrokerBridge);
begin
  if not (Aserver.Active) then
  begin
    if CheckPort(Aserver.DefaultPort) > 0 then
    begin
      Writeln(Format(sStartingServer, [Aserver.DefaultPort]));
      Aserver.Bindings.Clear;
      Aserver.Active := True;
    end
    else
      Writeln(Format(sPortInUse, [Aserver.DefaultPort.ToString]));
  end
  else
    Writeln(sServerRunning);
  Write(cArrow);
end;

procedure StopServer(const Aserver: TIdHTTPWebBrokerBridge);
begin
  if Aserver.Active  then
  begin
    Writeln(sStoppingServer);
    Aserver.Active := False;
    Aserver.Bindings.Clear;
    Writeln(sServerStopped);
  end
  else
    Writeln(sServerNotRunning);
  Write(cArrow);
end;

procedure WriteCommands;
begin
  Writeln(sCommands);
  Write(cArrow);
end;

procedure WriteStatus(const Aserver: TIdHTTPWebBrokerBridge);
begin
  Writeln(sIndyVersion + Aserver.SessionList.Version);
  Writeln(sActive + Aserver.Active.ToString(TUseBoolStrs.True));
  Writeln(sPort + Aserver.DefaultPort.ToString);
  Writeln(sSessionID + Aserver.SessionIDCookieName);
  Write(cArrow);
end;

procedure RunServer(APort: Integer);
var
  LServer: TIdHTTPWebBrokerBridge;
  LResponse: string;
begin
  WriteCommands;
  LServer := TIdHTTPWebBrokerBridge.Create(nil);
  try
    LServer.DefaultPort := APort;
    while True do
    begin
      Readln(LResponse);
      LResponse := LowerCase(LResponse);
      if LResponse.StartsWith(cCommandSetPort) then
        SetPort(LServer, LResponse)
      else if sametext(LResponse, cCommandStart) then
        StartServer(LServer)
      else if sametext(LResponse, cCommandStatus) then
        WriteStatus(LServer)
      else if sametext(LResponse, cCommandStop) then
        StopServer(LServer)
      else if sametext(LResponse, cCommandHelp) then
        WriteCommands
      else if sametext(LResponse, cCommandExit) then
        if LServer.Active then
        begin
          StopServer(LServer);
          break
        end
        else
          break
      else
      begin
        Writeln(sInvalidCommand);
        Write(cArrow);
      end;
    end;
  finally
    LServer.Free;
  end;
end;

begin
  try
  if WebRequestHandler <> nil then
    WebRequestHandler.WebModuleClass := WebModuleClass;
    RunServer(8080);
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end
end.

ServerConst1.pas
unit ServerConst1;

interface

resourcestring
  sPortInUse = '- Error: Port %s already in use';
  sPortSet = '- Port set to %s';
  sServerRunning = '- The Server is already running';
  sStartingServer = '- Starting HTTP Server on port %d';
  sStoppingServer = '- Stopping Server';
  sServerStopped = '- Server Stopped';
  sServerNotRunning = '- The Server is not running';
  sInvalidCommand = '- Error: Invalid Command';
  sIndyVersion = '- Indy Version: ';
  sActive = '- Active: ';
  sPort = '- Port: ';
  sSessionID = '- Session ID CookieName: ';
  sCommands = 'Enter a Command: ' + slineBreak +
    '   - "start" to start the server'+ slineBreak +
    '   - "stop" to stop the server'+ slineBreak +
    '   - "set port" to change the default port'+ slineBreak +
    '   - "status" for Server status'+ slineBreak +
    '   - "help" to show commands'+ slineBreak +
    '   - "exit" to close the application';

const
  cArrow = '->';
  cCommandStart = 'start';
  cCommandStop = 'stop';
  cCommandStatus = 'status';
  cCommandHelp = 'help';
  cCommandSetPort = 'set port';
  cCommandExit = 'exit';

implementation

end.

WebModuleUnit1.pas
unit WebModuleUnit1;

interface

uses System.SysUtils, System.Classes, Web.HTTPApp;

type
  TWebModule1 = class(TWebModule)
    procedure WebModule1jsonAction(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  WebModuleClass: TComponentClass = TWebModule1;

implementation

{%CLASSGROUP 'System.Classes.TPersistent'}

{$R *.dfm}

procedure TWebModule1.WebModule1jsonAction(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
  Response.ContentType := 'application/json; charset=utf-8';
  Response.Content :=
    '[{"purchaseCode":1,"totalItems":5,"totalPrice":5102.04,"deliveryAddress":{"name":"Michael Jennette","country":"Brazil","state":"S\u00E3o Paulo","postCode":"16","landmark":""}},' +
    '{"purchaseCode":2,"totalItems":3,"totalPrice":4312.65,"deliveryAddress":{"name":"David Samuel","country":"Brazil","state":"S\u00E3o Paulo","postCode":"40","landmark":""}}]';
end;

end.

WebModuleUnit1.dfm
object WebModule1: TWebModule1
  OldCreateOrder = False
  Actions = <
    item
      MethodType = mtGet
      Name = 'json'
      PathInfo = '/json'
      OnAction = WebModule1jsonAction
    end>
  Height = 230
  Width = 415
end

Client
Client1.dpr
program Client1;

uses
  Vcl.Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

Unit1.pas
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, IPPeerClient, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param,
  FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, FireDAC.Comp.DataSet, FireDAC.Comp.Client,
  REST.Response.Adapter, REST.Client, Data.Bind.Components, Data.Bind.ObjectScope, Vcl.Grids, Vcl.DBGrids, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    btnRequest: TButton;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    RESTClient1: TRESTClient;
    RESTRequest1: TRESTRequest;
    RESTResponse1: TRESTResponse;
    RESTResponseDataSetAdapter1: TRESTResponseDataSetAdapter;
    FDMemTable1: TFDMemTable;
    FDMemTable2: TFDMemTable;
    FDMemTable1purchaseCode: TIntegerField;
    FDMemTable1totalItems: TIntegerField;
    FDMemTable1totalPrice: TCurrencyField;
    FDMemTable1deliveryAddress: TDataSetField;
    FDMemTable2name: TStringField;
    FDMemTable2country: TStringField;
    FDMemTable2state: TStringField;
    FDMemTable2postCode: TStringField;
    FDMemTable2landmark: TStringField;
    procedure btnRequestClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btnRequestClick(Sender: TObject);
begin
  RESTRequest1.Execute;
end;

end.

Unit1.dfm
object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 362
  ClientWidth = 724
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object btnRequest: TButton
    Left = 24
    Top = 24
    Width = 75
    Height = 25
    Caption = 'Request'
    TabOrder = 0
    OnClick = btnRequestClick
  end
  object DBGrid1: TDBGrid
    Left = 296
    Top = 48
    Width = 409
    Height = 297
    DataSource = DataSource1
    TabOrder = 1
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'Tahoma'
    TitleFont.Style = []
  end
  object DataSource1: TDataSource
    DataSet = FDMemTable1
    Left = 232
    Top = 152
  end
  object RESTClient1: TRESTClient
    Accept = 'application/json, text/plain; q=0.9, text/html;q=0.8,'
    AcceptCharset = 'UTF-8, *;q=0.8'
    BaseURL = 'http://localhost:8080/json'
    Params = <>
    HandleRedirects = True
    RaiseExceptionOn500 = False
    Left = 32
    Top = 64
  end
  object RESTRequest1: TRESTRequest
    Client = RESTClient1
    Params = <>
    Response = RESTResponse1
    SynchronizedEvents = False
    Left = 32
    Top = 112
  end
  object RESTResponse1: TRESTResponse
    ContentType = 'application/json'
    Left = 32
    Top = 160
  end
  object RESTResponseDataSetAdapter1: TRESTResponseDataSetAdapter
    Dataset = FDMemTable1
    FieldDefs = <
      item
        Name = 'purchaseCode'
        DataType = ftInteger
      end
      item
        Name = 'totalItems'
        DataType = ftInteger
      end
      item
        Name = 'totalPrice'
        DataType = ftCurrency
      end
      item
        Name = 'deliveryAddress'
        ChildDefs = <
          item
            Name = 'name'
            DataType = ftString
            Size = 150
          end
          item
            Name = 'country'
            DataType = ftString
            Size = 150
          end
          item
            Name = 'state'
            DataType = ftString
            Size = 150
          end
          item
            Name = 'postCode'
            DataType = ftString
            Size = 50
          end
          item
            Name = 'landmark'
            DataType = ftString
            Size = 150
          end>
        DataType = ftDataSet
        Size = 5
      end>
    Response = RESTResponse1
    Left = 32
    Top = 216
  end
  object FDMemTable1: TFDMemTable
    FetchOptions.AssignedValues = [evMode]
    FetchOptions.Mode = fmAll
    ResourceOptions.AssignedValues = [rvSilentMode]
    ResourceOptions.SilentMode = True
    UpdateOptions.AssignedValues = [uvCheckRequired]
    UpdateOptions.CheckRequired = False
    Left = 168
    Top = 152
    object FDMemTable1purchaseCode: TIntegerField
      FieldName = 'purchaseCode'
    end
    object FDMemTable1totalItems: TIntegerField
      FieldName = 'totalItems'
    end
    object FDMemTable1totalPrice: TCurrencyField
      FieldName = 'totalPrice'
    end
    object FDMemTable1deliveryAddress: TDataSetField
      FieldName = 'deliveryAddress'
    end
  end
  object FDMemTable2: TFDMemTable
    FetchOptions.AssignedValues = [evMode]
    FetchOptions.Mode = fmAll
    ResourceOptions.AssignedValues = [rvSilentMode]
    ResourceOptions.SilentMode = True
    UpdateOptions.AssignedValues = [uvCheckRequired]
    UpdateOptions.CheckRequired = False
    Left = 168
    Top = 224
    object FDMemTable2name: TStringField
      FieldName = 'name'
      Size = 150
    end
    object FDMemTable2country: TStringField
      FieldName = 'country'
      Size = 150
    end
    object FDMemTable2state: TStringField
      FieldName = 'state'
      Size = 150
    end
    object FDMemTable2postCode: TStringField
      FieldName = 'postCode'
      Size = 50
    end
    object FDMemTable2landmark: TStringField
      FieldName = 'landmark'
      Size = 150
    end
  end
end


text: Q: Problem when storing extended ASCII values in SQL db I am using SQL SERVER 2008 .I am trying to save extended special characters (ASCII values from 128-256) in SQL db. The collation of column is SQL_LATIN1_GENERAL_CP1_CI_AS, and the collation of database is also same.when I am saving these extended special characters these all are saving differently. I have checked the code page 1252 and these special characters are defined in code page. I have checked the system code page  in cmd using mode cmd and its 1252. How can I save these extended special characters in  db.


text:
Q: React with typescript: onmouseup and onmousedown not recognizing left click I have this simple piece of code which is supposed to set the mousePressed variable to true when the mouse is pressed and reset it when it is unpressed. I see that it is working well for right click and middle click but not for left click. event.which returns 2 and 3 respectively for middle and right clicks. What am I missing? Is there a way to get the same behaviour with onclick()? I am using react with typescript.
    const canvasElement = document.createElement("canvas");
    canvasElement.onmousedown = (event: MouseEvent) => {
        console.log(event.which);
        console.log("Mouse pressed");
        console.log(this.mousePressed);
        this.mousePressed = true;
    };
    //this.onmouseDown;
    canvasElement.onmouseup =  (event: MouseEvent) => {
        console.log(event.which);
        console.log("Mouse unpressed");
        console.log(this.mousePressed);
        this.mousePressed = false;
    };

A: This worked:
    canvasElement.addEventListener("pointerdown", this.onmouseDown.bind(this));
    canvasElement.addEventListener("pointermove", this.recordCoordinates.bind(this));
    canvasElement.addEventListener("pointerup", this.onmouseUp.bind(this));

A: The code you provided before works fine: https://jsfiddle.net/ktq1oda6/
Open up the console on the fiddle and you should see the correct which.
You probably have something else in the application that is catching the clicks. Make sure you aren't calling e.stopPropogation anywhere.
EDIT: I see your new solution. There was probably something else in your code causing the problem, but glad you fixed it.


text:
Q: Cannot replace Ubuntu with Windows (CD/DVD gives up on booting Windows) I've been trying for hours to remove Ubuntu which is the only OS on my laptop. I don't have a Windows installation there.  I've followed various bits of help, including trying to get boot-repair to work (I just get error messages when I try to run the recommended commands).
Please can someone tell me how to get rid of Ubuntu? It won't recognize my .iso copy of Windows - tries to read the DVD and then just boots Ubuntu anyway. The DVD is fine - I can use it on other computers and it's perfectly OK.

A: Wow, this is a really strange question. You want to remove the only OS on your machine. I won't ask why, maybe you wish to try something else.
If this is what you really want, try running
sudo dd if=/dev/zero of=/dev/sda

from any live CD.
Before you run this, know that it'll nuke your hard disk, your computer will not be usable until you install a new OS.

A: It sounds as though two things are possible:

*

*Your computer is not set to use the CD as the first boot option. If this is the case there is usually an option to interrupt the normal boot and select an alternate boot, but if that is not happening you should use your bios to move the CD up to the first boot device.

or

*

*You are missing the prompt that the Windows Installer gives "press any key to install Windows". If you do not hit the key you will not boot the Windows installer.

A: To uninstall Ubuntu, simply install another operating system, ensuring that you format the hard drive during the installation process.
Put the installation disc into the drive, make sure your BIOS is set to boot up from disc (you'll have to check with your BIOS settings on how to do that), and start up the computer. It's really as simple as that.
Now, if your computer is not booting from CD/DVD, you don't have your BIOS settings set properly, which has nothing to do with Ubuntu. I suspect that whatever problems your having, it has nothing to do with Ubuntu.


text:
Q: Can we generate QR code through Xamarin I am developing an Android app in xamarin in which I require to create a QR code from the data input by the user in various fields.
SO my question is can I do it with the help of Xamarin? If yes then please help me with any sample code or tutorial link.

A: ZXing.Net has a QR code generator built in. Take a look at that.
Something like this could do the job (following code not tested):
var writer = new BarcodeWriter
{
    Format = BarcodeFormat.QR_CODE,
    Options = new EncodingOptions
                {
                    Height = 200,
                    Width = 600
                }
};
var bitmap = writer.Write("My content");

This should generate an image with the QR code. There are loads of other options you can mess with.
ZXing is also available as a component for Xamarin.Android, Xamarin.iOS and Windows Phone


text:
Q: late response from this function when i single tap on screen then it takes about 1 minute to respond me.
why it is taking too much time
public boolean onTouchEvent(MotionEvent event) {
    int action = event.getAction();
    switch (action) {
        case MotionEvent.ACTION_DOWN:{
        addDelay("your current location is....  you are in FYP lab");
        addDelay("please tell me where you want to go");
            getInput();
        }
        case MotionEvent.ACTION_MOVE:
            break;
        case MotionEvent.ACTION_UP:
            break;
        }
        return false;
}


text:
Q: cannot input password after input username and press enter in tty1 of ubuntu 16.04 The version of my Ubuntu is 16.04 LTS. After Ctrl+Alt+F1, I enter the tty1. The first thing to do is to login. But when I input my username and press the enter, I cannot input the password. And it repeatedly print login incorrect.

A: I think the problem is the kernel version 4.15.0-43-generic.
Remove 4.15-0-44-generic and 4.15-0-45-generic:
sudo apt-mark hold linux-*-4.15.0-4[45]-generic
sudo apt remove linux-*-4.15.0-4[45]-generic

Install 4.15.0-43-generic
sudo apt install linux-{image,headers,modules,modules-extra}-4.15.0-43-generic

Instructions copied from here


text:
Q: Next-Button cannot be clicked after cancellation of suggested edit I encountered a bug regarding the Next button in the review section.

Steps to reproduce:

*

*Review a "first post".

*Complete the first review regularly and review another "first post".

*Start editing the post.

*Wait for some time, so that someone else likely completes the review.

*Click the browser's back button.

*Try clicking the Next-button.

  Expected behavior:
The next review is being displayed, or a message appears stating that there are no posts to review.
Current behavior:
Nothing happens. The button looks "clickable", but cannot be clicked.
  After reloading the page the button gets clickable.

Edit: After several "edit" -> "cancel" -> "edit" -> "back" cycles I managed to get this result (Note the two "cancel"-links at the top):

A: The back button is a can of worms for many top websites and preventative measures can prove to be both time consuming and very cost-ineffective.
In the grand scheme of things, this isn't really as earth shattering enough of a bug to warrant the time and money it will take to fix it. You're probably one of a very small percentage of users who will ever be affected by this :).


text:
Q: Cannot remove old kernel versions on Ubuntu 16.04 I have a challenge to clean the boot drive that is 100% full.
I list previous versions:
dpkg -l linux-image*
And will get list of 12 versions,
rc  linux-image-4.4.0-45-generic    4.4.0-45.66          amd64                Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-47-generic    4.4.0-47.68          amd64                Linux kernel image for version 4.4.0 on 64 bit x86 SMP

here the tail:
[...]
ii  linux-image-4.4.0-78-generic    4.4.0-78.99          amd64                Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-79-generic    4.4.0-79.100         amd64                Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-81-generic    4.4.0-81.104         amd64                Linux kernel image for version 4.4.0 on 64 bit x86 SMP
in  linux-image-4.4.0-83-generic    <none>               amd64                (no description available)
iU  linux-image-virtual             4.4.0.83.89          amd64                This package will always depend on the latest minimal generic kerne

Ok, so I want to delete the old versions and keep the latest one.
I am currently on:
uname -r
4.4.0-78-generic

So I want to delete the old versions:
apt-get autoremove -f
The following NEW packages will be installed:
  linux-image-4.4.0-83-generic
0 upgraded, 1 newly installed, 0 to remove and 48 not upgraded.
10 not fully installed or removed.
[...]
Unpacking linux-image-4.4.0-83-generic (4.4.0-83.106) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-83-generic_4.4.0-83.106_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.4.0-83-generic' to '/boot/vmlinuz-4.4.0-83-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-83-generic /boot/vmlinuz-4.4.0-83-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-83-generic /boot/vmlinuz-4.4.0-83-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-4.4.0-83-generic_4.4.0-83.106_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

So that didn't work out - for some reason it says: 0 to remove.
I try manually
apt-get remove linux-image- (tab)
and get these options
linux-image-4.4.0-62-generic  linux-image-4.4.0-70-generic  linux-image-4.4.0-75-generic
linux-image-4.4.0-64-generic  linux-image-4.4.0-71-generic  linux-image-4.4.0-78-generic
linux-image-4.4.0-66-generic  linux-image-4.4.0-72-generic  linux-image-virtual

So all of them do not appear there.
I try to remove one of them
apt-get remove linux-image-4.4.0-62-generic
Result:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-image-virtual : Depends: linux-image-4.4.0-83-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

??? I want to delete those and what it suggests here is to use install instead? Which I cannot do that as the boot drive is 100% full...

A: You need to free up some disk space under /boot partition. You can remove the files related to specific Linux kernel image that you want to uninstall. You just need to make sure you don't remove the default Linux image to be booted during system startup (usually the lastest version should be kept).
Then, you can try to apt-get remove linux-image-version  and apt-get -f install to fix the broken dependencies.


text:
Q: Use cases for using multiple queries for Spark Structured streaming I have a requirement of streaming from multiple Kafka topics[Avro based] and putting them in Greenplum with small modification in the payload.
The Kaka topics are defined as a list in a configuration file and each Kafka topic will have one target table.
I am looking for a single Spark Structured application and an update in the configuration file to listen to new topics or stop. listening to the topic.
I am looking for help as I am confused about using a single query vs multiple:
val query1 = df.writeStream.start()
val query2 = df.writeStream.start()

spark.streams.awaitAnyTermination()

or
df.writeStream.start().awaitAnyTermination()

Under which use cases multiple queries should be used over the single query

A: Apparently, you can use regex pattern for consuming the data from different kafka topics.
Lets say, you have topic names like "topic-ingestion1", "topic-ingestion2" - then you can create a regex pattern for consuming data from all topics ending with "*ingestion".
Once the new topic gets created in the format of your regex pattern - spark will automatically start streaming data from the newly created topic.
Reference:
[https://spark.apache.org/docs/latest/structured-streaming-kafka-integration.html#consumer-caching]
you can use this parameter to specify your cache timeout.
"spark.kafka.consumer.cache.timeout".
From the spark documentation:

spark.kafka.consumer.cache.timeout    - The minimum amount of time a
consumer may sit idle in the pool before it is eligible for eviction
by the evictor.

Lets say if you have multiple sinks where you are reading from kafka and you are writing it into two different locations like hdfs and hbase - then you can branch out your application logic into two writeStreams.
If the sink (Greenplum) supports batch mode of operations - then you can look at forEachBatch() function from spark structured streaming. It will allow us to reuse the same batchDF for both the operations.
Reference:
[https://spark.apache.org/docs/latest/structured-streaming-kafka-integration.html#consumer-caching]


text:
Q: Getting Path to MySQL on Apache running on Windows I've set up an Apache 2.2 and PHP 5.3 server on my Windows 7 machine. However, phpinfo() tells me that I have MySQL installed as well, but I had no clue I do. I'm having trouble finding the installation, so how can I find the path to MySQL? I know how to do so with Linux (whereis MYSQL), but what do I do with Windows?

A: If you didn't setup MySQL explicitly, and you didn't install a complete WAMP installation, you don't have MySQL. PHP just checks if the MySQL library is installed. If you try to connect, it will probably fail.

A: *

*I would check under C:\Program Files\MySql or under c:\MySql

*Also, MySql typically is configured to run on port 3306; so I would
check whether you have this port open on your local computer. How?
Just telnet to port 3306 on localhost and see if you can connect. If
you can, most likely MySQL is running on your PC and you should be
able to connect to it.

*Read the MySQL Documentation regarding this topic.


text:
Q: Third axiom of Kolmogorov axioms Let us define for a countably infinite set $S$ of real numbers that can be enumerated as $x_1,x_2,\cdots$,
$$P(S) = \sum_{x \in S}p(x) = \sum_{i=1}^\infty p(x_i) = \lim_{n \to \infty}\sum_{i=1}^n p(x_i),$$
if $\sum_{i=1}^\infty p(x_i)$ converges absolutely. Suppose we are only given
$$P(\Omega) = 1$$
for a countably infinite set $\Omega$ and $p(l) \geq 0$ for all $l \in \Omega$. Is it true that for any countable sequence $E_1, E_2, \cdots$ of disjoint subsets of $\Omega$, we must have
$$P\left(\bigcup_{i=1}^\infty E_i\right) = \sum_{i=1}^\infty P(E_i)$$
? This is the third axiom of the Kolmogorov axioms but I'm wondering if we can "replace" it with the given condition above for discrete probability spaces. I managed to only show this for a finite sequence of disjoint subsets by induction.

A: This  fails for the infinite case. Consider the following $P$ $$P(A) = \begin{cases}0 & \text{If $A$ is finite}\\
1 & \text{If $A$ is infinite}\end{cases} $$
then consider $P$ defined on the subsets of $\Bbb{N}$.
you can see that $\Bbb{N} = \cup_{n} \{n\}$ but
 $$1 = P(\Bbb{N}) = P(\cup_{n} \{n\}) \neq \sum_n P(\{n\}) = 0 $$

A: Let $\Omega$ be any set and $p:\Omega\to[0,1]$.
For any subset $A\subseteq \Omega$  define
 $$P(A)=\sup\left\{\sum_{x\in F}p(x): F\subseteq A, F\mbox{ is finite}\right\}.$$
Exercise: If $P(\Omega)=1$, then $P$ defines a probability measure on
the $\sigma$-algebra of all subsets of $\Omega.$
Is this your question? If so, let me know where you get stuck
 and I'll try to help.


text:
Q: Android - Changing order of dialogs In my application I am using a navigation drawer. When the application is launched for the first time, a dialog is shown to the user to explain the usage of navigation drawer while an activity continues to load in the background. My activity utilizes the progress dialog to show a loading message and spinner while the data is loading.
Now the issue is, when the user launches the app for the first time, the dialog for the navigation drawer opens up and the progress dialog open on top of that. Is there a way in which i can reorder the dialog placement so that the progress dialog goes behind the other dialog which is showing info of the navigation drawer?

A: Answering the original question: If you open the dialog for the explanation last (that is, call show() on it last), it will overlap the progress-dialog.

However, since you're using modern Android UI-components, might as well do it a little more "sexy":
The Android Style Guide for Application Drawers reads:

Introduce the user to the drawer at first use
Upon first launch of your app, introduce the user to the navigation drawer by automatically opening it. This ensures that users know
  about the navigation drawer and prompts them to learn about the
  structure of your app by exploring its content. Continue showing the
  drawer upon subsequent launches until the user actively expands the
  navigation drawer manually. Once you know that the user understands
  how to open the drawer, launch the app with the navigation drawer
  closed.
[...]
Give the user a quick peek
If the user touches the very left edge of the screen (within 20 dp from the left), have the drawer peek out as soon as the finger makes
  contact with the display. This promotes accidental discovery and
  provides richer feedback.

Also, a ProgressDialog should only be used for interaction-blocking background work. This includes, for example, Loggin into a service. Loading data to show on the activity should be visualized in a more subliminal way.
If you're using an ActionBar, you can use the indeterminate ProgressBar in the AcionBar, as discussed here: Showing indeterminate progress in Sherlock Action Bar
Otherwise, use a simple indeterminate ProgressBar and a "loading.."-text as a placeholder on the activity.
This way, your user sees that the app is loading data in the background, but he is also free to move to another Activity (in which case loading should continue, finish and be available when he comes back. Easily implemented with Loaders).


text:
Q: Jquery .closest() but how do i unset it on click elsewere? Gday Guys,
This is probably an elementary answer but i'm struggling to find the answer anywhere.
So i'm using the contenteditable on an  tag to edit and create content on a page i have, and i have removed any borders by the browser. So instead i'm using jquery to change the background of the <li> once my <a> tag is selected to be edited to show the user what is being  used.
Problem is i can set it using jquery on focus no problem. but once i move on to the next editable tag i'm not sure how to unset the background back to white on the last <li>?
Here the jquery im using to set it, any ideas?
$( ".list-result-edit" ).focus(function() {
    $(this).closest(".detail-list li").css("background-color", "rgb(203, 255, 207)");
});

A: You need to change the class of clicked li
This will solve our problem,
$( ".list-result-edit" ).focus(function() {

    $(".detail-list li").css("background-color","-original_color-")
    $(this).closest(".detail-list li").css("background-color", "rgb(203, 255, 207)");
});

A better solution would be to use class.
CSS :
.edit{
    background-color : rgb(203, 255, 207);
}

JS :
$( ".list-result-edit" ).focus(function() {

    $(".detail-list li.edit").removeClass('edit');
    $(this).closest(".detail-list li").addClass('edit');
});


text:
Q: Image Data Generator augmentation argument for specific folders only (Keras) I have 4 separate image folders with their own separate labels(images in folder 1 correspond to label 1 etc).
However, the image dataset is unbalanced where I have too much images with label 1 and 2 but not enough images for label 3 and 4.
As such, I decided to try to do image augmentation to boost my image dataset.
Here's how my code looks like.
train_datagen = ImageDataGenerator(rotation_range=20,width_shift_range=0.2, height_shift_range=0.2,preprocessing_function=preprocess_input,horizontal_flip=True)

train_generator=train_datagen.flow_from_directory('/trainImages',target_size=(80,80),batch_size=32,class_mode='categorical')

All the image folders are in the path "/trainImages"(e.g:"/trainImages/1","/trainImages/2")
The problem with this approach is that the augmentation is also done on images in folder 1 and 2(which do not need augmentation)
Is there a way to customize the ImageDataGenerator to ignore the image augmentation arguments for folder 1 and 2?
I'm rather new at both Python and Keras...

A: You can create two folder structures:

*

*Folder 1 - Structure containing only classes not to augment

*Folder 2 - Structure containing classes to augment

Then you create two distinct generators.
dataGen1 = ImageDataGenerator(...)
dataGen2 = ImageDataGenerator(.... withAugmentation ....)

sequencer1 = dataGen1.flow_from_directory(dir1, ....)
sequencer2 = dataGen2.flow_from_directory(dir2, ....)

Now you create your own generator, which should contain a list of indices for each of the sequencers.

This code was not tested, if there are bugs you can comment so I test it tomorrow

def myGenerator(seq1, seq2, multiplySeq2By):

    generators = [seq1,seq2]

    #here we're creating indices to get data from the generators
    len1 = len(seq1)
    len2 = len(seq2)

    indices1 = np.zeros((len1,2))
    indices2 = np.ones((len2,2))

    indices1[:,1] = np.arange(len1) #pairs like [0,0], [0,1], [0,2]....
    indices2[:,1] = np.arange(len2) #pairs like [1,0], [1,1], [1,2]....

    indices2 = [indices2] * multiplySeq2By #repeat indices2 to generate more from it
    allIndices = np.concatenate([indices1] + indices2, axis=0)

    #you can randomize the order here:
    np.random.shuffle(allIndices)

    #now we loop the indices infinitely to get data from the original generators
    while True:
        for g, el in allIndices:
            x,y = generators[g][el]
            yield x,y #when training, or "yield x" when testing

        #you may want another round of shuffling here for the next epoch.

Remember to use steps_per_epoch = len1 + (multiplySeq2By * len2)


text:
Q: Blazor data annotations error messages in a tooltip I have a blazor webassembly application. I added data annotations to my code and data validations are now displayed on top of page.
Now I have a requirement to display the validations error messages in submit tooltip.
Can anyone please help me how to show validations msgs in submit button tooltip.
Below is my code.
<EditForm Model="_product" OnValidSubmit="Submit" style="width:600px;">
        <DataAnnotationsValidator />
        <ValidationSummary />

        Name:

            <InputText id="name" class="form-control" @bind-Value="_product.Name" />

        Supplier:

            <InputText id="supplier" class="form-control" @bind-Value="_product.Supplier"/>

            <button type="submit" class="btn btn-success" data-bs-toggle="tooltip" data-bs-placement="left" title="errorMessages">
                Submit
            </button>

</EditForm>
@code {
    private string errorMessages = string.Empty;
    private Product _product = new() {};
    protected override async Task OnInitializedAsync()
    {
        await InvokeAsync(StateHasChanged);
    }

    private void Submit(){
        Console.WriteLine("Submitted");

    }
}

Below is code for Model
public class Product
    {
        [Required]
        public string Name { get; set; }
        [Required]
        [SupplierValidation(ErrorMessage = "Wrong value entered", ValidSupplierValue = "Code-Maze")]
        public string Supplier { get; set; }
    }


text:
Q: robotic arm not working with pyserial and gcode I am working on a robotic arm.
M106 is turn on the fan
M17 is stepper on
M18 is stepper off
G1 X... Y.. X.. is the coordinates of movement
the port is correct, the terminal prints the hello   hi there...
However the robotic arm is not moving, I totally have no clue why is this happening.
Is it there is some problem with my code?
import serial
import struct

def gcode_encode(gcode):
    gcode += '\r\n'
    return struct.pack(f'<{len(gcode)}s', gcode.encode(encoding='utf-8'))

print("hello")
# ser = serial.Serial('COM7', 9600, timeout=0, parity=serial.PARITY_EVEN, rtscts=1)

ser = serial.Serial()
ser.port = 'COM7'
ser.baudrate = 9600
ser.timeout = 0
ser.open()

g = gcode_encode('M106')
ser.write(b'g')

g = gcode_encode('M17')
ser.write(b'g')

g = gcode_encode('M18')
ser.write(b'g')

g = gcode_encode('G1 X0 Y120 Z120')
ser.write(b'g')

g = gcode_encode('G1 X50 Y120 Z60')
ser.write(b'g')

ser.close()

print("hi")

A: You are writing only the character 'g' to the port. If you want to write bytes of a variable g, you need to use bytes(g). The same is with f'<{len(gcode)}s', the characters in single or double quotes are not a command here, but just a string. Also you don't need packing of the string, just encoding.
Also add some pauses between commands using time.sleep().


text:
Q: Unable to display returned value from php called by ajax Here is the function.:
Where i try to call available.php and it returns an html .
I try to append that returned result on the check label.
I am getting the image but not able to see the result text.

$("button").click(function () {
    $('.check').show();
    $('.check').fadeIn(400).html(' ');

    var pincode = $("#pincode").val();

    $.ajax({
        type: "POST",
        url: "available.php",
        data: {
            'pincode': pincode
        },
        cache: false,
        success: function (result) {
            var result = result;
            if (result == '') {
                $('.check').html(' This pincode is not          valid');

                $('.check').append(result);

                $(".check").removeClass("red");
                $('.check').addClass("green");
                $(".pincode").removeClass("yellow");
                $(".pincode").addClass("white");
            }
        }
    });
});

Php code:
  <?php
   echo ' ';
  ?>

A: Your code is in the following if statement
if (result == '') {
    // all your code is here
}

and you're returning
echo ' ';

so the code never runs as it's not an empty string, it's a space, remove the if statement
and then there's
var result = result;

remove that line, it makes no sense!


text:
Q: How to unpack a DACPAC? When I right-click on a DACPAC file in windows explorer, I don't have an option to "Unpack" the file, like this document indicates:
https://learn.microsoft.com/en-us/sql/relational-databases/data-tier-applications/unpack-a-dac-package?view=sql-server-ver15
I have both Visual Studio 2019 and SSMS v18.4 installed. Am I missing something?  Right now the file is associated with Notepad.

A: I have 7-zip installed in my Windows and it recognizes the bacpac and dacpac files directly from explorer.

A: Please select "Open With..." and then choose from the list "Microsoft SQL Server DAC Package File Unpack Wizard". It should be also default association for this file type.
If you don't have this option, you can also rename this file to .zip and use any unzip tool.

A: I know two ways to import DACPAC file.
Via SQL Server Management studio:

*

*Right-click on Databases in object explorer

*Select: Deploy Data-Tier Application

*Follow the prompts

Via sqlpackage.exe utility:
Execute next command for the start import:
sqlpackage.exe /SourceFile:"w:\temp\SampleDb.dacpac" /Action:Publish /TargetServerName:"." /TargetDatabaseName:"SampleDb"

You can find more information about sqlpackage.exe parameters here.
Also:
The .dacpac file is a zip archive, and you can open it using an archiver application. This can be useful if you want to see what is in the file before importing into the database. For example: change the file extension to .zip and open in Windows Explorer.