text:
Q: "specified child already has a parent" error Sorry to make another topic on this subjcet but I've already read several of them and still don't know why I'm getting this error. I followed the "Building Your First App" tutorial on http://developer.android.com/training/basics/firstapp/index.html and then tried to modify my application to give a layout to DisplayMessageActivity Class. I've created a file called "activity_displaymessage.xml" and implemented it to the class.
I'm new to android and I'm trying to understand how this all works. What am I doing wrong?
Here is my code:
MainActivity.java
public class MainActivity extends Activity {

    public final static String EXTRA_MESSAGE = "com.example.sampleandroid.MESSAGE";

        .
        .
        .

    public void sendMessage(View view){
        Intent intent = new Intent(this, DisplayMessageActivity.class);
        EditText editText =  (EditText) findViewById(R.id.edit_message);
        String message = editText.getText().toString();
        intent.putExtra(EXTRA_MESSAGE, message);
        startActivity(intent);
    }
}

DisplayMessageActivity.java
public class DisplayMessageActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_displaymessage);

        Intent intent = getIntent();
        String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);

        TextView textview = (TextView) findViewById(R.id.text_view);
        textview.setText(message);

        setContentView(textview);
    }
}

activity_displaymessage.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:weightSum="2">

    <TextView android:id="@+id/text_view"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:textSize="30sp"/>

</LinearLayout>

A: You have two setContentView.Your layout file activity_displaymessage have already child view R.id.text_view then why are you set it as setContentView().
setContentView(R.layout.activity_displaymessage); and  setContentView(textview);
Remove this line setContentView(textview);

A: When you do a setContentView(), the view passed to it gets attached to the parent. In your case, text_view's parent is already getting set when you call

setContentView(R.layout.activity_displaymessage)

In the last line when you try to setContentView(textview), what basically happens is that the same object which u get using (TextView) findViewById(R.id.text_view) is being assigned a parent when it already has a parent. This is not allowed and hence the error.
You don't need the last line.


text:
Q: Can you find linear recurrence relation for dimensions of invariant tensors? Let $V$ be a finite dimensional highest weight representation of a (semi)-simple Lie algebra. For each $n\ge 0$ take $a_n$ to be the dimension of the space of invariant tensors in $\otimes^n V$.
In certain cases there is a formula for $a_n$. For example, for $V$ the two dimensional representation of $sl(2)$ we get $a_n=0$ if $n$ is odd and for $n$ even we get the ubiquitous Catalan numbers. In general I don't expect a formula but the sequence does satisfy a linear recurrence relation with polynomial coefficients (known as D-finite).
For example, for the seven dimensional representation of $G_2$ this sequence starts:
1, 0, 1, 1, 4, 10, 35, 120, 455, 1792, 7413, 31780, 140833, 641928, 3000361, 14338702, 69902535, 346939792, 1750071307, 8958993507, 46484716684, 244187539270, 1297395375129, 6965930587924
for more background see http://www.oeis.org/A059710
This satisfies the recurrence
$(n+5)(n+6)a_n=2(n-1)(2n+5)a_{n-1}+(n-1)(19n+18)a_{n-2}+ 14(n-1)(n-2)a_{n-3}$
Question How does one find these recurrence relations?
Then I also have a more challenging follow-up question. The space of invariant tensors in $\otimes^n V$ also has an action of the symmetric group $S_n$ and so a Frobenius character which is a symmetric function of degree $n$.
Question How does one calculate these symmetric functions?
I know these can be calculated using plethysms individually. I am hoping for something along the lines of the first question.
Further remarks David's answer solves the problem theoretically but I want to make some remarks about the practicalities. This is in case anyone wants to experiment and also because I believe there is a more efficient method.
The $sl(2)$ example can easily be extended. For the $n$-dimensional representation $a_k$ is the coefficient of $ut^k$ in
$$\frac{u-u^{-1}}{1-t\left(\frac{u^n-u^{-n}}{u-u^{-1}}\right)}$$
For the case $n=3$ see http://www.oeis.org/A005043 and
http://www.oeis.org/A099323
I am not aware of any references for $n\ge 4$. I don't know if these are algebraic.
The limitation of this method is that there is a sum over the Weyl group. This means it is impractical to implement this method for $E_8$. For the adjoint representation of $E_8$ the start of the sequence is
1 0 1 1 5 16 79 421 2674 19244 156612 1423028 14320350
(found using LiE)

A: Finding the recurrence (and proving it is correct) can be done by the standard techniques for extracting the diagonal of a rational power series.
Let $\beta_1$, $\beta_2$, ..., $\beta_N$ be the weights of $V$. Let $\rho$ be half the sum of the positive roots and $\Delta = \sum (-1)^{\ell(w)} e^{w(\rho)}$ be the Weyl denominator. Then
$$\sum_{n=0}^{\infty} t^n \chi \left( V^{\otimes n} \right) = \frac{1}{1- \sum_{i=1}^N t e^{\beta_i}}$$
and
$$\sum_{n=0}^{\infty} t^n \dim \left(  V^{\otimes n} \right)^{\mathfrak{g}} = \mbox{Coefficient of}\ e^{\rho}\ \mbox{in} \ \left( \Delta \frac{1}{1- \sum_{i=1}^N t e^{\beta_i}} \right).$$
For example, if $\mathfrak{g}=\mathfrak{sl}_2$ and $V$ is the two dimensional irrep, the right hand side is
$$ \mbox{Coefficient of}\ u \ \mbox{in} \left(  \frac{(u-u^{-1})}{1-tu^{-1} - tu} \right)$$
which can be seen without too much trouble to be the generating function for Catalan numbers.
The diagonal of a rational generating function is $D$-finite by a result of Lipshitz. The particular recurrence can be found by Sister Celine's method (see theorems 10 and 11). I found these references in Stanley, Enumerative Combinatorics Vol. II, solution to exercise 6.61. Stanley warns that there is a gap in Zeilberger's argument, but hopefully his algorithm is right.

A: The first question has a simple answer: somehow calculate the first few terms of your sequence, and feed your favorite guessing machine with them.  I advertise the one built into FriCAS (because its authors are Waldek Hebisch and myself):

(1) -> guessPRec [1, 0, 1, 1, 4, 10, 35, 120, 455, 1792, 7413, 31780, 140833, 641928, 3000361, 14338702, 69902535, 346939792, 1750071307, 8958993507, 46484716684, 244187539270, 1\
297395375129, 6965930587924]

   (1)
   [
     [
       f(n):
               2                          2
           (- n  - 17n - 72)f(n + 3) + (4n  + 30n + 44)f(n + 2)
         +
               2                             2
           (19n  + 113n + 150)f(n + 1) + (14n  + 42n + 28)f(n)
           =
           0
       ,
      f(0)= 1, f(1)= 0, f(2)= 1]
     ]
                                              Type: List(Expression(Integer))

(shameless plug: using this program, you can just as well find algebraic differential equations, algebraic recurrence relations and certain functional equations)
Martin

redpajama_set_name: RedPajamaStackExchange


text:
Q: rest API - send product translations for store-view We've setup in Magento a website with multiple store-views for translations.
The products and translations are stored in Microsoft Navision and will be transfered to Magento by using the rest API.
We're looking for an approach to send the translations (like different product names for the SKUs) from Navision to Magento by using some store-view identifier.
Is this approach working in Magento:
POST or PUT /rest/<store_code>/V1/products
default store:     /rest/default/V1/products/sku
german store-view: /rest/german/V1/products/sku
english store-view: /rest/english/V1/products/sku
Thx for help.
Regards Georg

A: yes, you got it right :) but the request is only PUT if you use the endpoint /rest/<store_code>/V1/products to create or update products. So basically you just have to adjust the store code in your request URL and keep the same SKU.
The payload can be as simple as this (SKU is not required in the payload if your product already exists):
{
  "product": {
    "name": "Joust Duffle Bag for test store"
    }
}


text:
Q: StyleCI PHP cannot disable certain fixers I'm using StyleCI to fix my code on the following repo: https://github.com/neneone/SnapeBot.
When I try to disable the braces filter, it says:
We failed to save your config. The provided fixer 'braces' cannot be disabled unless it was already enabled by your preset.

I tried to put none as preset, but it didn't work too.
Here is my StyleCI config:
preset: none

risky: false

enabled:
  ...

disabled:
  - braces
  - concat_without_spaces
  - hash_to_slash_comment
  - declare_equal_normalize
  - long_array_syntax
  - long_list_syntax
  - new_with_braces
  - yoda_style

finder:
  ...

I just want to disable that fixers cause I don't like them at all.

A: You are using preset: none, so nothing is enabled by default. You can not disable the fixer that not enabled by your preset. In another word, these fixers are already disabled.


text:
Q: Mibian options doesn't seem to work for different volatility values Python I'm working with a Python module call Mibian that calculates call and put options.
The parameters for Mibians Black-Scholes formula is as follows:
     import mibian as mb
     c =    mb.BS([Underlying Price, Strike Price interest rate, days to expiration],
            volatility).callPrice

Say I calculate a call option for AAPL (Apple.inc) stock with an underlying price of 143.14, strike price of 100, interest rate of 1%, expiration 17 days, and volatility is 19.42.
     call =  mb.BS([143.14, 100, 1, 17], 19.42).callPrice
     call

     43.186564497836812

The Ask value for AAPL is 43.50. So the two values are very close.
However, if I change the volatility to any value, unless it's extremely large, like, say 120, will it change at all. Call and put options with the Black-Scholes formula should be very sensitive to changes in volatility, but with Mibian, it hardly changes.
It's sensitive to changes in all parameters, except volatility.
     call = mb.BS([143.14, 100, 1, 17], 100).callPrice

     43.699404110772761

     #Volatility at 120.

     call = mb.BS([143.14, 100, 1, 17], 120).callPrice

     44.34924908915427

I want to be able to change only the volatility values later on in order to make a comparison between previous call and put values.
Am I missing something here, or does the Mibian equations not work properly? Hopefully I'm just being a dummy on this one. Any help on clarifying this issue? Many thanks.

