text:
Q: Unexpected probability distribution from xgboost binary classification I am testing different a couple of different binary classification models using xgboost to predict the likelihood to convert. The difference between the 2 probability distributions shown below is based on different fields being used to train the models.
The first image shows a distribution that makes sense to me given my understanding of the industry. There's a large number of predictions that are unlikely to convert, a handful that is very likely to convert, and the rest fall somewhere in between.  Note that the first image has had the probabilities rounded and converted to a scale falling between 0 to 100 instead of 0 to 1.

The second image shows the distribution from a different model where the list of available features was restricted, and not only is the range between the lowest and the highest distribution very narrow (lowest ~0.48, highest ~0.51), but the distribution is very heavy on just a handful of specific probabilities.

My questions are:

*

*Does a probability distribution like the latter give reason to
disregard that model as a candidate?

*Is it more typical to see
results like the first or second distribution for these types of
models?

*What kind of features would typically cause the results to
be more like one or the other?

Apologies if these are dumb questions - I don't have a stats background just a very rudimentary understanding of the basics. Any pointers to additional reading are appreciated.

A: Let me try to answer your question.
First of all, I wanted to highlight that what you are observing here in terms of distribution of the probability of the model is a common effect especially for boosted models, SVM or even naive bayes. You tend to see a sigmoid distortion of the probabilities more prominent towards the extremes rather than an even distribution. If you look at the logic behind these models, you will see it makes sense in the way that they do the classification.

*

*Whether to use the model or not is a decision that ideally should be taken based on the metrics that you are looking for like ROC etc. Unless what you really intend to use are the probability. In that case you should check out something called platt scaling. Check out this link to get more details on it. https://www.analyticsvidhya.com/blog/2016/07/platt-scaling-isotonic-regression-minimize-logloss-error/

*I hope I have answered your concern already.

*This trend is not a function of features but the result of the model you are using.


text:
Q: Adding plugins.ts file in nuxt vuex module folder adds a 'plugins' state field It seems like Nuxt is adding any additional files beyond index.js, state.js, mutations.js, getters.js and actions.js to the state of the module.
Is there any way to stop Nuxt from doing so? I'd like to include a plugins.js file which has plugins defined relating to a specific module.
I have the following setup

*

*dir: store

*

*index.js

*dir: photos

*

*state/mutations/getters/actions.js,

*plugins.js

The plugins.js file defines a plugin which I import and includes in the index.js file
// store/index.js
import { vuexPluginUploadPhotosOnLogin } from './photos/plugins'

export const plugins = [vuexPluginUploadPhotosOnLogin]

This setup works in as much as the plugin is set up correctly as is my store. But there is one small thing that bothers me, and it is this:

That plugins state field is created by Nuxt because of the plugins.js file being in the mod directory. If I remove it, the state field is also removed.
Why does Nuxt do this? And is there a way to stop it?
I know I could hide the plugins file outside of the structure of the store, but... it really belongs there! It absolutely is the best home for it, and it is annoying to have to move the file somewhere else to satisfy Nuxt.

A: I want to add how I got around this in the end. I simply added all the plugins in the index.js file. So, I don't have a separate plugins.js file for the plugins, but I know that all plugin-related stuff is located in index.js of each store module subfolder, and that is good enough for me.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Regarding graphics scripts, and live wallpapers I have came upon a guide where it teaches how to use a custom graphics script to render alot of particles for a live wallpaper,
my question is, if i have a lot of large bitmaps(images) want to laydown on top of each other to sort of layers, where i have background image, a foreground image and some other images in between which move - than i know it will take a lot of ram for he phone, which is bad - will using a scripts in a way will make it work with less ram?
and in general how scripts help me in rendering graphics in other uses such as games? and so on..
and any links for tutroials about scripts will also be useful :)
Thanks


text:
Q: How to modify a single separator in between the text Hello:  I am looking to modify only one separator in between the following text either by awk, perl or sed
a,b,c,d,e,f,g,,,,k,l,m

to get the output as
a,b,c,d,e-f,g,,,,k,l,m

How to modify the nth separator ? Thanks in advance

A: You can use this sed,
sed 's/,/-/5' yourfile

A: I can't beat sed, but this Perl command does what you ask
perl -aF, -pe"splice @F,4,2,qq{$F[4]-$F[5]};$_=join ',',@F" myfile

A: In general perl doesn't support counting the s/// operations and making different choices on each one, but by using the /e flag you can do that yourself.
my $n = 0;
$string =~ s/,/++$n == 5 ? "-" : ","/eg;

will keep count of the number of times the substitution happens, and make a different change on the fifth time.

A: or with perl
my @array = ('a','b','c','d','e','f','g');
$array[4] = $array[4] . "-" . $array[5];
splice(@array, 5, 1);