A: If strike price ($100) is deep in the money by $43.14 (stock-strike)as in this case, volatility has little impact on option price. I changed the option price to $140, so the stock-strike is only $3.14, the volatility has great impact on call price.See below
call = mibian.BS([143.14, 140, 1, 17], 120).callPrice

call
  16.24

call = mibian.BS([143.14, 140, 1, 17], 20).callPrice

call
4.36


text:
Q: Conditional EventListener I was just wondering if there is a way to define conditional event listener i.e. is there a way to listen for the event only if some condition is met.
I think I am asking for an unorthodox stuff, or there is a way already exists which I am oblivious of.
Example:
Let 'lastRepeat' be an event emitted by the directive when ng-repeat ends.
app.controller('ctrl',function($scope){
  $scope.$on('lastRepeat', callback);  // Here the callback will be called every time lastRepeat event is emitted by the directive
});

But what I am looking for is something like this (This is what I have thought of, solution need not use same approach):
app.controller('ctrl',function($scope){
  function foo(){
    if(bool)
      $scope.$on('lastRepeat', callback); // Problem listening like this is that a listener is created everytime foo is called and condition is met and hence we end up having multiple listeners
  }
)};

Basically I want to avoid this multiple creation of listeners. Is there a way I can store this listener like a variable and listen only if some condition is met.

A: How about:
app.controller('ctrl', function($scope) {

  var condition = false;
  var callback = function () {};

  $scope.$on('lastRepeat', function() {
    if (!condition) return;
    callback();
  });
});


text:
Q: Django - Show foreign key value infront of form selection value in filter_horizontal selection Noob here. In my "Student" model admin I have a filter_horizontal selection form that filters a field lessons_enrolled_in.
Lessons_enrolled_in is a many to many to Lessons model which has a many to many Courses model.
In my model admin filter-horizontal I want it to select the lesson (which it does) but I want the selections to simply list  "Course name - Lesson name" instead of just "Lesson name".
Do I need a custom form for this?

A: you can define the __unicode__ method in Lesson
class Lesson(models.Model):

    ...

    def __unicode__(self):
        return "{} - {}".format(self.course.name, self.name)

or define your own form or form template as described here stackoverflow.com/a/10041463/2028375


text:
Q: Lawson's Spin Geometry book - pieces that do not fit

This is from Lawson's book "Spin Geometry", there is a problem here, there are pieces that do not fit.
In (4.3) and (4.4) shows how to construct the operator Q from P and its symbol. For that, the expansion of the symbol of the composition of operators of Theorem 3.10 is used.
But in the hypotheses of Theorem 3.10 it is necessary that both operators P and Q have support on a compact set K, that is, P and Q are in $\Psi DO_{K,m}$. The problem here is that neither P nor Q have it since their symbol is invertible, and if they were in $\Psi DO_{K,m}$ it would imply that the symbol of P has compact support contained in K and that contradicts the invertibility of the symbol. For that Lawson tries to fix it by considering equivalents P $1$-local and Q $1$-local, but that an operator is $1$-local does not imply that it is in $\Psi DO_{K,m}$.
That's why here there are pieces that don't fit. First, he proves Theorem 3.10 only for supported operators on a compact set K and then he drops the support hypothesis and uses them freely.


text:
Q: How to get a lvalue reference to a bit in std::bitset I was trying to do the following:
std::bitset<2000> a_bit_set{};
auto& a_bit = a_bit_set[5];
if (complicated_predicate(a_bit, other_params))
{
  a_bit.flip();
}

but clang complains:
non-const lvalue reference to type 'std::bitset<2000>::reference' cannot bind to a temporary of type 'std::bitset<2000>::reference'

I am suspecting this is because the operator[] is returning a rvalue rather than a lvalue here. But according to cppreference, there is a special class std::bitset<>::reference that should allow me to reference a particular bit in a bitset. My question is: Can I get a lvalue reference to a particular bit in a bitset (akastd::bitset<>::reference)?

A:
How to get a lvalue reference to a bit in std::bitset

You don't. std::bitset doesn't contain any objects that represent an individual bit, and thus you cannot have a reference to such object.

aka std::bitset<>::reference

std::bitset<>::reference isn't an lvalue reference. It is an object - a reference wrapper. The subscript operator returns that object as a prvalue. You can simply use a copy of that reference wrapper like this:
auto a_bit = a_bit_set[5];

Or you can use an rvalue reference which extends the lifetime of the prvalue:
auto&& a_bit = a_bit_set[5];

I wouldn't use the latter in this example since it introduces unnecessary complexity. But it can potentially be useful in some other cases that involve templates with a reference alias that may be either a true reference or a reference wrapper depending on template arguments.


text:
Q: Excel VBA: Validating a cell's value after changing it I have a function that updates a range of cells to a certain value after the user changes one cell to this value. However the cells in this range do not share the same validation range so I would like to do separate validation for each cell updated.
Here's what I have so far. For each cell, the data validation is set to its own validation range with acceptable values. For some reason the validation holds true even though the data is not in the validation range. I'm not too sure how the validation.value property works..
For index = 1 to UBound(someArray)
    wksSomeSheet.Cells(index, column).Value = requiredValue
    If Not wksSomeSheet.Cells(index, column).Validation.Value Then
        MsgBox "A value is not supported for one the cells."
        Exit For
    End If
Next

Or should I implement it so that I use the Range("validationRange").find(requiredValue) instead?

A: After having looked at Siddharth's blog, I made some minimal changes to his code to adapt it to my needs:
Dim currentValidation As Excel.Validation
wksSomeSheet.Cells(index, Target.Column).Value = requiredValue

Set currentValidation = wksSomeSheet.Cells(index, Target.Column).Validation
If currentValidation.Type = xlValidateList Then
    Dim validationFound As Boolean, MyArray As Variant
    validationFound = False
    MyArray = Application.WorksheetFunction.Transpose(Range(Mid(currentValidation.Formula1, 1)))
    For i = 1 To UBound(MyArray)
        If requiredValue = MyArray(i, 1) Then
            validationFound = True
            Exit For
        End If
    Next

    If Not validationFound Then
        MsgBox wksSomeSheet.Cells(index, wksSomeSheet.Range("myRange").Column).Value & " does not have a valid value."
        Exit For
    End If
End If


text:
Q: Passing multiple inputs to CNN model I have vector of integers representing each character in the domain name and another vector of integers representing the timeline information. I need to give both these vectors as input to a CNN model to classify domain names as good or spam.
For instance,
Vector representing domain name -> 1 x 75 vector. Each element in the vector represents each character in the domain name. If there are 1000 domain names, then it will be a matrix of shape 1000 x 75
Vector representing timeline information -> 1 x 1440 vector. Each element representing number of mails sent from a particular domain for each minute. If there are 1000 domain names, then it will be a matrix of shape 1000 x 1440
How do I input these two vectors to a single CNN model?
My current model is given only the domain name as input,
def build_model(max_features, maxlen):
"""Build CNN model"""
model = Sequential()
model.add(Embedding(max_features, 8, input_length=maxlen))
model.add(Convolution1D(6, 4, border_mode='same'))
model.add(Convolution1D(4, 4, border_mode='same'))
model.add(Convolution1D(2, 4, border_mode='same'))
model.add(Flatten())
#model.add(Dropout(0.2))
#model.add(Dense(2,activation='sigmoid'))
#model.add(Dense(180,activation='sigmoid'))
#model.add(Dropout(0.2))
model.add(Dense(2,activation='softmax'))
sgd = optimizers.SGD(lr=0.001, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['categorical_accuracy', 'f1score', 'precision', 'recall'])

Thanks!

A:
In convolutions, you need a "length" dimension and a "channels" dimension.

(In 2D, they would be "width", "height" and "channels").
Now, I can't think of any way to relate the 75 characters with the 1440 minutes. (Maybe you can, and if you can state how, maybe we can work better)
Here is what I'm assuming:

*

*A sequence for the domain name, containing length 75.

*The domain name will have 8 channels (since your embedding layer has 8 outputs)

*Another sequence for the 1440 minutes.

*Only one channel for the e-mails per minute

So, we'd have two inputs:
from keras.layers import *

input1 = Input((75,))
input2 = Input((1440,))

Only the domain name should pass through an embedding layer:
name = Embedding(max_features, 8, input_length=maxlen)(input1)

Now, reshaping to fit the convolutional inputs (None,length,channels).
# the embedding output is already (Batch, 75, 8) -- See: https://keras.io/layers/embeddings/

mails = Reshape((1440,1))(input2) #adding 1 channel at the end

Parallel convolutions:
name = Conv1D( feel free to customize )(name)
name = Conv1D( feel free to customize )(name)

mails = Conv1D( feel free to customize )(mails)
mails = Conv1D( feel free to customize )(mails)

Concatenate - Since they have totally different shapes, maybe we should simply flatten both (or you could think of fancy operations to match them)
name = Flatten()(name)
mails = Flatten()(mails)
out = Concatenate()([name,mails])

out = add your extra layers

out = Dense(2,activation='softmax')(out)

And finally we create the model:
from keras.models import Model
model = Model([input1,input2], out)

Train it like this:
model.fit([xName,xMails], Y, ....)

A: You could build a multi-input network using Keras' functional API. Have a 1D convolution network separately for each input dimensions. Then concatenate the output of each of these networks and pass that concatenated vector into some shared fully-connected layers which sit on top of both of the other networks.
https://keras.io/getting-started/functional-api-guide/#multi-input-and-multi-output-models


text:
Q: Mac or Macintosh Commercially speaking they are the same, as stated by Wikipedia, but what should be the correct way to name our precious personal devices?

A: Im pretty sure Mac is the preferred term now, and usually when they are being discussed, the type of Mac is usually mentioned (iMac, Mac Pro, etc). Professionally they are usually addressed as Macs vs Macintosh as well. Either way you would be right.
Though, on some of the newest packaging, my new iMac box said 'Apple Macintosh' on it. And in some of the paperwork, they use Macintosh and Mac interchangeably.

A: The  Menu says "About this Mac", but the default name for the primary drive installed in the machine is "Macintosh HD" (even on machines with SSDs), so Apple hasn't completely done away with the term "Macintosh".

A: In the October 4, 2011 Special Event, Apple CEO Tim Cook introduced the sales figures for computers by calling it the Macintosh (source: http://www.apple.com/apple-events/october-2011/). He subsequently referred to it as the Mac, but if the company CEO still uses the term "Macintosh" I'd say the name is not defunct.

A: Mac or Macintosh are the same thing. I've got a Mac Computer or I've got a Macintosh Computer are the same. As long as you don't use MAC instead of Mac. You can also say I've got an Apple computer.

A: Apple no longer calls them Macintosh, just "Mac" for the entire range of devices, and "iMac" "MacBook", "Mac Mini" etc for the specific devices. So, unless you're talking about an old model that actually has "Macintosh" in the name, I'd say "Mac" is to be preferred.

A: I have noticed for many years that people who do not own or use a Macintosh (and aren't quite sure what one is) refer to them as a "MAC" in all capital letters, whereas people who actually use one always refer to it as "Mac".
This is an easy way to tell whether or not the person whose article or post you are reading has any idea about what they are saying.
"MAC", on the other hand, is an acronym for "Machine Access Code address" and refers to the unique hardware identifier of every Ethernet and WiFi network card in the world. So every (networked) computing device has its own MAC whether it's a PC, a Mac, an iPhone, or something else.


text:
Q: How to know which version will be installed? If I use "go get ./..." for installing dependencies How is the "go get ./..." command working?
Which version will be installed per package? Is it up to dated?
I know If I use "go mod" then I can manage specific version.
But I'm just wondering How it be working if I just use "go get ./..."

A: If you only want to use go get, then there is no direct way.
go get always pulls from the HEAD of the default branch in the repository.
For go get, there is no such thing as multiple versions of a Go package.
So you have to use dep Or go mod for managing pkg versions.
Also there is http://labix.org/gopkg.in which is one way of managing versions. It simply redirects you to the actual repo and doesn't host code.


text:
Q: Randomly show three different questions per page load I'm not sure where to start on this one, looking for a push in the right direction. I'm using C#. I need to display three questions to a user but the kicker is I need those questions to be randomly picked and displayed on each page load. I can use MS SQL if your solution deems it to be the easiest method.
I have a list of 10 questions I want three to show at a time and have them randomly picked. What is the best way to do this?
It currently is setup like this..

 <asp:CheckBox ID="QuesChk1" Value="1" Text="What street do they live on?"
        runat="server" />

 <asp:CheckBox ID="QuesChk2" Value="2" Text="What is their middle name?"
        runat="server" />

 <asp:CheckBox ID="QuesChk3" Value="3" Text="What branch do they visit the most?"
        runat="server" />

    <asp:Button ID="Button1" OnClick="Next_Click" runat="server" Text="Next" />

A: You could always do something like this:
SELECT TOP 3 * FROM QuestionsTable ORDER BY NEWID()

See here for an explanation of how it works: "order by newid()" - how does it work?

A: Use a randomly-sorted SQL query:
SELECT * FROM QuestionsTable ORDER BY RAND() LIMIT 3

A: It sounds like Random maybe what you are looking for. In particular, you should take a look at the Random.Next(int maxValue) method.
If I had to do something like this, I would have a collection of the questions and use the above mentioned function to grab random questions. You will have to solve the issue with picking the same question, though.

A: If you don't want to use database and you have all the 10 questions fixed use viewstate
something like
ViewState["Questions"] = new List<string>();

and add questions to it
Then have one more viewstate to check if the order you are getting is not the last order
ViewState["LastOrder"] = new List<int>(){1,2,3};

Then generate random orders until it is not the last one
int firstIndex, secondIndex, thirdIndex;
var lastOrder = (List<int>)ViewState["LastOrder"];

Random r = new Random(lastOrder[0] + lastOrder[1] + lastOrder[2]);

while(firstIndex == lastOrder[0])
   firstIndex = r.Next(1, 10);

while(secondIndex == lastOrder[1] || secondIndex == firstIndex)
   secondIndex = r.Next(1, 10);

while(thirdIndex == lastOrder[2] || thirdIndex == firstIndex || thirdIndex == secondIndex)
   thirdIndex = r.Next(1, 10);

// update current index as last index
ViewState["LastOrder"] = new List<int>(){firstIndex, secondIndex, thirdIndex};

After this you will be having the random non repeating three questions order

A: If you don't have many questions, and they will remain static it may be overkill to have a whole database installed.
You can have an ArrayList on Strings (or a more complex object containing an ID and String) and utilize a random function three times to select 3 different elements.
Ofcourse, you would have to verify you don't select the same question.
What you do after depends on if you want to store the answers.

A: If you are very particular about getting 3 random non repeated question then you can try :
In you SQL Table where you have the questions, you must have an ID field associated to them if not then create one, now since you have 10 question the ID's would be between 1- 10.
Now in you c# code you can create Method which will get :
Random random = new Random();
int randomNumber = random.Next(1, 10);

Now build a SQL query "Select * from tab where ID = randomNumer" (for first question).
Store the randomNumber in a temp array or List (for comparing purpose) and again call the same method and compare it with the existing number (you can simple do it by using Contains() method which returns bool) if its not similar then add it to the array and continue with publishing this question.
You'll have to keep a track of array/List size (if < 3 then proceed else exit).
This must workout for you, I have created a entrance test for a company using the same algorithm, unfortunately not able to find the code.
Good Luck


text:
Q: Pass Multiple Arguments to Callback for a StringVar in Tkinter I am working with a small grid of Entry widgets.  It could be 5 x 1 or 5 x 5 or other sizes in between or near those sizes.  When data is entered into an Entry widget, I'd like to be able to pass this on, eventually, to a 2D array of str() variables.
The problem is if I have a number of StringVar() variables, when I use StringVar.trace(), is there a way to pass extra arguments to the callback function?
I currently have:
import Tkinter
guiRoot = Tkinter.Tk()
hWindow = Tkinter.Frame(guiRoot)
hWindow.grid();

def callback(*args):
    print "Current value:",sv.get()

sv = Tkinter.StringVar()
sv.trace("w", callback)
Tkinter.Entry(hWindow, textvariable=sv).grid(row=1,column=1)
guiRoot.mainloop()

But I'd like to pass on to the callback an X and Y coordinate as well.  Is that possible?
And if I can do it with a callback for a StringVar, can I do it for an Entry widget?
And if I do it with an Entry widget, is there a way I can pass the event to the callback (along with the X and Y info, too) through to the callback function?
In other words, is there some way I can have:
def callback(*args):
    print "Array coordinates of Entry (or Stringvar):",x,y
    print "Current value:",sv.get

(Yes, I know I'd have to have some way to reference x and y in that callback - so I'd need to know how to do that, too.)

A: Yes, you can add whatever arguments you want.
def callback(x,y,*args):
    print "x:", x, "y:", y
    print "args:", args
...
sv.trace("w", lambda name1, name2, op, x=100, y=200: callback(x,y,name1,name2,op))


text: Q: Can we use OkHttp lib in Java embedded ME environment? I like to know if IoT Development Platform of Qualcomm supports OkHttp, which runs in Java Embedded ME. If it does't support Okhttp, kindly suggest any other lib that support Http/2 in Java Embedded ME platform.


text:
Q: compile and publish only one .cs file i have a Visual studio project. it has .aspx, .aspx.cs, config, dlls and so on...
Regularly what i follow for loading a gui on the server is:

*

*build the solution

*publish the solution (so i get the published files of the project excluding .cs files) this makes sense as i dont want to give my backend code.

*finally i run the gui on the browser.

This works perfectly fine.
But now i have to make a change in .cs file of one of the pages.
do i have to build the solution and publish all the files?? how can i just give the file i made the changes in.
I ask this because it does not look good to a client...
any suggestions?? thanks

A: If you make a code change you should republish the site.   Bear in mind that you can just publish the newly compiled assembly itself and not all of the aspx files.
However, I don't recommend doing this as the time to deploy an entire site isn't particularly large and you might have made a change to an aspx and forgotten between deployments.  It's much better to send the whole thing.
Also, this isn't a normal thing for a client to have a problem with.  Tell the client this helps ensure robustness of the deployment.  After all, if you made a code change in a language like PHP and deployed that single file then you don't get compile time checking and stupid problems like misnamed variables might not show up for awhile or might crater the whole site.
IMHO, it's much better to get the full compile time checks out of the way BEFORE the site is pushed.  Of course, this does little to nothing for runtime problems.. but that's a problem you have no matter the language.

A: C# doesn't have .obj and linker like c++, so if you change one file and want to integrate it in your project, you should compile it in related project (just changed files going to be compiled), also for file compile option see this: http://msdn.microsoft.com/en-us/library/78f4aasd%28VS.80%29.aspx


text:
Q: ExecuteOrDelayUntillScriptLoaded(codetorun,SP.js) for entire script function If you look at below code, I have used executeordelayuntillscriptloaded at start of my script so that it will run only after that file is loaded. But this breaks some functionality. Can you check this code and tell me if its not good practice?
It was done so that the SP.Utilities.Utility.getLayoutsPageUrl functionality never throw undefined error:
 <SharePoint:ScriptLink ID="ScriptLink1" name="SP.js" runat="server"
    ondemand="false" localizable="false" loadafterui="true" />
<SharePoint:ScriptLink ID="ScriptLink2" name="SP.UserProfiles.js" runat="server"
    ondemand="false" localizable="false" loadafterui="true" />

<script type="text/javascript">
SP.SOD.executeOrDelayUntilScriptLoaded(runthiscode, 'SP.js');

function runthiscode()
{
    var personProperties;

    // Ensure that the SP.UserProfiles.js file is loaded before the custom code runs.

    SP.SOD.executeOrDelayUntilScriptLoaded(getUserProperties, 'SP.UserProfiles.js');

    function getUserProperties() {

        // Get the current client context and PeopleManager instance.
        var clientContext = new SP.ClientContext.get_current();
        var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);

        // Get user properties for the target user.
        // To get the PersonProperties object for the current user, use the
        // getMyProperties method.
        personProperties = peopleManager.getMyProperties();

        // Load the PersonProperties object and send the request.
        clientContext.load(personProperties);
        clientContext.executeQueryAsync(onRequestSuccess, onRequestFail);
    }

    // This function runs if the executeQueryAsync call succeeds.
    function onRequestSuccess() {

        if (personProperties.get_userProfileProperties().CustomPropertyValue == "False") {

          window.location(SP.Utilities.Utility.getLayoutsPageUrl('')+'someurl.aspx');

        }

    }

    // This function runs if the executeQueryAsync call fails.
    function onRequestFail(sender, args) {
        var r = confirm("There was an error, the page will reload");

              window.location(SP.Utilities.Utility.getLayoutsPageUrl('')+'someurl.aspx');
    }

 function someotherfunction() {

        window.location.href = SP.Utilities.Utility.getLayoutsPageUrl('')+'someotherurl';

    }
}
</script>

A: Prefer SP.SOD.executeFunc over SP.SOD.executeOrDelayUntilScriptLoaded
Since SP.SOD.executeFunc supports load on demand scripts, there is no need to reference explicitly  SP JavaScript files using SharePoint:ScriptLink
The following example demonstrates how to initialize UserProfiles CSOM in application page:
SP.SOD.executeFunc('SP.js', 'SP.ClientContext', function() {
   // Make sure PeopleManager is available
   SP.SOD.executeFunc('userprofile', 'SP.UserProfiles.PeopleManager', function() {

      var clientContext = new SP.ClientContext.get_current();
      var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);

      //...

   });

});