text:
Q: I want to access the variable outeside the if() iterator i want the get the current value in if() out of the if loop.
ex:-
$('.name').each(function () {
    //name = this;
    temp = parseInt($('#slide_here').next().val());
    //console.log(temp)
    if (($(this).hasClass("1") == true)) {
        //console.log("you in1")
        //console.log(temp);
        if (temp > 10 && temp <= 20) {
            temp = temp + 10;
            //console.log(temp);
            //Agriculture.push(10);
        } else {
            temp = temp + 5;
            //console.log(temp);
            //Agriculture.push(5);
        }
        //return temp;
        console.log(temp);
    }
    if (($(this).hasClass("2") == true)) {
        console.log("you in2")
        if (temp > 10 && temp <= 20) {
            console.log(temp);
            temp = temp + 10;
            //Industry.push(10);
        } else {
            temp = temp + 5;
            //Industry.push(5);
        }
        //return temp;
    }

value should get added to the temp while iterating the if loop. i want final value as total addition after executing the all if statement.
example
initially
temp=13
in first if loop
temp=23
i want this 23 value for next if statement. I tried but i am getting 13 value only.

A: Move your assignment outside for global variable. In your code, when value is bigger than 20, it is not entering if statement. In order to make enter inside second if, I have updated condition to see global variable is remains same value as last updated;
var temp = parseInt($('#slide_here').next().val());

$('.name').each(function () {
            //name = this;

            //console.log(temp)

            if (($(this).hasClass("1") == true)) {

                //console.log("you in1")
                //console.log(temp);
                if (temp > 10 && temp <= 20) {
                    temp = temp + 10;
                    //console.log(temp);
                    //Agriculture.push(10);
                } else {
                    temp = temp + 5;
                    //console.log(temp);
                    //Agriculture.push(5);
                }
                //return temp;
                console.log(temp);

            }

            if (($(this).hasClass("2") == true)) {

                console.log("you in2")
                if (temp > 10 && temp <= 20) {
                    console.log(temp);
                    temp = temp + 10;
                    //Industry.push(10);
                } else {
                    temp = temp + 5;
                    //Industry.push(5);
                }
                //return temp;
            }

You can see demo here: jsfiddle

A: This seems correct. The only issue I see is that you check whether temp is less than 21, but it is now 23, so it will not enter the last if. Add some alerts to debug it. Here is what worked fine for me:

        $('.name').each(function ()
        {
            //name = this;
            temp = 13;
            alert("begins with" + temp);
            //console.log(temp)

            if (($(this).hasClass("1") == true))
            {
                //console.log("you in1")
                //console.log(temp);
                if (temp > 10 && temp <= 20)
                {
                    temp = temp + 10;
                    alert("temp modified to: " + temp);
                    //console.log(temp);
                    //Agriculture.push(10);
                }
                else
                {
                    temp = temp + 5;
                    //console.log(temp);
                    //Agriculture.push(5);
                }
                //return temp;
                console.log(temp);
                alert("in first if: " + temp);
            }

            if (($(this).hasClass("2") == true))
            {
                console.log("you in2")
                if (temp > 10 && temp <= 20)
                {
                    console.log(temp);
                    alert("current value should match the previous alert: " + temp);
                    temp = temp + 10;
                    //Industry.push(10);
                }
                else
                {
                    temp = temp + 5;
                    //Industry.push(5);
                }
                alert("in second if: " + temp);
                //return temp;
            }
        });
</script>

A: if statements are not loops - they execute once (depending on whether the condition is true or not) and there is no iteration.
The loop in your code is actually the call to jQuery each in this line:
$('.name').each(function () {

If you want the value of temp to be updated in the loop without being reset for each element with class name, you probably need to move the declaration of the temp variable outside of the loop:
var temp = parseInt($('#slide_here').next().val());

$('.name').each(function () {
    if (($(this).hasClass("1") == true)) {
        // ... do logic and update temp
    }
    if (($(this).hasClass("2") == true)) {
        // ... do logic and update temp
    }
}

// use final temp value


text:
Q: Number of ways of minimum path I have no idea if this is the right place to ask a question like this. As I searched if it was, I couldn't get the answer. If not, please remind me and I will delete this. I have a specific problem that I can't solve. Please suggest solutions if possible. The problem goes like:
We have n1 boxes of 50kg and n2 boxes of 100kg cargo. We have a plane which contains at most k kg. We have to ship all the cargo from one mountain to another. The principle of shipping is that at any given time (from 1 mountain to 2 or vice versa) there should be at least 1 cargo on the plane. The question is, how many ways are there to ship all the cargo in minimum number of shippings. (Like if the minimum number of flights required to ship is 5, then question is how many ways are there to ship all the cargo in 5 flights). A way is considered different if at least one flight had different amount of boxes.
I'm  guessing that graph traversal should be used. Tell me if I'm wrong.


text:
Q: Arrow Up / Down Clicks Select too Much if Clicking too Fast In SO: Best practise to realize up down arrows in select field a solution is provided by @guest271314 for selecting up/down arrows to select a percentage value. The solution has a small flaw:
When clicking too fast, some other elements of the page are selected, too.
See: https://www.youtube.com/watch?v=rntq0o0nFc0 and https://i.stack.imgur.com/TTRVY.png
How can this erroneous selection of other elements be prevented?

A: You can simply use CSS for remove the selection highlighting like this:
.noselect {
     webkit-touch-callout: none; /* iOS Safari */
     -webkit-user-select: none; /* Chrome/Safari/Opera */
     -khtml-user-select: none; /* Konqueror */
     -moz-user-select: none; /* Firefox */
     -ms-user-select: none; /* Internet Explorer/Edge */
      user-select: none; /* Non-prefixed version, currently not supported by any browser */
}

A: Using the snippet of the other post, all you have to do is wrapping your label element into a div like so (arrow up is wrapped, arrow down is not) :

$("label[for]").on("click", function(event) {
  $("#input").val(function(_, n) {
    return event.target.htmlFor === "up"
           ? +n < +this.max ? +n + 5 : n
           : +n > +this.min ? +n - 5 : n;
  }).trigger("arrow")
});
@charset "UTF-8";
 div {
  padding-top: 20px;
}
input[type="number"] {
  width: 45px;
  outline: thin solid navy;
}
label[for="up"]:nth-of-type(1):before {
  content: "\25B2";
}
label[for="down"]:before {
  content: "\25BC";
  position: relative;
  top: 20px !important;
  left: -32.5px;
}
label[for="down"]:after {
  content: "%";
  position: relative;
  font-weight: bold;
  font-size: 14px;
  position: relative;
  left: -10px;
}
.label-ctn {
  display: block;
  position: absolute;
  top: -10px;
  left: 80px;
  }

  <select id="select1">
    <option value="abc">abc</option>
  </select>

  <input id="input" type="number" min="0" max="100" step="5" value="0">


text:
Q: What function has replaced bipartite_configuration_model in networkx? I have an older piece of code that depends on networkx. I get an error at the last line:
    # Generate a random graph with the appropriate degree sequence.
    left_sequence = [left_degree for x in range(L)]
    right_sequence = [right_degree for x in range(R)]
    # Need to use `create_using=Graph()` or else networkx will create a
    # multigraph.
    graph = bipartite_configuration_model(left_sequence, right_sequence,
                                          create_using=Graph(), seed=seed)

What function has replaced bipartite_configuration_model in newer versions of networkx?

A: The method bipartite_configuration_model, which I've found in networkx 1.9 docs is the same as configuration_model, which was moved to the bipartite module. As far as I see this was done with the migration to 2.0, but I don't find any explicit mentioning of this.


text:
Q: Descending ListNode Iterator Implementation My goal in this method is to write the implementation for an iterator that iterates through elements of a listNode in descending order. (From the back to the front) I have attached my implementation of the ascending iterator. Any help in the right direction would be appreciated.
 public MyDescendingDequeIterator(ListNode<E> back, ListNode<E> front) {
  frontOfList = front;
  nextToReturn = back;
   while (nextToReturn.next != null) {
    nextToReturn = nextToReturn.next;
}
}

public boolean hasNext() {
 if (nextToReturn == null){
 return false;
 } else {
 ListNode<E> current = frontOfList;
 return true;
 }
}

public E next() {
ListNode<E> current = frontOfList;
while ( current.next != nextToReturn ) {
  current = current.next;
}
nextToReturn = current;

return nextToReturn.data;

}
public void remove() {
    throw new UnsupportedOperationException();
}

}

A: Provided it's a regular ListNode implementation that has only next() method, you'll need to implement the prev() method - the hasNext in that case is quite similar to the one you've implemented already.
The other approach is to hold the start of the list and to iterate each time until next element will be nextToReturn (and then update nextToReturn). This is less desired approach since you'll need to iterate O(m^2) from end to start of list of length m;
UPDATE:
OK, first of all you don't need number of elements, since it's quite opposite to the Iterator idea.
So let's say we have
public MyDescendingDequeIterator(ListNode<E> back, ListNode<E> front) {
  frontOfList = front;
  nextToReturn = frontOfList;
  current = frontOfList;
}

Next thing is than you want to set the nextToReturn = back (now you don't use back at all). And you don't really need two variables, since nextToReturn is the current iterator.
So it transforms to:
public MyDescendingDequeIterator(ListNode<E> back, ListNode<E> front) {
      frontOfList = front;
      nextToReturn = back;
    }

Now let's look on the next() method
As I said you don't need an indexed for here, since you've got frontOfList that has a next attribute.
So it could be:
public E next() {
    ListNode<E> current = frontOfList;
    while ( current.next != nextToReturn ) {
      current = current.next;
    }
    nextToReturn = current;

    return nextToReturn.data;

}

hasNext implementation should be straightforward from here. Just pay attention that according to the good coding standards the method that starts with is or has rarely changes the state of the object.
Note, that I also omit possible null checks here and other possible specific checks as is just an example of direction.
UPDATE 2:
As I think of it now, you don't need the second parameter in the constructor either, just this:
public MyDescendingDequeIterator(ListNode<E> front) {
    frontOfList = front;
    nextToReturn = front;

    // calculate back here instead of get it as param
    while ( nextToReturn.next != null) {
        nextToReturn = nextToReturn.next;
    }
}

UPDATE 3:
Look, it won't help to just start writing some code and expect it to work, you should sit down first and start drawing the boxes with the arrows on the piece of paper and then try to understand what each function should do.
As I said before, your hasNext() method has a bug and incorrect in general. Why do you check the null? You move from back to front, do you have a null at some place at the front? What do you need the current object for. What does it do?
The next() method should check also if you're already at the first element. Otherwise it will (and it does ) cause NullPointerException at the last element.
Try to debug first, or at least add some printouts, it helps to understand where the bug is. But first you should build the algorythm, only then start coding it, not vice versa.


text:
Q: How to write data retrieved from DB into 2D array and how can this be retrieved back in Perl? I tried below for writing data into two dimensional array(array_source) but ended up in single dimensional array(array_source).. Below is code snippet, please review and let me know the ways to write it into 2D array so that it can be .
$DBHd = DBI->connect( "dbi:Oracle:host=$host;port=$port;sid=$SID", $user_name, $password);
$DBSth = $DBHd->prepare("SELECT EMP_ID,sal FROM emp");
$DBSth->execute();
my @array_temp;
my @array_source; # Should be 2D array and it should contain both values
my @array_source_in; # Should contain only employee IDS alone

while (my @array= $DBSth->fetchrow_array())
{
    push (@array_source, @array[0,1]);
    push (@array_source_in, @array[0]);
};

 print "Data in source : @array_source";
   print "\n";
 print "Data in input : @array_source_in";

Once data is retrieved into array_source how can this be compared with another 2D array and list the matching sets ?
Example :
Array 1 - Source Array
[100 5100,
101 5100,
102 6000,
104 7879,
444 287299,
771 111]
Array 2 - Should be compared against source
[100 5100,
101 5200,
102 0,
772 800,
104 7879]
Array 3 - This should be the output - Singe dimensional
[100,
104]
Please spare with alignment for above Arrays and consider 1 & 2 as two dimensional and 3 as single dimensional.

A: push (@array_source, @array[0,1]); should become push (@array_source, [@array[0,1]]); - you want to push a new array onto the top-level array.


text:
Q: MySQLdb._exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server versi I am trying to insert data into a MySQL table using my Flask app as shown below;
#Create MySQL connection and write data into the table user_data from the POST form
    sql_cursor = mysql.connection.cursor()

    sql_cursor.execute("""INSERT INTO user_data (make,model,trim,fuel_type,transmission,condition,body_type,region,descriptn,eng_capacity,year,mileage, estm_value)
        VALUES (new_info['make'],new_info['model'],new_info['trim'],new_info['fuel_type'],new_info['transmission'],new_info['condition'],
        add_bodytype['body_type'],add_region['region'],new_data['description'],new_data['eng_capacity'],year,new_data['mileage'], estm_value);""")

    mysql.connection.commit()
    sql_cursor.close()

This does not work too:
    sql_cursor = mysql.connection.cursor()

    sql_cursor.execute("INSERT INTO user_data (make,model,trim,fuel_type,transmission,condition,body_type,region,descriptn,eng_capacity,year,mileage, estm_value) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", (new_info['make'],new_info['model'],new_info['trim'],new_info['fuel_type'],new_info['transmission'],new_info['condition'],add_bodytype['body_type'],add_region['region'],new_data['description'],new_data['eng_capacity'],year,new_data['mileage'], estm_value))

    mysql.connection.commit()
    sql_cursor.close()

I get the below error:
I get the below error:

MySQLdb._exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'condition,body_type,region,descriptn,eng_capacity,year,mileage, estm_value)\n ' at line 1")

Someone please help me.

A: The homepage explains how to use placeholders https://dev.mysql.com/doc/connector-python/en/connector-python-example-cursor-transaction.html
If your variables are all valid.
this should work
sql_cursor.execute("""INSERT INTO user_data (make,model,trim,fuel_type,transmission,condition,body_type,region,descriptn,eng_capacity,year,mileage, estm_value)"""\
                """ VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s, %s);""",(new_info['make'],new_info['model'],new_info['trim'],new_info['fuel_type'],new_info['transmission'],new_info['condition'],
    add_bodytype['body_type'],add_region['region'],new_data['description'],new_data['eng_capacity'],year,new_data['mileage'], estm_valu)))

mysql.connection.commit()
sql_cursor.close()

A: Apparently, your connection driver is not configured to accept line breaks \n, try change your template string using concatenation or all inline statement...
    sql_cursor = mysql.connection.cursor()

    sql_cursor.execute("""INSERT INTO user_data (make,model,trim,fuel_type,transmission,condition,body_type,region,descriptn,eng_capacity,year,mileage, estm_value) VALUES (new_info['make'],new_info['model'],new_info['trim'],new_info['fuel_type'],new_info['transmission'],new_info['condition'],add_bodytype['body_type'],add_region['region'],new_data['description'],new_data['eng_capacity'],year,new_data['mileage'], estm_value);""")

    mysql.connection.commit()
    sql_cursor.close()


text:
Q: How to manipulate Kafka key documents with KSQLDB? I have a problem. I can't find a way to create a stream by filtering on the key of a kafka document.
I would like to filter and manipulate the json of a kafka key to retrieve the payload of the following example which corresponds to my couchbase id:

ksql> print 'cb_bench_products-get_purge' limit 1;

Key format: JSON or HOPPING(KAFKA_STRING) or TUMBLING(KAFKA_STRING) or KAFKA_STRING
Value format: JSON or KAFKA_STRING

rowtime: 2022/03/04 10:49:43.643 Z, key: {"schema":{"type":"string","optional":false},"payload":"history::05000228023411_RO_RO11219082::80"}, value: {[...]}}

A: You didn't specify the value part of your message so I've mocked up some data and assumed that it's also JSON. First I load it into a topic to test again:
$ kcat -b localhost:9092 -t test -P -K!
{"schema":{"type":"string","optional":false},"payload":"history::05000228023411_RO_RO11219082::80"}!{"col1":"foo","col2":"bar","col3":42}
^D

Check the data in the topic using ksqlDB (0.23.1-rc9):
ksql> print 'test' from beginning;
Key format: JSON or SESSION(KAFKA_STRING) or HOPPING(KAFKA_STRING) or TUMBLING(KAFKA_STRING) or KAFKA_STRING
Value format: JSON or KAFKA_STRING
rowtime: 2022/03/04 14:14:01.539 Z, key: {"schema":{"type":"string","optional":false},"payload":"history::05000228023411_RO_RO11219082::80"}, value: {"col1":"foo","col2":"bar","col3":42}, partition: 0

Declare a stream over the topic, using a STRUCT to represent the nested JSON. I'm assuming you are not interested in the schema so I've omitted that.
CREATE STREAM my_test (
  my_key_col STRUCT < payload VARCHAR > KEY,
  col1 VARCHAR,
  col2 VARCHAR,
  col3 INT
) WITH (KAFKA_TOPIC = 'test', FORMAT = 'JSON');

Query the stream with a predicate on the key:
SET 'auto.offset.reset' = 'earliest';

SELECT my_key_col->payload, col1, col2, col3
  FROM my_test
 WHERE my_key_col->payload LIKE 'history%'
EMIT CHANGES;

+--------------------------------------------+-------+------+-------+
|PAYLOAD                                     |COL1   |COL2  |COL3   |
+--------------------------------------------+-------+------+-------+
|history::05000228023411_RO_RO11219082::80   |foo    |bar   |42     |


text:
Q: How to control timestamp schema in pandas.to_parquet I noticed that column type for timestamp in the parquet file generated by pandas.to_parquet can be different depending on the version of pandas, e.g.
In [1]: pd.__version__
Out[1]: '1.0.5'

In [2]: pd.DataFrame([pd.Timestamp('2020-01-01')], columns=['a']).to_parquet('/tmp/test.parquet')

In [3]: !parquet-tools schema /tmp/test.parquet
message schema {
  optional int64 a (TIMESTAMP_MILLIS);
}

In [4]: !parquet-tools head /tmp/test.parquet
a = 1577836800000

In [1]: pd.__version__
Out[1]: '1.1.2'

In [2]: pd.DataFrame([pd.Timestamp('2020-01-01')], columns=['a']).to_parquet('/tmp/test.parquet')

In [3]: !parquet-tools schema /tmp/test.parquet
message schema {
  optional int64 a (TIMESTAMP_MICROS);
}

In [4]: !parquet-tools head /tmp/test.parquet
a = 1577836800000000

As seen above, pandas-1.0.5 converts the type of timestamp to be TIMESTAMP_MILLIS while pandas-1.1.2 converts it to be TIMESTAMP_MICROS.
I'm using pandas-1.1.2, but I need the type to be TIMESTAMP_MILLIS for downstream consumption of the parquet file (queried by Presto), how can do that, please?
I'm using the pyarrow engine.

A: This is configurable with pyarrow, luckily pd.to_parquet sends any unknown kwrgs to the parquet library.
looking at pyarrow docs for ParquetWriter we find

coerce_timestamps (str, default None) – Cast timestamps a particular resolution. The defaults depends on version. For version='1.0' (the default), nanoseconds will be cast to microseconds ('us'), and seconds to milliseconds ('ms') by default. For version='2.0', the original resolution is preserved and no casting is done by default. The casting might result in loss of data, in which case allow_truncated_timestamps=True can be used to suppress the raised exception. Valid values: {None, 'ms', 'us'}

so that means you can force the timestamp to milliseconds with
df.to_parquet(path, coerce_timestamps="ms")

or to microseconds
df.to_parquet(path, coerce_timestamps="us")

which makes this the code that you need
pd.DataFrame([pd.Timestamp('2020-01-01')], columns=['a']).to_parquet('/tmp/test.parquet', coerce_timestamps="ms")

Take note of this part of the docs too

allow_truncated_timestamps=True can be used to suppress the raised exception.


text:
Q: Why does this docker and flask app give NameError? I am following the example here.
I am running the app.py from the example. I change its imports from:
from keras.xx

to:
from tensorflow.keras.xx

to fix an error and I downgraded tensorflow to 1.15 to fix another.
I run it thus:
sudo docker run -d -p 5000:5000 keras-app

but it keeps crashing with:
2020-01-23T11:21:10.764365528Z   File "app.py", line 85, in <module>
2020-01-23T11:21:10.764369389Z     tensorflowapp.run(host='0.0.0.0')
2020-01-23T11:21:10.764372622Z NameError: name 'tensorflowapp' is not defined

code snippets:
app = flask.Flask(__name__)
model = None

...
if __name__ == "__main__":
print(("* Loading Keras model and Flask starting server..."
    "please wait until server has fully started"))
load_model()
app.run(host='0.0.0.0')

I am new to docker and flask so I'd appreciate any pointers on what I am missing.
I am running this on Google Cloud.

A: The culprit is tensorflowapp. It should only be app in app.run() but somehow it is receiving tensorflowapp added before app.run(). You need to look if you are accidently writing tensorflow somewhere in your code/ execution commands.


text:
Q: How to change isolinux boot splash Not plymouth, I mean the actual boot splash that gives you the options of trying out ubuntu, installing ubuntu, checking the disc for defects, etc.
It appears that everything concerning this is in the "isolinux"folder on the ISO. I found some info here: Splash screen before Ubiquity install
But when I follow his commands to create a new bootlogo cpio archive, the boot fails.
I figured out that changing txt.cfg changes the text on the boot menu without needing a new bootlogo, which is great, but I'm having issues changing the .pcx images and gfxboot.cfg. I'd also like to turn off how ubuntu automatically chooses to open the graphical "try or install" window if you don't make a choice in 5 seconds.
Thanks a million to whoever reads this.

A: Those commands from link you posted actually work. However, you need to do it differently. Here is how I did:
Copy just bootlogo from live CD (or extracted folder) in temporary folder (i will give example in ~/tmp/isolinux/).
Now navigate to the folder and extract bootlogo with command:
cd ~/tmp/isolinux
cpio -i < bootlogo

After this output in terminal must be 1684 blocks (or diferent if it changes).
cat bootlogo | cpio -t > ~/tmp/list

Again, output must be 1684 blocks.
Now edit files and build bootlogo file with:
cpio -o < ~/tmp/list > bootlogo

Again, same amount of blocks must be present (if not changed by you).
And finally, copy other files from /LiveCD/isolinux into your temporary folder (excluding bootlogo ofc.), now you can also copy edited files and overwrite original (or simply skip while copying from LiveCD).
Now it will work.


text:
Q: Cannot see form fields when creating a Webform in Drupal I'm trying to create a questionnaire using Webform 3.18 in Drupal 7. However, when I create the form, I cannot see any form fields to add to it. I cannot figure out what to do. Anybody has any suggestions? I am also attaching a screenshot.

A: Ok so I figured it out. A module called 'Form builder Webform UI" was enabled which was causing the problem. Disabling it fixed things.

A: I my case are version of Form builder and Webform. if is used Form Builder 7.x-1.6 and Webform 7.x-4.2 the symptoms are as is indicated here. If is used Webform 7.x-4.1 or 7.x-3.21 and Form Builder 7.x-1.5 (does not work with 7.x-1.6) the things works ok. Seems could be related with https://www.drupal.org/node/2383285


text:
Q: Creating bubble graphs in Carto using UK local authorities and Regions as the "Admin Region" The data I have is a list of projects for which I have the following geographic information:

*

*postcode

*longitude and latitude

*local authority

*region (or country, eg Wales)

as well as other details for each project.
Dataset:
https://saira.carto.com/tables/fww_data_for_mapload1
I would like to create bubble map in Carto summing together project numbers according to UK local authorities and UK regions and countries.
map:
https://saira.carto.com/tables/fww_data_for_mapload1/map
So there should be one bubble for each local authority or region. For example using region: Northern Ireland would have the smallest bubble representing 71 projects and South East (England) would have the largest with 165 projects.
I tried to georeference the local authority and region but I get an error.
When I select the Bubble option from the wizard, the column drop down has only numerical values relating to each project. I can see no way of showing project numbers per "Admin Region".

A: 1-Geocoding. In theory, if you have longitude and latitude data, you do not need to georeference your table using other geo-related fields.
2-Styling. If I understand you correctly, you want to show bubbles based upon the number of projects on the one hand. And on the other, display dot colors based upon admin. region. In order to do so, you would need to play with Wizards and CartoCSS:
2.1-Select CATEGORY from Wizards tab and choose the field that represents admin. regions in your table.
2.2-Go to CartoCSS tab. Copy the code (you can save it in a text editor).
2.3-Go back to Wizards tab. Select BUBBLES and choose the numeric field that represents the number of projects in your table.
2.4-Finally, go to CartoCSS tab and paste the "category" code at the end. Apply. Boom!
Here you have the code and below you could have a look at the result:

UPDATE:
In order to aggregate your data based upon admin. regions you need to follow these steps:
1-Go to SQL tab and apply a query like this one:
SELECT
  count(*) as num_projs,
  region
FROM
  fww_data_for_mapload1
GROUP BY
  region

2-Create a new dataset from query (you will see the yellow banner on the top of your map).
3-Georeference your data using admin. region (in your case, region). If the dataset is not correctly geocoded, you could join your this table with an already UK admin dataset from CARTO Data Library.
4-In order to make a bubble map you need to follow 2.3 steps using num_projs as the numeric field you want to represent.


text:
Q: Badiou and Mathematics Does anyone have an opinion on Alain Badiou's use of set theory? Is there anything interesting mathematically there? Also could anyone shed any light on the comment in the Wikipedia article link text that says:

This effort leads him, in Being and Event, to combine rigorous mathematical formulae with his readings of poets such as Mallarmé and Hölderlin and religious thinkers such as Pascal.

A: There's an interesting review of Badiou's "Number and Numbers" at the Notre Dame Philosophical Review by John Kadvany.

A: I don't know if the paragraph that talks about the relation between set theory and his philosophy is actually representative of what the man truly thinks but I'll give it a try assuming that it is.
There are moments of lucidity in those paragraphs about set theory being an axiomatic system for talking about collections but the rest is founded on shaky assumptions and a very loose interpretation of the lessons that set theorists learned some time ago about unrestricted comprehension and the confounding of types. In general it is not a good idea to use axiomatic systems and their properties to argue for or against the existence of certain things since axiomatic systems are by design meant to be interpreted and existence even in the mathematically precise sense is still not precise enough. I mention this because at some point Russell's paradox is used to argue against the existence of god, which kinda means whoever wrote this article doesn't really know much about axiomatic and logical systems. So all the parts that reference any kind of mathematical theory should really be thrown out and there isn't much left if you do that.

A: Badiou's got some mathematical training; reading back and forth between the relevant sections of Goldblatt's Topoi and Badiou's account of Ω-sets in Logics of Worlds, for example, you can see that the one tracks the other closely. It's not just blind quotation, followed by hand-wavy inference-drawing either: you could actually learn about Ω-sets from Badiou's presentation of them alone, and not be too horribly surprised or confused when you came to read the technical presentation in Goldblatt (this was, in fact, the order in which I did it).
On the axiom of choice and "infinite liberty":
The AoC says that given a set {A, B, C...} none of whose members are the empty set, there exists a set {x ε A, y ε B, z ε C...} which takes one element from each of the first set's members. The point here is that the AoC "freely" chooses an element from each set rather than (for example) identifying a "least" element and choosing that: even when there's no rule that can tell you which element should be chosen, the AoC says that a set exists representing some choice.
The AoC only has any work to do in situations where no rule can be found (for example, no-one knows of a rule that will well-order the reals, but the AoC entails that a real can be chosen, then another from the remaining reals, then another etc. - so "axiomatically" a well-ordering of the reals exists, provided one accepts AoC) - hence it represents, in this sense, the possibility of a predicatively undetermined choice. That's the "infinite liberty" he's on about. It is nowhere asserted that AoC "proves" that such a liberty exists, but rather that introducing AoC into ZF makes such a liberty thinkable within the confines of its axiomatic system (this is in line with Badiou's general program of treating mathematics as "ontology", as a means for systematically demarcating what is thinkable of "being as such").
In terms of "interest to mathematicians": Badiou's early text The Concept of Model is a good philosophical introduction to model theory, and his Number and Numbers is an interesting and accessible guide to the philosophy of number, covering Frege, Peano, Cantor, Dedekind and Conway (surreal numbers).

A: No, there is absolutely nothing at all. It's empty metaphor.  I read through the wikipedia page, and the thing about the axiom of choice stood out as nonsense, so I looked it up.  Badiou associates the axiom of choice with "anarchic representation" and "a principle of infinite liberty."  That clinched it for me.
I don't know if this was the answer you were looking for, but it looks to me like standard philosophical tripe.


text:
Q: do not adding to database in java jsp I want to add a person with name and password to the database with a register button on reg.html. User fill username and password and then press register button and information will be added to database. But my code is not work properly.
public void addPerson(String username, String password) {
    if (con == null) {
        System.out.println("no connection");
        connect();
    }
    try {
        Statement state = con.createStatement();
        ResultSet rs = state.executeQuery("INSERT INTO users VALUES ('" +      username + "', '" + password + "'");
        rs.next();

    } catch (Exception e) {
        e.printStackTrace();

    }

}

This is the reg.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>

Hello World!

<jsp:useBean id="bean1" scope="session" class="veri.kisi" />
<jsp:setProperty name="bean1" property="username"/>
<jsp:setProperty name="bean1" property="password" />

This is the kisi.java
public void insertPerson() {
    DatabaseLayer layer = new DatabaseLayer();
    layer.addPerson(username, password);
}

A: Please take a note of the above comments given by others, they can prove to be vital to make your code secured while inserting data in database from online sources.
 public void addPerson(String username, String password) {
if (con == null) {
    System.out.println("no connection");
    connect();
}
try {
    Statement state = con.createStatement();
    state.execute("INSERT INTO users VALUES ('" +      username + "', '" + password + "'");

} catch (Exception e) {
    e.printStackTrace();

}

}

The ResultSet object is used to iterate over the rows of tables in database, not to insert queries into database.

A: Before doing any updaes i would suggest that you set con.autocommit to false. Then Use state.executeUpdate(); It will return an int type. Check if that int is > 0. and then only do a commit job by calling con.commit().

A: No need to use ResultSet since insert is not query. For this you may use PreparedStatement. Replace try block code with the following lines.
PreparedStatement ps = con.prepareStatement("insert into users values (?,?)");
ps.setString(1, username);
ps.setString(2, password);
ps.execute();


text:
Q: Can not install Visual Studio 2017 I am trying to install Visual Studio 2017 on my Windows 10 Machine. I have tried as both an adminstrator and not as an administrator.
I get the following errors and install fails:
The product failed to install the listed workloads and components due to one or more package failures.

Incomplete workloads
    Desktop development with C++ (Microsoft.VisualStudio.Workload.NativeDesktop,version=15.0.26403.0)
    Linux development with C++ (Microsoft.VisualStudio.Workload.NativeCrossPlat,version=15.0.26323.1)
    Node.js development (Microsoft.VisualStudio.Workload.Node,version=15.0.26323.1)
    Visual Studio core editor (Microsoft.VisualStudio.Workload.CoreEditor,version=15.0.26228.0)

Incomplete components
    Architecture tools for C++ (Microsoft.VisualStudio.ComponentGroup.ArchitectureTools.Native,version=15.0.26208.0)
    C++ profiling tools (Microsoft.VisualStudio.Component.VC.DiagnosticTools,version=15.0.26208.0)
    Class Designer (Microsoft.VisualStudio.Component.ClassDesigner,version=15.0.26208.0)
    Code Map (Microsoft.VisualStudio.Component.CodeMap,version=15.0.26208.0)
    Connectivity and publishing tools (Microsoft.VisualStudio.Component.Common.Azure.Tools,version=1.9.170119.3)
    Developer Analytics tools (Microsoft.VisualStudio.Component.AppInsights.Tools,version=15.0.26323.1)
    DGML editor (Microsoft.VisualStudio.Component.GraphDocument,version=15.0.26208.0)
    Graphics debugger and GPU profiler for DirectX (Microsoft.VisualStudio.Component.Graphics.Tools,version=15.0.26208.0)
    JavaScript and TypeScript language support (Microsoft.VisualStudio.Component.JavaScript.TypeScript,version=15.0.26412.1)
    JavaScript diagnostics (Microsoft.VisualStudio.Component.JavaScript.Diagnostics,version=15.0.26208.0)
    Just-In-Time debugger (Microsoft.VisualStudio.Component.Debugger.JustInTime,version=15.0.26208.0)
    Node.js support (Microsoft.VisualStudio.Component.Node.Tools,version=15.0.26323.1)
    Profiling tools (Microsoft.VisualStudio.Component.DiagnosticTools,version=15.0.26208.0)
    Text Template Transformation (Microsoft.VisualStudio.Component.TextTemplating,version=15.0.26208.0)
    Visual C++ core desktop features (Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core,version=15.0.26323.1)
    Visual C++ for Linux Development (Component.MDD.Linux,version=15.0.26208.0)
    Visual C++ tools for CMake (Microsoft.VisualStudio.Component.VC.CMake.Project,version=15.0.26208.0)
    Visual Studio C++ core features (Microsoft.VisualStudio.Component.VC.CoreIde,version=15.0.26208.0)
    Visual Studio core editor (Microsoft.VisualStudio.Component.CoreEditor,version=15.0.26208.0)
    Web Deploy (Microsoft.VisualStudio.Component.WebDeploy,version=15.0.26208.0)
    WebSocket4Net (Component.WebSocket,version=15.0.26208.0)

You can search for solutions using the information below, modify your selections for the above workloads and components and retry the installation, or remove the product from your machine.

Following is a collection of individual package failures that led to the incomplete workloads and components above. To search for existing reports of these specific problems, please copy and paste the URL from each package failure into a web browser. If the issue has already been reported, you can find solutions or workarounds there. If the issue has not been reported, you can create a new issue where other people will be able to find solutions or workarounds.

Package 'Microsoft.VisualStudio.MinShell,version=15.0.26430.4' failed to install.
    Search URL: https://aka.ms/VSSetupErrorReports?q=PackageId=Microsoft.VisualStudio.MinShell;PackageAction=Install;ReturnCode=-2147024864
    Impacted workloads
        Desktop development with C++ (Microsoft.VisualStudio.Workload.NativeDesktop,version=15.0.26403.0)
        Linux development with C++ (Microsoft.VisualStudio.Workload.NativeCrossPlat,version=15.0.26323.1)
        Node.js development (Microsoft.VisualStudio.Workload.Node,version=15.0.26323.1)
        Visual Studio core editor (Microsoft.VisualStudio.Workload.CoreEditor,version=15.0.26228.0)
    Impacted components
        Architecture tools for C++ (Microsoft.VisualStudio.ComponentGroup.ArchitectureTools.Native,version=15.0.26208.0)
        C++ profiling tools (Microsoft.VisualStudio.Component.VC.DiagnosticTools,version=15.0.26208.0)
        Class Designer (Microsoft.VisualStudio.Component.ClassDesigner,version=15.0.26208.0)
        Code Map (Microsoft.VisualStudio.Component.CodeMap,version=15.0.26208.0)
        Connectivity and publishing tools (Microsoft.VisualStudio.Component.Common.Azure.Tools,version=1.9.170119.3)
        Developer Analytics tools (Microsoft.VisualStudio.Component.AppInsights.Tools,version=15.0.26323.1)
        DGML editor (Microsoft.VisualStudio.Component.GraphDocument,version=15.0.26208.0)
        Graphics debugger and GPU profiler for DirectX (Microsoft.VisualStudio.Component.Graphics.Tools,version=15.0.26208.0)
        JavaScript and TypeScript language support (Microsoft.VisualStudio.Component.JavaScript.TypeScript,version=15.0.26412.1)
        JavaScript diagnostics (Microsoft.VisualStudio.Component.JavaScript.Diagnostics,version=15.0.26208.0)
        Just-In-Time debugger (Microsoft.VisualStudio.Component.Debugger.JustInTime,version=15.0.26208.0)
        Node.js support (Microsoft.VisualStudio.Component.Node.Tools,version=15.0.26323.1)
        Profiling tools (Microsoft.VisualStudio.Component.DiagnosticTools,version=15.0.26208.0)
        Text Template Transformation (Microsoft.VisualStudio.Component.TextTemplating,version=15.0.26208.0)
        Visual C++ core desktop features (Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core,version=15.0.26323.1)
        Visual C++ for Linux Development (Component.MDD.Linux,version=15.0.26208.0)
        Visual C++ tools for CMake (Microsoft.VisualStudio.Component.VC.CMake.Project,version=15.0.26208.0)
        Visual Studio C++ core features (Microsoft.VisualStudio.Component.VC.CoreIde,version=15.0.26208.0)
        Visual Studio core editor (Microsoft.VisualStudio.Component.CoreEditor,version=15.0.26208.0)
        Web Deploy (Microsoft.VisualStudio.Component.WebDeploy,version=15.0.26208.0)
        WebSocket4Net (Component.WebSocket,version=15.0.26208.0)
    Log
        C:\TEMP\dd_setup_20170615130916_003_Microsoft.VisualStudio.MinShell.log
    Details
        Return code: -2147024864
        Return code details: The process cannot access the file 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PrivateAssemblies\CheckHyperVHost.exe' because it is being used by another process.

I ran handle for CheckHyperVHost.exe and it does not show any program with a handle to that file.
Additionally, I checked this similar question and confirmed that I have no antivirus software installed on this machine.


text:
Q: .net Core Authenticate with only WS-Fed We are adding a new .net core web application into an existing environment, the center of which is an Identity Server 2 for authentication.  When creating the new application I am having trouble getting it to use the existing authentication.
The goal is for every page in the new app to require a logged-in user.  The new application has some user tables, but should not require the default Identity database (AspNetUsers, etc.) nor should it need its own login dialogs (nor password recovery, etc.).
To do this, I have added the following to our Startup.cs file in ConfigureServices():
01:services.AddTransient<IUserStore<ApplicationUser>, E360UserStore<ApplicationUser>>();
02:services.AddTransient<IRoleStore<ApplicationRole<string>>, E360RoleStore<ApplicationRole<string>>>();
03:
04:var authenticationConfigSection = Configuration.GetSection("Authentication");
05:
06:services.AddAuthentication(/*"WsFederation"*/)
07:        .AddWsFederation(authenticationScheme: "WsFederation",
08:                         displayName: "Single Signin",
09:                         configureOptions: options =>
10:                         {
11:                             // MetadataAddress represents the Identity Server instance used to authenticate users.
12:                             options.MetadataAddress = authenticationConfigSection.GetValue<string>("MetadataAddress");
13:
14:                             // Wtrealm is the app's relying party identifier in the IS instance.
15:                             options.Wtrealm = authenticationConfigSection.GetValue<string>("Wtrealm");
16:
17:                             //options.SignInScheme = "WsFederation";
18:                         });
19:
20:services.AddMvc(config =>
21:                {
22:                    var policy = new AuthorizationPolicyBuilder(/*"WsFederation"*/)
23:                                 .RequireAuthenticatedUser()
24:                                 .Build();
25:
26:                    config.Filters.Add(new AuthorizeFilter(policy));
28:                })
29:        .AddJsonOptions(o => o.SerializerSettings.ContractResolver = new DefaultContractResolver())
30:        .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

This produces the error, "No authenticationScheme was specified, and there was no DefaultChallengeScheme found."  So, I try uncommenting the three "WsFederation" strings, one at a time.
I try uncommenting the last one first:
22:var policy = new AuthorizationPolicyBuilder("WsFederation")
23:             .RequireAuthenticatedUser()
24:             .Build();

This produces the similar but different error, "No authenticationScheme was specified, and there was no DefaultAuthenticateScheme found."
If I instead uncomment either of the other lines (or both):
06:services.AddAuthentication("WsFederation")
17:options.SignInScheme = "WsFederation";

This produces the error, "The SignInScheme for a remote authentication handler cannot be set to itself. If it was not explicitly set, the AuthenticationOptions.DefaultSignInScheme or DefaultScheme is used."
If I configure the application for "normal" authentication, like this:
services.AddDbContext<ApplicationDbContext>(options =>
    options.UseSqlServer(
        Configuration.GetConnectionString("DefaultConnection")));

services.AddDefaultIdentity<ApplicationUser>()
    .AddEntityFrameworkStores<ApplicationDbContext>();

services.AddIdentity<ApplicationUser, IdentityRole>()
        .AddEntityFrameworkStores<ApplicationDbContext>()
        .AddDefaultTokenProviders();

I then get a login dialog with a button on the right marked, "Single Signin" that works just fine.  The claims from the WsFederation login maps to users manually created in a generated Identity database.
My intent with the E360UserStore and E360RoleStore in the new model are to map to IdentityUser in FindByIdAsync() (I haven't been able to test this):
public class ApplicationUser : IdentityUser
{
    public User User { get; set; }

    public ApplicationUser(User user)
    {
        base.Id = User.IdentityGuid.ToString("D");
        base.Email = user.Person.EmailAddress;
        base.NormalizedEmail = user.Person.EmailAddress.ToLowerInvariant();
        base.UserName = user.Username;
        base.NormalizedUserName = user.Username.ToLowerInvariant();
        base.EmailConfirmed = true;
        User = user;
    }
}

I can't seem to find the secret sauce that removes the "default" login and instead automatically redirects to the Identity Server login.
Thanks for reading!
Update:
@Rytmis suggested that what I was missing was defining the cookies that would indicate that the application is "logged in" which is a great observation, but I'm still missing a piece since I don't understand how I go from WS-Fed to the cookie auth (to identify the current user).  I changed my ConfigureServices code as shown below, which does cause the program to immediately redirect to the identity Server, which is perfect, and after login it redirects back to the ws-fed endpoint, which then redirects back to the initial page.  All that is good news, but the initial page still doesn't see the user as logged-in.  The cookie is created, but I don't see how, where, or if the login gets converted from ws-fed to the cookie?  I defined custom IUserStore and IRoleStore classes, but those aren't being used or even instantiated.
services.AddAuthentication(sharedOptions =>
                           {
                               sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                               sharedOptions.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                               sharedOptions.DefaultChallengeScheme = WsFederationDefaults.AuthenticationScheme;
                           })
        .AddWsFederation(authenticationScheme: "WsFederation",
                         displayName: "Single Signin",
                         configureOptions: options =>
                                           {
                                               // MetadataAddress represents the Identity Server instance used to authenticate users.
                                               options.MetadataAddress = authenticationConfigSection.GetValue<string>("MetadataAddress");

                                               // Wtrealm is the app's relying party identifier in the IS instance.
                                               options.Wtrealm = authenticationConfigSection.GetValue<string>("Wtrealm");

                                               //options.SignInScheme = "WsFederation";
                                           })
        .AddCookie(options =>
                   {
                       options.Cookie.SameSite = SameSiteMode.None;
                       options.Cookie.Name = "AuthCookie";
                       options.AccessDeniedPath = "/error/accessdenied";
                   });

services.AddScoped<UserManager<ApplicationUser>, UserManager<ApplicationUser>>();
services.AddTransient<IUserStore<ApplicationUser>, MyUserStore<ApplicationUser>>();
services.AddTransient<IRoleStore<ApplicationRole<string>>, MyRoleStore<ApplicationRole<string>>>();

A: The thing with remote authentication is that you will have to store something locally unless you want to perform a remote auth redirect on every request -- which nobody does.
In addition to the remote scheme, you'll want to specify a local authentication scheme that will be used to store the results of the remote authentication. This is typically done by adding the Cookie authentication handler and using it as a SignInScheme.


text:
Q: Calling a method that created in helper method I created this helper:
public static MvcHtmlString MyPlayer(this HtmlHelper helper, string mediafile, int height, int width)
{
    var player =
        @"<embed height=""{0}"" width=""{1}"" flashvars=""...""
                        allowfullscreen=""true""
                        quality=""high""
                        name="" src=""...""
                        type=""application/x-shockwave-flash"">";

    player = string.Format(player, height, width, mediafile);
    return new MvcHtmlString(player);
}

Now I want to show the video in Razor. So I call this helper in razor like this:
My View:
@{
    ViewBag.Title = "Index";
}

Index

@Html.MyPlayer("ViedoCodeformediafileparameter", 400, 500)

My question is: In page source it just generates an embed tag. Should I use any player tag like video to play this video? If so, How should I use it in this case that I use helper method because currently it shows nothing?


text:
Q: Laravel 5 automatically session expiring I am developing an application in laravel 5, when the user logins i am showing a view file which contains more than 100 images and showing one after the with next and previous buttons using jquery. Everything is working fine if images path is given correct.
$img = $question_images[$i];
$img_path = url("frontend/questions/".$img);
$new_question = str_ireplace($img,"<img src='$img_path' class='img-responsive' oncontextmenu='return false' draggable='false'>",$new_question);

This is my logic as per the requirement. For development changes i moved all the images to questions_old folder and now questions folder is empty. Now the view file doesn't show images which i know, but when i refresh the page it is automatically expiring session and loggs out the user, how is this happening ? when images are in questions folder everything is working fine. How and why this wrong images path makes session out.?


text:
Q: What type of exception should be thrown in JavaScript? What type of object should be thrown in JavaScript?
I see a lot of examples which throw a plain old string and there seems to be a semi-standard Error type. Should I prefer one over the other?

A: The Error object and specific error objects such as TypeError are fully standardized in the ECMAScript specification. There are, however, common non-standard properties of these objects available in most browsers.
You can throw whatever you like, so long as your error handling code knows what to do with the objects you throw, but there are advantages to using Error objects:

*

*Consistency with handling errors thrown by native code, such as having a message property, so you don't have to write different code to handle native errors and your own errors;

*Error objects in Mozilla and other browsers have very useful non-standard properties, such as fileName, lineNumber and stack. You only get these on Error objects and they can be very useful for debugging.


text:
Q: Matlab: Creating maps of groups and indicies of duplicates in an array I have two Matlab arrays A(containing groups of numbers) and B(containing values that belong to the groups in A), there are repeats in array A
A = [1 1 1 2 2 3 4 4 4 4 4]
B = [1 2 3 3 5 4 4 1 6 7 8]

Now i would like to get the following two maps:
 C = ['1': {1,2,3}, '2': {3,5}, '3':{4}, '4':{1,6,7,8}]

where C gives a map with the group number as index and related values in that particular group.
D = ['1':{2,4},'2':{1},'3':{4},'4':{1}]

Where D gives a map with the group number from A as index. The values are the group numbers from A for which there are repeated values in B for that particular sub group.
What is the most efficient way of dealing with this problem? Are maps a good data structure to store this kind of data. I know the first one can be dealt with a for loop which i would like to avoid.

A: I don't understand how you get to D.
For C, you can use accumarray:
C = accumarray(A,B,[],@(x){x})

C{1} is [1 2 3]


text:
Q: Proof of representation of a subset of real numbers I apologize for the poor title, if anyone can think of a better one and a better tag I would appreciate it. I am trying to prove this statement, which I need to complete a step in a proof.
Let $(y_1,\dots,y_n) \in \mathbb{R}^n$ and $\{a_{ij} \mid 1\leq i \leq n,1\leq j \leq n\}$ be set of fixed real numbers such that for each $i$, there exists a $j$ such that $a_{ij}\neq 0$, and similarly, for each $j$, there exists a $i$ such that $a_{ij}\neq 0$.Then there exist $x_1,\dots x_n \in \mathbb{R}$ such that $y_i=\sum_{j=1}^n a_{ij} x_j$ for each $1 \leq i \leq n$.
I have played around with it and cannot get anywhere at all. Any ideas?


text:
Q: Agile User Stories and acceptance criteria I am writing some agile user stories and acceptance stories for the first time, and was hoping for some feedback from an experienced product manager or developer.
I only need to capture the main points in the acceptance criteria.
User Story
AS A registered jobseeker, I WANT TO create and edit my CV on the user interface on my mobile device SO THAT employers and recruiters can view my career summary and contact details
Acceptance Criteria

*

*The user must sign into a registered account to create a CV

*The user cannot save a CV unless all the mandatory fields on the form are complete

*The user should be able to edit and delete the form at any time

*Data from the saved form is stored in the CV database

*Only registered Recruiters and Employers can view the users CV and contact details

*The jobseekers user account is linked and synchronised on both mobile and desktop versions
Does this acceptance criteria sounds suitable for the given user story? Is there any way they can be more focused, and if so how?

A: This is excellent. Your story makes sense, and you had a first shot at the acceptance criteria. Now, instead of checking it with this forum, check it with your team. Stimulate them to ask questions and extend the A.C. accordingly.
But since you specifically ask:
The Story:

*

*I would omit the "in the interface" from my user story.

*The story is potentially large. You could anticipate a split: (editing existing CV, creating new CV, viewing by recruiter).

The Acceptance criteria: If I were a team member at the planning meeting, I would ask more clarity about the following:

*

*It is not clear to me how the recruiters will view the CV. Is this also on a mobile device? Does this already exist? Otherwise the team will need more details about this.

*Which fields need to be implemented? Was this form already implemented in a web/desktop app? If so, then you can explicitly mention in your acceptance criteria that the mobile app should offer the exact same fields.

*Any data validation on these fields (eg. can I just enter "X" day of birth)

A: The story itself looks good and the first four acceptance criteria as well. They all relate directly to what the user is trying to accomplish with this story.
The last two acceptance criteria, I have my doubts about. They seem to belong to different stories (a story for Recruiters/Employers accessing the CV database and a story for using the service from both mobile and desktop environment).


text:
Q: enable button when fileupload has file I have two image button is disable, I wish to enable it when there is a file in fileupload control. I search through the online resources they will have a button. But how can I do it when user selected a file and both image button will be prompt?
you answer and comment will be appreaciated.
code below is javascript code.
<script>
        function fnCallback() {
            $("#ImageButton2").show();
        }
</script>

follow by asp.net code.
<asp:FileUpload ID="FileUpload1" runat="server" onChange="fnCallback();"/>

<asp:ImageButton ID="ImageButton2" runat="server" Width="20px" Height="20px" ImageUrl="~/Image/save-btn.png" style="display:none;"/>

A: You can do it from client side,
By calling a javascript function on filecontrol onChange event
<asp:FileUpload ID="FileUpload1" runat="server" onChange='fnCallback();' />
<asp:ImageButton ID="ImageButton1" runat="server" style="display:none;"
  ImageUrl="~/imagePath"  />

function fnCallback() {
    // $("#ImageButton1").show(); In jQuery
    document.getElementById("ImageButton1").style.display = "block"; // In JavaScript
 }

A:   function importMember(courseSelectImport,value){
    if ( courseSelectImport && value) {
      jQuery('#csvsubmite').attr('disabled',false);
      jQuery( '#csvsubmite' ).addClass( "importbtn" );
    } else {
       jQuery('#csvsubmite').attr('disabled',true);
       jQuery('#csvsubmite' ).removeClass( "importbtn" );
    }
  }
  jQuery('input:file').change(function(){
    let value = jQuery(this).val();
    let courseSelectImport = jQuery('#courseSelectImport').val();
    importMember(courseSelectImport,value);
  });

  jQuery('#courseSelectImport').on('change',function(){
    let courseSelectImport = jQuery(this).val();
    let fileVal = jQuery('input:file').val();
    importMember(courseSelectImport,fileVal);
  });

<label class="col-md-4 mb-0 text-right">Course</label>
 <select name="courseSelectImport" id="courseSelectImport" class="custom-select">
  <option value="">All</option>
</select>
<input type='file' name='membercsv' accept=".csv">
<input type='submit' name='submit' id="csvsubmite" value='Import'  disabled>


text:
Q: Solve equation of a sum containing round operator I need to get some integer values (that is why I'm using the rounding operator $[x]$) that when added together yield a zero.
I start with an array of $a$ values ($n$ is finite, it can be $n = 10$ for instance) that are real values, and then there is this $x$ variable (a real number also) that I want to get the solution that satisfies this equation:
$$\sum_{i=1}^{n}{[a_i-x]} = 0$$
I have been solving this problem with an iterative "method", but there has to be some better way to solve this... right?
Edit: The "iterative method" I was talking about just consists in plugging a value of $x$, calculating the result and it is $0$ then the process ends, if it is $>0$ then I plug a smaller value of $x$ and if it's $<0$ then $x$ is increased.
Thanks to everybody in advance!


text:
Q: How to convert negative double value to binary value in java? The following is the double value
-1.2316741412499997E8

The following is the method i am using :
Long.toBinaryString(Double.doubleToRawLongBits(-1.2316741412499997E8))
output: 1100000110011101010111011000101011011000011111111111111111111110

However when i tried doing it with value 2 i get the following output as shown below which is wrong.
Long.toBinaryString(Double.doubleToRawLongBits(2.0))
output: 100000000000000000000000000000000000000000000000000000000000000

Will someone tell me how do i convert a  negative double value  to binary.Thanks in advance.

A: I'm not sure what result you would like, but the result for 2.0 is absolutely correct.
Note that the number it gives is not zero padded, so it may seem to have the sign bit set, but the bit set is the highest bit of the exponent.

A: Floating point values (such as double) are represented completely different from integer values. From integer values you are used to them being represented as a zero-padded (for positive numbers) binary number which represents the same number in base 2. This does not hold true for floating point values.
By definition floating point values have a floating decimal point, so the binary number has to encode the information on where the decimal point is. This is done by reshaping the number to the following:
(+/-) x * 2^y   whereas 0 <= x < 2 (= 10 base 2)

(+/-) is the sign which takes one bit. x is the mantissa, y the exponent. So the binary representation has to encode three pieces in the end.
Since 0 <= x < 2, x always starts with 1.something, so the 1. need not be in the representation. Only the part after the decimal point is saved, which is considered the significand.
In your example, 2.0 is reshaped to:
+ 1.0 * 2 ^ 1

Sign: +
Significand: 0
Exponent: 1
This happens to be represented as
0 10000000000 0000000000000000000000000000000000000000000000000000

For negative numbers the sign is - which is represented as a leading 1:
1 10000000000 0000000000000000000000000000000000000000000000000000

Note that your original posts lists a number that is missing the leading 0 which is mathematically correct but misleading when you try to capture the binary representation:
  10000000000 0000000000000000000000000000000000000000000000000000 =
0 10000000000 0000000000000000000000000000000000000000000000000000

There are some more details to understand and keep in mind. For example the exponent can be negative, too. You can find a more elaborate explanation in the Floating Point Wikipedia article. binaryconvert.com as referenced by Joachim can also help you understand the representation.

A: Is this what you want?
System.out.println(Long.toBinaryString(Double.valueOf(2.0).longValue()));
System.out.println(Long.toBinaryString(Double.valueOf(-2.0).longValue()));


text:
Q: Applying noise with constraints I need to add noise distribution. Noise from a normal distribution would be best.

*

*An input vector ${x} \in [0,1]$ is given which the vector sums to one.

*A noise is generated and applied to $x$

*The resulting noised $x$ should still sum to 1 and in range $x\in[0,1]$. And the weights of the elements are not too far off from the original input.

How can I achieve this?
I tried generating noise from noise and normalizing it with dividing with the sum. But some noise is negative, so summation could end up with 0 denominator.

A: There are plenty of ways to tackle the problem, but adding normal noise with no restrictions is going to make things a bit harder for you given your constraints.
Perhaps a more stable option, which avoids the issues of negative values entirely, is to consider multiplicative rather than additive noise. If we draw $\delta_i$ from some distribution of strictly positive values, then we can take $y_i = x_i \delta_i$, and then setting $x_i' = \frac{y_i}{\sum y_j}$ gives us:

*

*$x_i' \geq 0$

*$\sum x_i' = 1$
Which are two of the desired properties. The third property, wanting $x_i'$ to be somehow "close" to $x_i$, will come by choosing a distribution for $\delta_i$ that is centred around 1 and isn't too variable. One option is to make $\delta_i \sim U(1-d,1+d)$ with $d \in (0, 1)$.


text:
Q: Makefile: deleting intermediate files that don't have a dependency stackies!
Assiduous experimentation and searching have not found any solution to this seemingly-easy question.
In my build, .cc files depend on .proto files.  During the make process, the .proto files are translated into .cc and .h files, which are then collected and built into an executable.
How do I make sure that when I delete a .proto, the corresponding intermediate .cc file is automatically deleted in the make process?  (If it isn't, it gets brought into the next stages of the build and that has caused issues in the past.)
Right now, I simply clean out all the generated .cc/.h files when I delete or rename a .proto - this is correct, but triggers a rebuild of almost the entire system.
Thanks in advance...!

A: You could write a rule like clean, but less stringent:
SOURCES = $(PROTOS:.proto=.cc)

.PHONY: tidy
tidy:
        @rm $(filter-out $(SOURCES), $(wildcard *.cc))

You could then launch this rule manually, or make it an order-only prerequisite of your executable.
Or you could just put the same command in the rule for your executable, but that's kind of inelegant.


text:
Q: Modifying label on android spinner control I have an android application with a spinner control that is backed by a database using a SimpleCursorAdapter.  I'd like to have a "custom" label on the selected item that will display two text fields from the database.  For example if there was set of records selected from the db that were something like a city state combination:
Las Vegas, Nevada
Las Vegas, New Mexico
The drop down would only show two "Las Vegas" records. Is there a way to have the spinner show "Las Vegas - Nevada" and "Las Vegas - New Mexico". I am not sure I can bind more than one text field to the actual text that displays or if I have to concatenate the values or what exactly.
Thanks

A:
Is there a way to have the spinner show "Las Vegas - Nevada" and "Las Vegas - New Mexico". I am not sure I can bind more than one text field to the actual text that displays or if I have to concatenate the values or what exactly.

You can bind as many "text fields" as you want. You supply the IDs of the TextView widgets, and the corresponding column names from the Cursor, in the SimpleCursorAdapter constructor.


text:
Q: Remove objects from NSArray I have a project with ARC.
I have an NSArray whit some object inside.
At certain point I need to change the object in the array.
Whit a NSMutableArray I'll do :
[array removeAllObjects];

and I'm sure that this method release all object contained in the array.
But with an NSArray I can't do that! So, my question is: if I set array to nil and then re-initialize it, the old object contained in the array are really released from memory ?
array = nil;
array = [[NSArray alloc] initWithArray:newArray];

Or I need to use NSMutableArray ?

A: The old array will be deallocated when there are no more strong references to it.  If you had the only strong reference to it, then when you set array to something else, it will be deallocated immediately.
When the old array is deallocated, it will release all of the objects it contains.  If there are no other strong references to those objects, they will also be deallocated immediately.
You don't have to set array = nil before setting it to the new array.

A: You can just do this:
array = newArray;

This will cause array to be released. When this NSArray gets deallocated, all contained objects will be released, too.

A: I would suggest NSMutableArray because there would not be overhead of allocation and deallocation again


text:
Q: Using libpng in C# if you want to save the image in PNG format you can use ImageFormat class of .Net.
But this class doesn't implemented compression for PNG files.
And for some reasons i can't save my file in JPEG format.
After Some researched i know libpng is the official PNG reference library.
But i can't find anything for using it in .net framework.
Does anyone know about this library and using it in .NET?
About libpng
Thanks in Advanced.

A: Another alternative: PngCs

But this class doesn't implemented compression for PNG files

What on earth does that mean? PNG is compressed by design.

A: ImageMagick is a very nice library that allows you (among other things) create PNG files.
Magick.NET is the .Net wrapper for this library. Using this library, you can simply convert/create image formats. E.g. from their documentation:
using (MagickImage image = new MagickImage("Snakeware.gif"))
{
   image.Write("Snakeware.jpg");
}

A: Since libpng it's written in C ( ANSI C, even better ) you can build a bridge between that library and your C# application -> Use a C library from C# code
There are also other options, such as freeimage and the port of ImageMagick to .net but in this case it's still unclear to me what kind of project is this one, I don't get if it's official or not, if it's already dead or alive, if you are interested you can search for that name.
In simple terms PNG it's a open standard where JPEG it's a world full of patents and royalties, for this reason some libraries do not offer jpeg features or they offer a limited set of jpeg related features/algorithms. PNG it's also a real imaging standard about a file format definition, jpeg it's more like a container.


text:
Q: How to define getter functions on a constructor function's newly created onjects? I have a class (constructor function) User
function User(id) {
    this._id = id;
}

from which I make my objects like user
var user = new User(9);

And I want to write getter function for this user object, but not actually particularly for it, but rather for all objects created by my constructor function User.
I though this should work but it isn't
Object.defineProperty(User, 'id', {
    get: function() {
        console.info('Using getter..');
        return this._id;
    },
    // set:function(val) { alert('set value'); }
});

var user = new User(9);

console.info(user.id); // gives undefined

I figured it's because User is a constructor function, and not actually an object, defining getter function like that doesn't work. Is it still possible some other way?

A: Figured it out. Just had to move the getter definition inside the constructor function itself, from where I can correctly use this.
function User(id) {
    this._id = id;

    Object.defineProperty(this, 'id', {
        get: function() {
            console.info('Using getter..');
            return this._id;
        },
        // set:function(val) { alert('set value'); }
    });
}

A: The way you have it set up, the _id property is public and accessible. Adding a getter function is superfluous.
To properly hide the inner variable to that object, you need to:
function User(id) {
    var _id = id;

    this.getID = function(){
        return _id;
    }
}

If you don't properly hide the variable, why bother writing a getter; The way you have it now, you can just do console.info((new User(12))._id). If you attach a variable to the this pointer, it makes it a public property of that class.


text:
Q: ActiveRecord, can I validates a has_and_belongs_to association? Yesterday, I was crazy because I couldn't do the validations in model, using a many-to-many relationship on ActiveRecord on Rails 4.1.6.
I tryed to use this gem: gem 'deferred_associations' suggested by: this blog
but did not succeded.
So I kill the MVC feelings... I did the validation in controller... :/
But for now I changed the relation and the business logic of my application.
But the question still stay with me.
Can someone explain to me how validates on has_and_belongs_to_many relation it's possible?
My regards!
UPDATE 01 to @User089247
     # My logic is simple: A question should has 3 or less answers.
     # A answer can be used in many questions.

     validates_associated :answers, if: :has_more_space?

      private
      def has_more_space?
        if answers.size > 3
          true
        else
          errors.add(:answers, "You can't do that!")
          false
        end
      end

A: I think you missed to see validates_associated method in Active Record Validations guide.
Here is an example:
class Book < ActiveRecord::Base
  has_and_belongs_to_many :authors

  validates_associated :authors
end

Make sure that you:

Don't use validates_associated on both ends of your associations. They
  would call each other in an infinite loop.

Since, what you're looking for is not exactly validating presence of an association, validates_associated won't work in your case. validates_associated validates the association's presence. For validating the count of associations your model can have, you'll have to create a custom validation like this:
validate :maximum_answers

private
def maximum_answers
  errors.add(:base, "You can't add more than 3 answers.") if self.reload.answers.count >= 3
end

A: Sounds like you need a custom validation
#in Author class

validate :must_have_3_books_or_less

def must_have_3_books_or_less
  if self.books_authors.size > 3
    self.errors.add_to_base("Author is required to have 3 books or less")
  end
end

A: Thanks for all of you that try to help me, but with time I have read the documentation, and I discovered this part:

You should use has_many :through if you need validations, callbacks,
  or extra attributes on the join model.

In other words, I was trying to do in the wrong form!
For now I know, if you don't  need to validate anything or else, use the has_and_belong_to_many because it's more simple and easier to use!
Thanks!!


text:
Q: How to prove that, if two numbers are equal $\mod2$ and$\mod3$ ,they are equal$\mod 6 $? I was wondering if it could be proved without using the Chinese remainder theorem, arithmetically.
Thank you

A: $2,3$ are relatively prime so $2|(m-n)$, $3|(m-n)$ implies $6|(m-n)$ meaning $m\equiv n \mod 6$.

A: If $c$ is a common multiple of $a$ and $b$, then $c$ is a multiple of their least common multiple $\operatorname{lcm}(a,b)$.
Apply this to $c=m-n$ and $a=2$ and $b=3$.


text:
Q: Is there a difference SMO ServerConnection transaction methods versus using the SqlConnectionObject property? I am using SMO to create databases and tables on a SQL Server.  I want to do so in a transaction.  Are both of these methods of doing so valid and equivalent:
First method:
Server server;
//...
server.ConnectionContext.BeginTransaction();
//...
server.ConnectionContext.CommitTransaction();

Second method:
Server server;
// ...
SqlConnection conn = server.ConnectionContext.SqlConnectionObject;
SqlTransaction trans = conn.BeginTransaction();
// ...
trans.Commit();

A: The two are equivalent. Using a SqlTransaction object allows you to place the transaction in an using scope:
using(SqlTransaction  trn = conn.BeginTransaction ())
{
 ...
 trn.Commit ();
}

This is a better pattern in presence of exceptions.


text:
Q: Why do some questions not start with an auxiliary verb? When I learned English, my teachers told me that all questions must have an auxiliary verb at the beginning, just like Are you mad? or Is she playing? do.
But when watching some movies or talking with people who speak English, they just ask using things like You mad? and She's playing?
Of course, the kind of intonation let me know they are asking a question, but why this happen?

A: Because real English speakers speak real English, and didn't learn it from your teachers.
Forms like You hungry? and She coming? are common in speech, but are very informal, and would not be found in most written contexts.

A: Your interesting question has two completely different examples.

*

*You mad?

*She's coming?

The first is a case of Conversational Deletion as described in John Lawler's answer here. This is when we miss out pronouns, auxiliaries and other grammatical words like that in informal speech and writing. It's sometimes called Diary Drop because it often happens in diaries. Many people have studied it in the diaries of famous authors like Virginia Woolf and Winston Churchill.
The second example though is NOT a case of conversational deletion. It is what is sometimes referred to as an Intonation Question. This is when the grammar does not show that the sentence is a question. The structure is the same as it would be for a declarative sentence. We therefore use intonation to show that we are making a question.
Again, we normally only do this in informal speech, and not very often. Learners of English overuse this if their first language only uses intonation and not grammar to mark interrogatives.
It is easy to show that there is no conversational deletion here:

*

*She (subject), is (auxiliary) coming (lexical verb)?

COME is an intransitive verb so there is no direct object here. All the parts of the sentence are present and correct. Nothing has been deleted. You can also see that the form of the question is exactly the same as the affirmative sentence: She is coming.

A: They do start with an auxiliary verb, but since it's predictable, it's often omitted.
These are examples of what's called Conversational Deletion in the literature.
The link has references and further examples.

A: I can think of several valid examples of questions that neither start with an auxiliary verb, nor have been pruned through conversational deletion:

Come again? [Idiomatic question construction meaning "Please repeat whatever it was you just said", or sometimes merely expressing disbelief]
In what way? [Seeking some kind of clarification]
By when? [Seeking clarification of a deadline or other time constraint]
Really? [Seeking confirmation of a purported fact]
Meaning what? [Seeking clarification]


text:
Q: Error while getting contacts in AsyncTask.doInBackground() method I am trying to fetch user contacts using AsyncTask class. Here is the code I wrote for this but this is not working:
protected Void doInBackground(Void... params) {
    ContentResolver cr = getContentResolver();
    Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null,
            null, null, null);

    if (cur.getCount() > 0) {
        while (cur.moveToNext()) {
            String id = cur.getString(cur
                    .getColumnIndex(ContactsContract.Contacts._ID));
            String name = cur
                    .getString(cur
                            .getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
            if (Integer
                    .parseInt(cur.getString(cur
                            .getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
                System.out.println("name : " + name + ", ID : " + id);
                // Result=Result+ "Name: "+name;
                // get the phone number
                Cursor pCur = cr.query(
                        ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                        null,
                        ContactsContract.CommonDataKinds.Phone.CONTACT_ID
                                + " = ?", new String[] { id }, null);
                while (pCur.moveToNext()) {
                    String phone = pCur
                            .getString(pCur
                                    .getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));

                    publishProgress("Name:" + name + ",Number:" + phone
                            + "\n");
                }
                pCur.close();
            }
        }
    }
    return null;
}

Here is the error log:
03-12 08:57:40.281: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:40.291: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:40.511: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:40.511: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.201: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.201: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.221: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.281: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.391: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.401: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.411: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.541: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.541: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.551: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.561: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.561: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.571: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.611: D/gralloc_goldfish(862): Emulator without GPU emulation detected.
03-12 08:57:41.691: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:41.781: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:42.571: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:42.581: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:42.581: W/dalvikvm(862): threadid=11: thread exiting with uncaught exception (group=0x40a70930)
03-12 08:57:42.631: E/AndroidRuntime(862): FATAL EXCEPTION: AsyncTask #1
03-12 08:57:42.631: E/AndroidRuntime(862): java.lang.RuntimeException: An error occured while executing doInBackground()
03-12 08:57:42.631: E/AndroidRuntime(862):  at android.os.AsyncTask$3.done(AsyncTask.java:299)
03-12 08:57:42.631: E/AndroidRuntime(862):  at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
03-12 08:57:42.631: E/AndroidRuntime(862):  at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
03-12 08:57:42.631: E/AndroidRuntime(862):  at java.util.concurrent.FutureTask.run(FutureTask.java:239)
03-12 08:57:42.631: E/AndroidRuntime(862):  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
03-12 08:57:42.631: E/AndroidRuntime(862):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-12 08:57:42.631: E/AndroidRuntime(862):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-12 08:57:42.631: E/AndroidRuntime(862):  at java.lang.Thread.run(Thread.java:856)
03-12 08:57:42.631: E/AndroidRuntime(862): Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://com.android.contacts/contacts from pid=862, uid=10058 requires android.permission.READ_CONTACTS, or grantUriPermission()
03-12 08:57:42.631: E/AndroidRuntime(862):  at android.os.Parcel.readException(Parcel.java:1425)
03-12 08:57:42.631: E/AndroidRuntime(862):  at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
03-12 08:57:42.631: E/AndroidRuntime(862):  at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
03-12 08:57:42.631: E/AndroidRuntime(862):  at android.content.ContentProviderProxy.query(ContentProviderNative.java:366)
03-12 08:57:42.631: E/AndroidRuntime(862):  at android.content.ContentResolver.query(ContentResolver.java:372)
03-12 08:57:42.631: E/AndroidRuntime(862):  at android.content.ContentResolver.query(ContentResolver.java:315)
03-12 08:57:42.631: E/AndroidRuntime(862):  at in.wptrafficanalyzer.asynctaskdemo.MainActivity$CountDownTask.doInBackground(MainActivity.java:45)
03-12 08:57:42.631: E/AndroidRuntime(862):  at in.wptrafficanalyzer.asynctaskdemo.MainActivity$CountDownTask.doInBackground(MainActivity.java:1)
03-12 08:57:42.631: E/AndroidRuntime(862):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-12 08:57:42.631: E/AndroidRuntime(862):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-12 08:57:42.631: E/AndroidRuntime(862):  ... 4 more
03-12 08:57:43.121: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:43.201: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:46.261: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:46.301: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:47.161: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:47.161: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:47.171: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:47.281: W/Trace(862): Unexpected value from nativeGetEnabledTags: 0
03-12 08:57:47.281: I/Choreographer(862): Skipped 72 frames!  The application may be doing too much work on its main thread.
03-12 08:57:56.445: I/Process(862): Sending signal. PID: 862 SIG: 9

A: You need to add the following permission to your Manifest:
<uses-permission android:name="android.permission.READ_CONTACTS" />

Which is clearly shown in your error log...
Apart from that, your code is quite inefficient. It is possible to get the information you want by doing much less queries:
Cursor cursor = getContentResolver ().query (
        ContactsContract.Data.CONTENT_URI,
        new String [] {
                ContactsContract.CommonDataKinds.Email.DATA,
                ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME},
                Data.MIMETYPE + " = ?",
                new String [] {ContactsContract.CommonDataKinds.Identity.CONTENT_ITEM_TYPE},
                ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME
            );

if (cursor.isAfterLast()) {
    cursor.close ();
    return null;
}

while (cursor.moveToNext ()) {
    String email = cursor.getString (cursor.getColumnIndex (ContactsContract.Contacts._ID));
    String name = cursor.getString (cursor.getColumnIndex (ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
}

A: Magic line is:
Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://com.android.contacts/contacts from pid=862, uid=10058 requires android.permission.READ_CONTACTS, or grantUriPermission()

Add at your manifest:
<uses-permission android:name="android.permission.READ_CONTACTS" />