Usage of SP.Utilities.Utility.getLayoutsPageUrl
SP.Utilities.Utility.getLayoutsPageUrl(pageName) Method accepts pageName as a parameter.
Example: how to get Settings page url
var pageUrl = SP.Utilities.Utility.getLayoutsPageUrl("Settings.aspx");

A: It is not necessary to use the SP.SOD.executeFunc function to declare a dependency with an unwieldy callback function.
Instead you should just register a dependency for the function you are calling using the RegisterSodDep function.
For the original example:
RegisterSodDep('runthiscode', 'sp.js');
RegisterSodDep('runthiscode', 'SP.UserProfiles.js');
SP.SOD.executeFunc('SP.UserProfiles.js', null, runthiscode);

runthiscode will not be called until the two dependencies have been loaded.

A: Use SP.SOD.executeFunc('sp.js','SP.ClientContext',runthiscode); instead of SP.SOD.executeOrDelayUntilScriptLoaded. because SP.SOD.executefunc makes sure the file is loaded and then executes the method and SP.SOD.executeOrDelayUntilScriptLoaded will only put the method on queue untill the file is loaded(so if file is not loaded then never executes).
    SP.SOD.executeFunc loads on demand scripts, so script link should be added for that js file.
<SharePoint:ScriptLink ID="ScriptLink2" name="SP.UserProfiles.js" runat="server"
    ondemand="false" localizable="false" loadafterui="true" />
     <script type="text/javascript">
        SP.SOD.executeFunc('sp.js','SP.ClientContext',runthiscode);
        function runthiscode()
        {

                // Ensure that the SP.UserProfiles.js file is loaded before the custom code runs.
                SP.SOD.executeFunc('SP.UserProfiles.js','SP.UserProfiles',getUserProperties);
       }
        var personProperties;
            function getUserProperties() {

                // Get the current client context and PeopleManager instance.
                var clientContext = new SP.ClientContext.get_current();
                var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);

                // Get user properties for the target user.
                // To get the PersonProperties object for the current user, use the
                // getMyProperties method.
                personProperties = peopleManager.getMyProperties();

                // Load the PersonProperties object and send the request.
                clientContext.load(personProperties);
                clientContext.executeQueryAsync(onRequestSuccess, onRequestFail);
            }

            // This function runs if the executeQueryAsync call succeeds.
            function onRequestSuccess() {

                if (personProperties.get_userProfileProperties().CustomPropertyValue == "False") {

                  window.location(SP.Utilities.Utility.getLayoutsPageUrl('someurl.aspx');

                }

            }

            // This function runs if the executeQueryAsync call fails.
            function onRequestFail(sender, args) {
                var r = confirm("There was an error, the page will reload");

                      window.location(SP.Utilities.Utility.getLayoutsPageUrl('someurl.aspx');
            }

        </script>


text:
Q: MySQL Dynamic Table issue Every month we get a CSV file that contains 300+ columns. The layout of the file can change whenever, and columns can be added/removed. I'm in need of a way to create a dynamic table that contains the exact number of columns needed. I don't care about column names, they can be Column1, Column2, etc.. and I plan to set all types to Varchar(500).
Ideally what I would I want to accomplish is a stored procedure that I can simply pass in the number of columns needed and it will loop to create the necessary Table Definition sql and then execute that sql.
Is accomplishing this even possible? I had started to write the following:
BEGIN
Declare loopvar int default 1;
Declare tsql VarChar(5000);
Declare table_definition VarChar(8000);
Declare tablename varchar(20);
Set table_definition = 'Column';
set tablename = 'npi_data';
Set loopvar = 1;
While loopVar < 362 DO
  set tsql = table_definition + loopvar + 'varchar(500) DEFAULT NULL' ;
  set loopvar = loopvar + 1;
end while;
 set tsql = 'CREATE TABLE' + tablename + '(' + tsql + ') ENGINE=InnoDB DEFAULT CHARSET=utf8';
 execute tsql;
END;

I'd like something close to that but all I really need is the ability to create a table with any given number of columns.
Thanks!

A: If you mean you want to be able to pass a list of column names, like 'A,B,C', and use it to generate a list of column definitions, like A varchar(500) DEFAULT NULL,B varchar(500) DEFAULT NULL,C varchar(500) DEFAULT NULL and, eventually, a CREATE TABLE statement with that definition list, you could use an approach like this:
...
SET columnnames = 'A,B,C';
SET sql = CONCAT(
  REPLACE(columnnames, ',', ' varchar(500) DEFAULT NULL,'),
  ' varchar(500) DEFAULT NULL'
);
SET sql = CONCAT('CREATE TABLE ', tablename, ' (', sql, ')');
...

That is, every comma in the name list is expanded so as to complete the definition of the column preceding the comma. As the last item isn't followed by a comma, the type is simply concatenated one more time to the result of REPLACE.
Alternatively, to avoid the repetition of the varchar(500) DEFAULT NULL bit, you could do this:
...
SET columnnames = 'A,B,C';
SET sql = REPLACE(CONCAT(columnnames, ','), ',', ' varchar(500) DEFAULT NULL,');
SET sql = LEFT(sql, LENGTH(sql) - 1);
SET sql = CONCAT('CREATE TABLE ', tablename, ' (', sql, ')');
...

In this case, a comma is added after the last name, then all commas in the resulting string are replaced like in the previous examples. As a final touch to the list, the trailing comma is removed and finally the complete statement is built.
Either way, no loop is needed.


text:
Q: Using svn_wc in jruby rake task for Windows I am trying to write a rake task in my Ruby on rails project to do checkout from my SVN repository.
I used svn_wc gem file but i get the following error:
LoadError: no such file to load -- svn/core

I am using Windows PC. Pls suggest me steps to write a rake task for windows environment using this gem
Or
Is there any alternative gem file?
Thanks

A: svn_wc requires the svn ruby bindings -- I'd install the windows svn command line and language bindings http://sourceforge.net/projects/win32svn/files/1.7.4/
That being said I don't know if those bindings work with Jruby


text:
Q: List Arrary Double[] entering values Using the examples below the 2nd part I see how to add values to a single dim array.  But the 2 dim array I dont yet understand.  In the 1st example the 1,2,3 I need to get from a database. The DB part I have figured out but how to put in the values I dont know.
If I was using an array it would be
myarray[row][column] = value;

so how do I do this with the List?
mylist.add --- something?
    List<double []> // creates a list that stores arrays of doubles.

List<double []> myList = new ArrayList<Double>();
myList.add(new double [] {1,2,3});
myList.add(new double [] {4,5,6});

List<Double> myList = new ArrayList<Double>();
myList.add(1);
myList.add(2);
myList.add(3);

A: List<T> myList = new ArrayList<T>();

T should be same. If T is double[] then it should be new ArrayList<double[]>()
then get(index) which is double array and get(index)[j] which is value. same logic        with

d[i][j] = get(index)[j]

List<double []> myList = new ArrayList<double[]>();
myList.add(new double [] {1,2,3});
myList.add(new double [] {4,5,6});

System.out.println(myList.get(0)[1]);

A: If you're talking about just doing inline initialization of a multidimensional array, I'm pretty sure you just use subsetted braces, like so:
Double array2D[][] = {
    {1, 2, 3},
    {4, 5, 6},
    {7, 8, 9}
    };

A: Do you want a collection-based solution for two-dimensional arrays? If so, then you're looking for a list of lists.
//Declaration
List<List<double[]>> twoDimList = new ArrayList<List<double>>();

//Adding values
twoDimList.add(new ArrayList<double>(1));
twoDimList.add(new ArrayList<double>(2));
twoDimList.add(new ArrayList<double>(3));

//Retrieving values
double value = twoDimList.get(1).get(1); //returns 1

A: You should avoid using arrays as generic type parameters as you can easily end up with "unchecked" warnings. Use collections (typically ArrayList) instead.
So instead of this:
List<double []> // creates a list that stores arrays of doubles.

List<double []> myList = new ArrayList<Double>();
myList.add(new double [] {1,2,3});
myList.add(new double [] {4,5,6});

Do something like this:
List<List<Double>> myList = new ArrayList<List<Double>>();
myList.add(new ArrayList<Double>());
myList.add(new ArrayList<Double>());
myList.get(0).add(1);
myList.get(0).add(2);
myList.get(0).add(3);

Or to initialize together, you'd probably do something like:
List<List<Double>> myList = new ArrayList<List<Double>>();

List<Double> nested;

nested = new ArrayList<Double>();
nested.add(1);
nested.add(2);
nested.add(3);
myList.add(nested);

nested = new ArrayList<Double>();
nested.add(4);
nested.add(5);
nested.add(6);
myList.add(nested);

(You can add nested to myList before or after adding the elements to nested -- either way works so do whatever is clearer to you.)
To retrieve a specific element:
double value = myList.get(x).get(y);

To set a specific element:
myList.get(x).set(y, value);

This assumes that the list are already the right size, and that you just want to change the value of an existing element. (In other words, just like set behaves on a simple List.)


text:
Q: How to remove extra white background in buttons after using AppCompat Theme? TL;DR;
How to remove the below unwanted white area?

I tried to change my theme which extends "Theme.AppCompat.Light.NoActionBar" and added my own customization.
After using the theme, all "pop-up" buttons have an extra white background like above screenshot:

*

*How to remove those extra white area?

*What xml attributes are controlling this?
styles.xml
<style name="MyCustomTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="colorAccent">@color/accent</item>
    <item name="android:textColorSecondary">@color/secondary_text</item>
    <item name="android:alertDialogTheme">@style/CustomAppCompatAlertDialogStyle</item>
    <item name="android:actionBarStyle">@style/CustomActionBarStyle</item>
</style>


text:
Q: How to split a string with , in jquery? I am working on webapi actually I need to split a string here I am getting data from controlers  from data I had separated data like Menus and subMenus.
Like I am getting data
  MenuName:  "Home" "product" "setting" "orders" "contact " "Profile"

  SubMenus for Product:
                       "viewProduct,Addproduct,searchProduct";

Here I need to split the submenus but the menus are not splitted. I don't know what's  wrong.
Here is my code:
var Url = "/api/MenuItem";
(function($) {
    $.buildMenu = function(MenuId, CurrentPage) {
        $.getJSON(Url, function(data) {
            alert(data);
            var item = data;
            $.each(data, function(k, v) {
                var MenuItems = [];
                MenuItems = v.MenuName;
                alert(MenuItems);

                var subitems = [];
                subitems = v.SubMenUs;
                alert(subitems);

                var spltting = [];
                var splitteditems = [];
                spltting = subitems[0];
                splitteditems = spltting.split(',');
                alert(spltting.count());
                alert(spltting.toString());
                var count = new Array();
                for (var n = 0; n < splitteditems.length; n++) {
                    count.push(parseInt(splitteditems[n]));
                }
            });
            alert(item.toString());
            $('.' + MenuId).append("
");

            for (var i = 0; i < item.length; i++) {
                if (CurrentPage == item[i].MenuName)
                    $('.' + MenuId).append("
" +
                        item[i].MenuName + "
"
                    );
                else
                    $('.' + MenuId).append("
 " +
                        item[i].MenuName + "
"
                    );
            }
        });
    }
})(jQuery);

I need to split the subMenus and need to append to nested list.

A: jQuery is JavaScript, so this can be accomplished using the JavaScript String.split(",") method.


text:
Q: Which finite groups are not the automorphism group of some rooted finite tree? The question is as given in the title:

Which finite groups are not the automorphism group of some rooted finite tree?

A rephrasing could be: Is any finite group representable as the automorphism group of a finite tree? If not, what is typically unrepresentable?
In case of ambiguity:
a homomorphism of finite rooted trees must preserved the root, and so does an isomorphism which is called an automorphism.
Context:
The motivation/spirit of the question is as follows. I make the isomorphism classes of finite graphs smaller by specifying a group acting on the graph's vertices, that is an isomorphism must now respect the group action (instead of the bigger $S(n)$ action).
Do I lose something by restricting myself to tree automorphisms instead of considering the group action?

A: If I remember correctly, the automorphism groups of trees are those groups which you can make from symmetric groups by direct products and wreath products.  This is rather few groups.
An example of a group not occurring would be a nontrivial group with no subgroup of index 2. All simple groups from $Z_3$ upwards, for example.
ADDED: An application of the constructive characterization is that a positive integer is the order of the group of a tree iff it is a product of factorials. So there are no odd numbers, only 2 and 6 as twice an odd number, etc..  Apparently these are called the Jordan-Polya numbers.
For homework, which groups have one of the allowed orders but still aren't groups of trees?


text:
Q: BigQuery: split string with repetitive pattern to separate rows I have a string with repetitive pattern like: timestampField: <SOME_INT_VALUE> url: <SOME_STRING_VALUE>. As you can see in the example, this pattern returns multiple (4 in this example) times.
SELECT my_string
FROM (SELECT 'timestampField: 1595351350 url: domainZ/aaaabbbbccccdddd timestampField: 1595351355 url: domainZ/eeeeffffgggghhhh timestampField: 1595351355 url: domainZ/iiiijjjjkkkkllll timestampField: 1595351356 url: domainZ/mmmmnnnnppppoooo' as my_string)

I want to break this big string into 4 (in this example) different rows, each row will have a string value

*

*timestampField: 1595351350 url: domainZ/aaaabbbbccccdddd

*timestampField: 1595351355 url: domainZ/eeeeffffgggghhhh

*timestampField: 1595351355 url: domainZ/iiiijjjjkkkkllll

*timestampField: 1595351356 url: domainZ/mmmmnnnnppppoooo

A: Below is for BigQuery Standard SQL
one of simple ways is to use SPLIT as below
#standardSQL
SELECT 'timestampField:' || v AS part
FROM `project.dataset.table`,
UNNEST(SPLIT(my_string, 'timestampField:')) v
WHERE NOT v = ''

If to apply to sample data from your question - out put is
Row part
1   timestampField: 1595351350 url: domainZ/aaaabbbbccccdddd
2   timestampField: 1595351355 url: domainZ/eeeeffffgggghhhh
3   timestampField: 1595351355 url: domainZ/iiiijjjjkkkkllll
4   timestampField: 1595351356 url: domainZ/mmmmnnnnppppoooo

Another option using regexp with the same output
#standardSQL
SELECT part
FROM `project.dataset.table`,
UNNEST(REGEXP_EXTRACT_ALL(my_string, r'timestampField: [^ ]* url: [^ ]*')) part


text:
Q: what is keyword If Page.IsPostBack how can use it What is this keyword how can use it?
If Page.IsPostBack = False Then

A: IsPostBack
Here is an overview of IsPostBack from MSDN:
http://msdn.microsoft.com/en-us/library/system.web.ui.page.ispostback.aspx
It quotes:

true if the page is being loaded in
  response to a client postback;
  otherwise, false.

The postback is useful, say for example you have a Literal control on the page, and the code on page load sets the Literal.text += "hello";  If you have a button on that page, and press it, the text of the literal will get longer and longer, hellohellowhello, if you wrap the code in (c# example):
if(!Page.IsPostBack){
    Literal.text += "hello";
}

The Literal text now wont expand when the button is pressed.
Other Notes
Instead of:
If(Page.IsPostBack = False)

Do:
If(!Page.IsPostBack)

This is logically the same and is generally accepted to be a better way of writing the statement.
Also you marked the question C#, but the If syntax you used indicates you are writing it in VB.net, not C#.

A: Gets a value indicating whether the page is being loaded in response to a client postback, or if it is being loaded and accessed for the first time.
Return Values:
true if the page is being loaded in response to a client postback; otherwise, false.
http://msdn.microsoft.com/en-us/library/system.web.ui.page.ispostback.aspx

A: The IsPostBack tells you whether or not the page has been Posted Back, meaning "server side" button has been clicked.
You can "use" it by reading its value and acting upon it.
It's useful for example when you add controls dynamically to your page, so you don't have to add them when it's a PostBack.
Official documentation already been posted by others, look there for any further or technical details.


text:
Q: Selecting data of a certain value I have a table called customers, with a field called telnumber.
The telnumber contains a telephone number, but does have some invalid data.  So I want to select data from the customer table, field telnumber where the value is between 9 and 11 in length and is numeric.

A: This should return only records that have length between 9 and 11 AND are numeric.
SELECT * FROM customers
WHERE LENGTH(telnumber) BETWEEN 9 AND 11
AND telnumber REGEXP '^[0-9]+$'

A: Your requirement of 9 and 11 in length and is numeric means that you automatically reject any common "phone number punctuation" such as dashes, spaces and parentheses. Your telnumber field may actually contain properly "punctuated" telephone numbers. I think a more complete solution would use MySQL's RegEx to test for valid phone numbers.
Here's another SO question/answer to get you started and perhaps thinking of alternatives.

A: SELECT
  *
FROM customers c
WHERE LENGTH(c.telnumber) BETWEEN 9 AND 11
  AND c.telnumber REGEXP '^[0-9]+$'

OR
SELECT
   *
FROM customers c
WHERE LENGTH(c.telnumber) >=9 AND LENGTH(c.telnumber) <= 11
   AND c.telnumber REGEXP '^[0-9]+$'

A: If we take a look here and use LENGTH(), a simple query would look something like this:
SELECT * FROM customers WHERE (LENGTH(telnumber) > 9) AND (LENGTH(telnumber) < 11)
This can be expanded to suit your needs.

A: You can use this stored procedure to determine if it is a numeric data type:
CREATE FUNCTION dbo.IsNumericEx( @value nvarchar(max) )
RETURNS BIT
AS
BEGIN
     DECLARE @isInt BIT

     SELECT  @isInt = 1
     WHERE   @value NOT LIKE '%[^0-9.-]%'
             AND LEN(REPLACE(@value, '.', '')) >= LEN(@value) - 1
             AND CHARINDEX('-', @value) IN (0, 1)
             AND CHARINDEX('-', @value, 2) = 0

     RETURN ISNULL(@isInt, 0)
END
GO

And the query:
select * from myTable where isNumericEx(mycolumn) = 1 and length(mycolumn) between 9 and 11

A: I'm not an expert in mySql, but I think you can simply use:
SELECT *
FROM customers
WHERE CONVERT(telnumber, INTEGER) IS NOT NULL
AND LENGTH(telnumber) >= 9
AND LENGTH(telnumber) <= 11;


text:
Q: Send Laravel notification without entity I understand that with Laravel notifications I can use
Notification::send(User::first(), new TodoCompleted($task));

But what if I want to send a notification, to Slack in my case, with some custom details stored in an array ($task in the example above) but without having to pass a entity/model (User::first() in the example above). Is that possible?

A: To send a notification without using model you will want to use on demand notifications:
Notification::route('slack', 'https://hooks.slack.com/services/...')
        ->notify(new TodoCompleted($task));

Just replace https://hooks.slack.com/services/... with the url that you would usually return from the routNotificationForSlack method.


text:
Q: Referring to a local file using java.net.URL: MalformedURLException I'm trying to referring to a local file using java.net.URL, the code is as follows:
import java.net.URL;
public class Main
{
    URL grammarURL = new URL("file://localhost/home/me/openccg/ccg-format-grammars/tinytiny/tinytiny-grammar.xml");
    public static void main(String[] args)
    {
        //System.out.println("Hello World!");
    }
}

But my IDE tells me that there is a "MalformedURLException" in the URL line. I followed instructions from this site but it doesn't work.


text:
Q: $n$th root of a polynomial Let $n\geq 2$ be an integer, and $D=\mathbb Z[1/n]$. Consider the polynomial $S=(1+T)^n-1\in D[T]$. How can I show that $D[[S]]=D[[T]]$ and there exists an $f(S)\in SD[[S]]$ such that $1+S=(1+f(S))^n$?
Qing Liu: Algebraic Geometry and Arithmetic Curves ex. 1.3.9 a.

A: For $D[[S]] = D[[T]]$ you should notice $S = nT + \mathcal O(T^2) = T(n+\mathcal O(T))$. Since $n$ is invertible in $D$, the power series $n+\mathcal O(T)$ is invertible, hence $S$ is the product of $T$ and an invertible power series.
For the second assertion, consider $(1+S)=(1+T)^n$. By the first assertion, $T$ can be written as power series in $S$.


text:
Q: PHP Login script problems i was wondering if anyone could help as i am trying to adapt a PHP login script to accept only the password without the need for the username and I don't know what i am doing wrong. I am a complete novice i am afraid. What i want the end result to be is for any user to type in one password, the script then checks the password is correct from my data base and then logs them in.

//First we start a session
session_start();

//We then check if the user has clicked the login button
if (isset($_POST['submit'])) {

    //Then we include the database connection
    include_once 'dbh.inc.php';
    //And we get the data from the login form
    $pwd = $_POST['pwd'];

    //Error handlers
    //Error handlers are important to avoid any mistakes the user might have made when filling out the form!
    //Check if inputs are empty
    if (empty($pwd)) {
        header("Location: ../index.php?login=empty");
        exit();
    }
    else {
        //Check if username exists in the database USING PREPARED STATEMENTS
        $sql = "SELECT * FROM users WHERE user_uid=?";
        //Create a prepared statement
        $stmt = mysqli_stmt_init($conn);
        //Check if prepared statement fails
        if(!mysqli_stmt_prepare($stmt, $sql)) {
            header("Location: ../index.php?login=error");
            exit();
        }
        //If the prepared statement didn't fail, then continue
        else {
            //Bind parameters/data to the placeholder (?) in our $sql
            mysqli_stmt_bind_param($stmt, "s", $uid);

            //Run query in database
            mysqli_stmt_execute($stmt);

            //Get results from query
      $result = mysqli_stmt_get_result($stmt);

            //If we had a result, which means the username does exist, then assign the database row data to $row.
            if ($row = mysqli_fetch_assoc($result)) {
                //De-hashing the password using the password provided by the user, and the password from the database, to see if they match.
                $hashedPwdCheck = password_verify($pwd, $row['user_pwd']);
                //If they didn't match!
                if ($hashedPwdCheck == false) {
                    header("Location: ../index.php?login=error");
                    exit();
                }
                //If they did match!
                elseif ($hashedPwdCheck == true) {
                    //Set SESSION variables and log user in
                    $_SESSION['u_id'] = $row['user_id'];
                    $_SESSION['u_first'] = $row['user_first'];
                    $_SESSION['u_last'] = $row['user_last'];
                    $_SESSION['u_email'] = $row['user_email'];
                    $_SESSION['u_uid'] = $row['user_uid'];
                    header("Location: ../index.php?login=success");
                    exit();
                }
      } else {
        header("Location: ../index.php?login=error");
            exit();
      }
        }
    }

    //Close the prepared statement
    mysqli_stmt_close($stmt);

} else {
    header("Location: ../index.php?login=error");
    exit();
}

A: You are binding $uid which is undefined:
   //Bind parameters/data to the placeholder (?) in our $sql
    mysqli_stmt_bind_param($stmt, "s", $uid);

A: Hi i just noticed you are binding $uid , which is not defined that's the first thing you should look at.
//Bind parameters/data to the placeholder `(?)` in our `$sql`

mysqli_stmt_bind_param($stmt, "s", $uid);

The above should be initialized
$uid = '12';

mysqli_stmt_bind_param($stmt, "s", $uid);


text:
Q: Activity Crashing for seemingly no reason ? -Android Below is my entire activity,
Basically I just pass two intents, send one to a textview, and set the other as the title.
Then I have a toggle fullscreen function down below which works 100%.
I can't seem to figure out the problem. But I did make some major changes recently and after that when I try, the activity can't start and the app crashes.
I have a lot of activities, and I just now found out that Eclipse creates settings_menu layouts for every activity in the menu folder. I don't need to use them except in this one activity.
Say I had like 15 activities total, I deleted 14 of the XML settings menu files of all the other activities except this one (Xtxt).
But after deleting all this, the app still worked. Now I made some changes to the settings stuff, Just the text which appears when you click the menu button.
I can't seem to pin down the problem. So, below is my entire activity, and below that the LogCat output of the error.
public class Xtxt extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView textView = (TextView) findViewById(R.id.xxtt);
        setContentView(R.layout.xtxt);
        toggleFullscreen(true);
        Intent intent = getIntent();
        String svar1 = intent.getExtras().getString("a");
        String svar2 = intent.getExtras().getString("b");
        this.setTitle(svar2);
        textView.setText(svar1);

    }

    private void toggleFullscreen(boolean fullscreen) {
        WindowManager.LayoutParams attrs = getWindow().getAttributes();
        if (fullscreen) {
            attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
        } else {
            attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
        }
        getWindow().setAttributes(attrs);
    }

}

Here's the LogCat:
08-19 13:22:20.398: E/ActivityThread(31873): Failed to find provider info for com.google.plus.platform
08-19 13:22:20.406: E/AndroidRuntime(31873): FATAL EXCEPTION: main
08-19 13:22:20.406: E/AndroidRuntime(31873): java.lang.RuntimeException: Unable to start activity ComponentInfo{x.abcd/x.abcd.Xtxt}: java.lang.NullPointerException
08-19 13:22:20.406: E/AndroidRuntime(31873):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2077)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at android.app.ActivityThread.access$600(ActivityThread.java:134)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at android.os.Handler.dispatchMessage(Handler.java:99)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at android.os.Looper.loop(Looper.java:154)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at android.app.ActivityThread.main(ActivityThread.java:4624)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at java.lang.reflect.Method.invokeNative(Native Method)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at java.lang.reflect.Method.invoke(Method.java:511)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at dalvik.system.NativeStart.main(Native Method)
08-19 13:22:20.406: E/AndroidRuntime(31873): Caused by: java.lang.NullPointerException
08-19 13:22:20.406: E/AndroidRuntime(31873):    at x.abcd.Xtxt.onCreate(Xtxt.java:27)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at android.app.Activity.performCreate(Activity.java:4479)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
08-19 13:22:20.406: E/AndroidRuntime(31873):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
08-19 13:22:20.406: E/AndroidRuntime(31873):    ... 11 more

I tried undoing the delete, and even after restoring those deleted menu files I still seem to have this weird Null pointer error. Have I missed something ?
What's wrong ?
Pls help.

A: Your setContentView should come first before initialization of view.
Replace this
  TextView textView = (TextView) findViewById(R.id.xxtt);
  setContentView(R.layout.xtxt);

By
  setContentView(R.layout.xtxt);
  TextView textView = (TextView) findViewById(R.id.xxtt);

in onCreate
You can findViewById of the current view hierarchy set to the activity. Since you have not set the layout to the activity your findViewById fails. You are probably getting NUllPointerException because of this.
Edit:
It is better to initialize your views in onCreate since it is called once during the lifecyle of the activity.
Quoting from the docs
http://developer.android.com/reference/android/app/Activity.html
onCreate(Bundle) is where you initialize your activity. Most importantly, here you will usually call setContentView(int) with a layout resource defining your UI, and using findViewById(int) to retrieve the widgets in that UI that you need to interact with programmatically.

A:     TextView textView = (TextView) findViewById(R.id.xxtt);
    setContentView(R.layout.xtxt);

->
    setContentView(R.layout.xtxt);
    TextView textView = (TextView) findViewById(R.id.xxtt);


text:
Q: Send Slack Notifications With Laravel 5.4 I followed the official laracast 5.3 tutorial to send a slack notification from Laravel (I'm using laravel 5.4). But upon following all the procedures when I hit the url I get the following error. I haven't touched the Connection.php file at all since making the project.
Here is the tutorial link.
Screen shot of error:

A: You have to configure your application with a database connection and make your migrations.
The error is explicit: you missed a database connection and probably a user table.
Before implementing notifications you have to build a fully functional laravel app with the needed tables (users at minimum), and a working authentication, you can find detailed info in the laravel docs.


text:
Q: Jaxb and Object class do not get the value from the Xml when unmarshal I have a problem with the following source code.
After unmarshalling the "Simple" class, the property "content" created from the "content" tag is null. I mean the "content" property don't get the value "123456" from the xml.
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Simple", propOrder = {
    "content"})
public class Simple extends Valor{

    @XmlElements({
        @XmlElement(name="content",type=String.class),
        @XmlElement(name="content",type=Integer.class),
    })
    protected Object content;

    //getters y setters
}

file.xml
<simple>
    <content>
        123456
    <content>
</simple>

Valor class
@XmlSeeAlso({
Varios.class,
Simple.class,
Grilla.class
})
@XmlTransient
public abstract class Valor {
    public abstract String getValorString();
}

Any thoughts?
Thanks in advance!
Adding some clarity to the issue I'm having. If I put the Simple class:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Simple", propOrder = {
"content"})
public class Simple extends Valor{

    @XmlElements({
        @XmlElement(name="content",type=String.class),
        @XmlElement(name="content",type=Integer.class),
    })
    protected Object content;

    //getters y setters
}

if the xml is:
<simple>
<content>
    123456
</content>
</simple>

the output is:
123456

but if the xml is:
<simple>
<content>
    Hi!!
</content>
</simple>

the output is:
null

Now if the Simple class, exchange the XmlElements as in the following code:
    @XmlElements({
        @XmlElement(name="content",type=Integer.class),
        @XmlElement(name="content",type=String.class)
    })
    protected Object content;

if the xml is:
<simple>
<content>
    123456
</content>
</simple>

the output is:
null

but if the xml is:
<simple>
    <content>
        Hi!!
    </content>
</simple>

the output is:
Hi!!

A: I haven't been able to reproduce what you are seeing.  Below is what I have tried.
Java Model
Simple
Below is what I implemented for your Simple class.
import javax.xml.bind.annotation.*;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Simple", propOrder = {
    "content"})
public class Simple extends Valor{

    @XmlElements({
        @XmlElement(name="content",type=String.class),
        @XmlElement(name="content",type=Integer.class),
    })
    protected Object content;

    public Object getContent() {
        return content;
    }

    @Override
    public String getValorString() {
        throw new UnsupportedOperationException();
    }

    public void setContent(Object content) {
        this.content = content;
    }

}

Demo Code
input.xml
Below is the input document with the close tag for content corrected.
<simple>
    <content>
        123456
    </content>
</simple>

Demo
import javax.xml.bind.*;
import javax.xml.transform.stream.StreamSource;

public class Demo {

    public static void main(String[] args) throws Exception {
        JAXBContext jc = JAXBContext.newInstance(Simple.class);

        Unmarshaller unmarshaller = jc.createUnmarshaller();
        StreamSource source = new StreamSource("src/forum22911170/input.xml");
        Simple simple = unmarshaller.unmarshal(source, Simple.class).getValue();

        System.out.println(simple.getContent());
    }

}

Output
Below is the output from running the demo code:
123456

UPDATE
The problem you are running into is that you have both options in the @XmlElements annotation mapped to the same element content.  For unmarshalling JAXB will treat the element based on the first @XmlElement with that name.  In the case below it will always treat it as a String, it you reversed the order it would always treat it as an Integer.
@XmlElements({
    @XmlElement(name="content",type=String.class),
    @XmlElement(name="content",type=Integer.class),
})
protected Object content;

The proper usage is to have them mapped to different elements such as
@XmlElements({
    @XmlElement(name="FOO",type=String.class),
    @XmlElement(name="BAR",type=Integer.class),
})
protected Object content;


text:
Q: C# .NET how to connect to oracle 11g database if only given httprequest header information Alright I know there are bunch of ways to connect to a oracle 11g database. And I have seen lots of tutorials on this topic. My problem is that I'm not the one that host the server, it's unlikely to get the SID of the server and the database name from the people that hosted it. I only know the server IP address and ports and I'm able to send and receive Httprequests to or from the server using my username and password.
Is there a possible way to get the information I needed for the connection string?
My goal is to use odp.net. The only two things I need is the SID and SERVER below. Anyone can help?
    Oracle.RACE =
(DESCRIPTION=
   (ADDRESS_LIST=
     (ADDRESS=
       (PROTOCOL=TCP)
       (HOST=127.0.0.1)
       (PORT=1521)
     )
   )
   (CONNECT_DATA=
     (SID=RACE)
     (SERVER=DEDICATED)
   )
)


text: Q: Having a hard time with links and centering an image My HTMLMy CSSI have two images that are separate links to different web pages that stack on top of each other, so I tried to put display: block; on them, but it didn't work. I am also trying to center the images, but they keep left. My container is centered and I've put margin: 0px auto; on multiple classes and ids to try to make it work, but nothing's happening


text:
Q: easepick lockplugin filter on angular I'm testing easepick hotel example on Angular.
I'm able to set minDate and maxDate but how can I filter custom dates?
stackblitz to fork and play
Thanks in advance for looking into this.

A: I managed to sort this out: passing 'bookedDates' as another option to LockPlugin object.
That way the filter function can recognise this.bookedDates
You can see the working sample on this stackblitz
Hope this can help others struggling with similar issue.


text:
Q: How to restore Eclipse last project tree expand on startup? When I quit Eclipse some interesting packages are opened. But when I restart Eclipse all projects/packages are collapsed.
Is there a way to save the state of the Project-Explorer on closing Eclipse?
I don't want to use the Link to Editor feature, because this allways opends packages, that I don't want to expand just for looking up some declaration in an other class.
I also don't want to use the focus view of MyLyn, because I want to be independent of a task and want to see all available packages.
Is there a build in feature of Eclipse to do so?

A: I found in a Eclipse-Issue that this feature was removed, because It took to much time in the startup-phase. So this feature does NOT exist in Eclipse without an additional plug-in.


text:
Q: In python3, dict.items() returns items in different order I am porting my code from python2 to python3, but having problem with common function which lists the web page elements in order. In python2 it returned a different order, and my code was using by index, so now they are breaking. How can I fix this
Basically, in python2,
myDict = {'One': 1, 'Two': 2, 'Three': 3}
print (myDict.items())

[('Three', 3), ('Two', 2), ('One', 1)]
In python3,
myDict = {'One': 1, 'Two': 2, 'Three': 3}
print (list(myDict.items()))

[('One', 1), ('Two', 2), ('Three', 3)]
Why is there this difference and how can I fix it? Do I just reverse the list or is there a better fix? thanks!


text:
Q: In "Partials" by Dan Wells, which one of the scouts is a Partial? I'm not sure if any of you have read the Partials series by Dan Wells (It's an excellent book series that deserves more attention then it has gotten) but if you have maybe you can help me. In the first book it is implied by several characters that one or both of the scouts is a Partial. I have just finished reading through the series and I feel that most of the questions I had at the end were answered except this one. Which one (if any) of the scouts was a Partial? Does this question not have any answer in the books, or did I miss something in my first read though?

A: Probably neither
This is the explanation presented by Mkele:

"We need to find out why," Kira insisted. "One of our scouts may have
  been a Partial—"
"Or he may simply have been interrogated in the field," said Mkele. "A
  tortured soldier is a simpler explanation, and therefore a more likely
  one, than a widespread infiltration of our entire society."
—Partials

He's probably right. Consider:

*

*Scruffy killed a Partial soldier. Contrary to what trigger-happy Haru though, this would have been a very improbable action for an infiltrator to take. In addition, a spy would probably have known that they wouldn't be trusted when they returned, even if they wouldn't have counted on being shot on sight, and would simply not have come back.

Scruffy looked behind, shrugged, and handed Haru his weapon. Before he
  could even pick up the prisoner, Haru shot him in the head. Kira
  yelped, Scruffy toppled to the ground, and Haru shot him again.
"What the hell are you doing?" Jayden shouted. "I told you," said
  Haru, "as far as I'm concerned, they're both guilty. I'm not taking
  any more Partials home than I have to."
"He saved us!" Jayden shouted. "He killed a Partial soldier!"
—Partials

Of course, this only rules out Scruffy, not Skinny.

*The Partials didn't really seem to have much interest in infiltration. They didn't seem to have much interest in humanity at all, in fact, until they realized the humans might hold the key to their own survival. The presence of Partial agents among the humans is never mentioned by any Partial or Trustee.

*The radio was so distorted that Kira couldn't tell who was talking.

A radio crackled quietly. "Timmy calling Jimmy." The voice was
  distorted enough by static that Kira couldn't tell if it was Skinny or
  Scruffy.
—Partials

This means it could have been anyone, including one of the Partials looking for them.

*Why betray them then?

Kira leaned back against the wall, her legs weak, feeling the sudden
  need for support. The ramifications were terrifying, but the logic …
  didn't hold up. "Why now?" she asked. "If they wanted us dead, they
  could have done it at any time—what do they gain by betraying us here,
  in the middle of nowhere?"
—Partials

Of course, we later learn a possible reason: to get a human test subject.

*It would have been very difficult for a Partial to remain hidden in a human settlement. Their emotional expression is extremely different from most humans,  medical examination would probably reveal their nature, and most can't bear to be apart from the Link for long. An espionage model could probably manage it, though.

*Perhaps most important: If one or more Partial agents were already embedded in the population, why bother with sending squadron to collect a human test subject? They could easily just kidnap someone, especially a fellow soldier, without nearly so much trouble.
But on the other hand...

*

*We also know that Steve, a.k.a Skinny, probably lived, at least through that sequence:

There are two minor characters in the Manhattan sequence of the book
  named Nick and Steve–or Skinny and Scruffy, as Kira calls them. Nick
  and Steve are friends of mine, and I put them into every book I write:
  Steve always lives and Nick always dies. I don't know why, it just
  amuses me.

This could indicate that he was a Partial. Of course, he could also have been taken back for Morgan's experiments.

*Jayden believed that they couldn't have gotten the passcode from Steve that quickly.

"They couldn't have tortured anyone that fast," said Jayden, standing
  slowly. "There's no way they could have gotten the code words unless…"
  He paused. "What about… It couldn't be, that's insane."
—Partials

On the other hand, there's no reason to think this might not be the case. Most of these soldiers haven't seen proper combat, for while if ever. Many people would give up information under field torture, or even without any prompting, just to spare themselves.
So I would say it is most likely that one of the scouts simply gave up the information and was taken prisoner, but it is still possible one was nonetheless a Partial.


text:
Q: how to get term vectors by using Elasticsearch Hadoop I'm using ElasticSearch-Hadoop API. And I was trying to get _mtermvector by using the following Spark code:
val query= """_mtermvectors {
        "ids" : ["1256"],
        "parameters": {
            "fields": [
                 "tname"
            ],
            "term_statistics": true
        }
}"""
var idRdd = sparkContext.esRDD("uindex/type1",query)

It didn't work, any ideas please, appreciate!

A: You can't use endpoints (like _mtermvectors) which are part of the document API's with ES-Hadoop. Only queries which belongs to the query API's, query DSL or external resource are allowed.
Hope that it helps.


text:
Q: i'm using strongswan libray and app was working fine but it's start getting this error Execution failed for task ':strongswan:buildNative'
Process 'command 'C:\Users\Administrator\AppData\Local\Android\Sdk\ndk\25.1.8937393/ndk-build.cmd'' finished with non-zero exit value 2

*

*Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

*Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':strongswan:buildNative'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:207)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:205)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:186)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:356)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Administrator\AppData\Local\Android\Sdk\ndk\25.1.8937393/ndk-build.cmd'' finished with non-zero exit value 2


text:
Q: Issue with ListFragment Displaying Data I have a class that is displaying a list of owner using ListFragment. When a user clicked on an owner, it supposed to replace the bottom fragment with a new fragment that would list the owner's car. The issue is that it kept throwing an exception No view found for id 0x7f090013 even though I created a view for it. What am I doing wrong here?
//This is the onListItemClick where I am calling to replace the other fragment (Full code will be posted at the end.)
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    // TODO Auto-generated method stub
    //super.onListItemClick(l, v, position, id);
    int search = 0;
    Owner a = (Owner) getListView().getItemAtPosition(position);
    String name = a.getFirstName();
    String lName = a.getLastName();
    String Id = a.getCarId();

    FragmentManager mFragment = getChildFragmentManager();
    FragmentTransaction ft = mFragment.beginTransaction();
    CarDetail cDetail = new CarDetail();
    cDetail.SearchParameters(Integer.parseInt(Id));
    ft.replace(R.id.fCarDetail, cDetail);
    ft.addToBackStack(null);
    ft.commit();
}

//This is the car Detail Fragment
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class CarDetail extends ListFragment {
   private ListView lCars;
   private ArrayList<Car> listCar = new ArrayList<Car>();
   private CarAdapter carAdapter;
    private int carId = 0;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v1 = inflater.inflate(R.layout.customize_layout,container,false);
        lCars = (ListView) v1.findViewById(android.R.id.list);
        return v1;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        lCars.setAdapter(carAdapter);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        carAdapter = new CarAdapter(getActivity(), R.layout.car_detail, listCar);
        if(carId > 0)
        {
           new CarAsyncTask(carId).execute();
                     //As soon as it done with the on create, it throw the exception.
        }
    }

    public void SearchParameters(int id) {
        carId = id;
    }

    private class CarAsyncTask extends AsyncTask<Integer, Void, List<Car>> {
        public int id =0;

        public CarAsyncTask(int carId) {
            id = carId;
        }

        @Override
        protected List<Car> doInBackground(Integer... params) {
            //List<Car> item = null;
            List<Car> item = new ArrayList<Car>();
            item.add(new Car("Chevy","Caprice","2002", 1));
            item.add(new Car("Chevy","Malibu","2014", 2));
            item.add(new Car("Dodge","Stratus","2002", 3));
            item.add(new Car("Saturn","L300","2004", 4));

            return item;
        }

        @Override
        protected void onPreExecute() {
            // TODO Auto-generated method stub
            super.onPreExecute();
            listCar.clear();
            carAdapter.clear();

        }

        @Override
        protected void onPostExecute(List<Car> result) {
            super.onPostExecute(result);
            for(Car c: result)
            {
                if(c.getID() == carId)
                {
                    carAdapter.add(c);
                    carAdapter.notifyDataSetChanged();
                }
            }
        }

    }

}

//car_detail.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

   <TextView
        android:id="@+id/tvMake"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="test" />

    <TextView
        android:id="@+id/tvModel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="make" />

    <TextView
        android:id="@+id/tvYear"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="year" />

     <TextView
        android:id="@+id/tvID"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ID" />

</LinearLayout>
//the customize layout

<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:orientation="vertical"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:paddingLeft="8dp"
         android:paddingRight="8dp">

     <ListView android:id="@id/android:list"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
               android:layout_weight="1"
               android:background="#FFFF00"
               android:drawSelectorOnTop="false"/>

     <TextView android:id="@id/android:empty"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
               android:background="#FF00FF"
               android:text="No data"/>
 </LinearLayout>
Exception:

08-22 21:00:21.051: E/AndroidRuntime(907): FATAL EXCEPTION: main
08-22 21:00:21.051: E/AndroidRuntime(907): java.lang.IllegalArgumentException: No view found for id 0x7f090013 (com.mb.carlovers:id/fCarDetail) for fragment CarDetail{40d97200 #0 id=0x7f090013}
08-22 21:00:21.051: E/AndroidRuntime(907):  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:919)
08-22 21:00:21.051: E/AndroidRuntime(907):  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
08-22 21:00:21.051: E/AndroidRuntime(907):  at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
08-22 21:00:21.051: E/AndroidRuntime(907):  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1460)
08-22 21:00:21.051: E/AndroidRuntime(907):  at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440)
08-22 21:00:21.051: E/AndroidRuntime(907):  at android.os.Handler.handleCallback(Handler.java:725)
08-22 21:00:21.051: E/AndroidRuntime(907):  at android.os.Handler.dispatchMessage(Handler.java:92)
08-22 21:00:21.051: E/AndroidRuntime(907):  at android.os.Looper.loop(Looper.java:137)
08-22 21:00:21.051: E/AndroidRuntime(907):  at android.app.ActivityThread.main(ActivityThread.java:5041)
08-22 21:00:21.051: E/AndroidRuntime(907):  at java.lang.reflect.Method.invokeNative(Native Method)
08-22 21:00:21.051: E/AndroidRuntime(907):  at java.lang.reflect.Method.invoke(Method.java:511)
08-22 21:00:21.051: E/AndroidRuntime(907):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-22 21:00:21.051: E/AndroidRuntime(907):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-22 21:00:21.051: E/AndroidRuntime(907):  at dalvik.system.NativeStart.main(Native Method)
08-22 21:00:21.172: W/ActivityManager(290):   Force finishing activity com.mb.carlovers/.People
08-22 21:00:21.231: W/WindowManager(290): Failure taking screenshot for (237x148) to layer 21015
08-22 21:00:21.631: E/SurfaceFlinger(37): ro.sf.lcd_density must be defined as a build property
08-22 21:00:21.751: W/ActivityManager(290): Activity pause timeout for ActivityRecord{40f05be8 u0 com.mb.carlovers/.People}
08-22 21:00:21.821: D/dalvikvm(290): GC_CONCURRENT freed 752K, 18% free 5916K/7192K, paused 74ms+104ms, total 515ms
08-22 21:00:31.265: W/ActivityManager(290): Launch timeout has expired, giving up

//Below is the OwnerDetail Code
package com.mb.carlovers;
import java.util.ArrayList;
import java.util.List;

import com.mb.carlovers.adapter.OwnerAdapter;

import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.ListFragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

public class OwnerDetail extends ListFragment {
   private ListView mListView;
   private ArrayList<Owner> listItem = new ArrayList<Owner>();
   private OwnerAdapter ownerAdapter;
   private String[] searchParameter = null;

   public void SearchParameters(String[] parameters)
   {
       searchParameter = parameters;
   }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
        View v1 = inflater.inflate(R.layout.customize_layout,container, false);
        mListView = (ListView) v1.findViewById(android.R.id.list);
        return v1;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState)
    {
        super.onActivityCreated(savedInstanceState);
        mListView.setAdapter(ownerAdapter);
      //  ownerAdapter.notifyDataSetChanged();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ownerAdapter = new OwnerAdapter(getActivity(), R.layout.owner_detail, listItem);
        if(!(searchParameter == null))
        {
            //ownerAdapter.clear();
        //  ownerAdapter.addAll(listItem);
            new OnwerAsyncTask().execute();
            //ownerAdapter.notifyDataSetChanged();
        }
    }

    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        // TODO Auto-generated method stub
        //super.onListItemClick(l, v, position, id);
        int search = 0;
        Owner a = (Owner) getListView().getItemAtPosition(position);
        String name = a.getFirstName();
        String lName = a.getLastName();
        String Id = a.getCarId();

        FragmentManager mFragment = getChildFragmentManager();
        FragmentTransaction ft = mFragment.beginTransaction();
        CarDetail cDetail = new CarDetail();
        cDetail.SearchParameters(Integer.parseInt(Id));
        ft.replace(R.id.fCarDetail, cDetail);
        ft.addToBackStack(null);
        ft.commit();
    }

    private class OnwerAsyncTask extends AsyncTask<Void, Void, List<Owner>> {
        @Override
        protected List<Owner> doInBackground(Void... params) {
            ArrayList<Owner> listItemLocal = new ArrayList<Owner>();
            try
            {
                Owner items = new Owner();
                items.setFirstName("John");
                items.setLastName("Smith");
                items.setCarId("1");
                listItemLocal.add(items);

                Owner item1 = new Owner();
                item1.setFirstName("Samantha");
                item1.setLastName("Right");
                item1.setCarId("2");
                listItemLocal.add(item1);

                Owner item2 = new Owner();
                item2.setFirstName("Regie");
                item2.setLastName("Miller");
                item2.setCarId("3");
                listItemLocal.add(item2);

                Owner item3 = new Owner();
                item3.setFirstName("Mark");
                item3.setLastName("Adam");
                item3.setCarId("4");
                listItemLocal.add(item3);

            } catch(Exception ex)
            {
                ex.toString();
            }
            return listItemLocal;
        }

        @Override
        protected void onPreExecute() {
            listItem.clear();
            ownerAdapter.clear();
            super.onPreExecute();
        }

        @Override
        protected void onPostExecute(List<Owner> result) {
            /*OwnerDetail  fragment = (OwnerDetail) mActivity.getSupportFragmentManager().findFragmentById(R.id.fOwnerDetail);
            fragment.SetAdapter(result);*/
            listItem = (ArrayList<Owner>) result;
            super.onPostExecute(result);
            if(listItem.size() > 0)
            {
                ownerAdapter.clear();
                ownerAdapter.addAll(listItem);
                ownerAdapter.notifyDataSetChanged();
                Log.i("Testing", "Added " + result.size() + "items to adapter.");
            }
        }

    }
}

A: After debugging the application over and over, I finally found the issue. In the car class, the carId was declared as an integer; however, I call the set ID passing an integer without converting it to a string in the CarAdapter. I changed the ID to a string, and I convert it back to an integer before I do the Id comparison. It works.
//the piece of code below was causing the issue.
holder.tvId.setText(item.getID());