JQuery targeting all Textarea is not working with .keyup

I have three text box on a page and each one has a different ID Class and located in different div. I am trying to target all the <textarea> on the page and running a function that will dosomething() if a user is still typing in the textarea. The problem is that it is only working on the #first textarea and the rest are just ignored. Below is the code I am using. Thanks!

$('#first, #second, .third').keyup(function(){
 if ($('#first, #second, .third').val()){
     alert("User is typing");

Dynamic pricing algorithm using R

I am trying to develop dynamic pricing model for a transport service provider. Till now, they have only fixed prices. So, I don’t have any historical data related to change in demand (in my case, number of seats sold) when price in increasing/decreasing. At this moment I am considering following variables:

  1. Month
  2. Days of the week
  3. Time of departure
  4. Time remain before departure
  5. Seat numbers

I did descriptive analysis about the above 5 variables to see the demand. But I am not getting any idea how to increase the price. For example, in my data, the route is completely vacationer routes. I have seen that in December, on weekends, between 9.00 pm to 6.00 am, 1 days before departure, and for seat number 1 to 20, there is high demand. I want to increase the price upto 10%. I have developed a rule based algorithm. But I am trying to develop data driven algorithm.

What algorithms (at this moment, I am trying to implement basic algorithm) I can use for this purpose?

I was thinking to implement markov decision process algorithm. I am assuming the transition matrix is unknown. But I am not getting any clue how to start with. I will be grateful if someone provide me a simple example of dynamic pricing.

I am using R and excel to develop dynamic pricing model.

Any kind of help will be appreciated!!

Cleaner way of returning HashMap’s Collection view?

I’m trying to understand the way of doing things in cleaner way. Correct me if I’m doing anything wrong, I have a function,

 Collection<Object> x(Collection<Object> input){
     Map<Double,Object> map = new HashMap<Double,Object>();
     //do some processing

     return map.values();

Now does this make Entry objects to live in the memory, as values() wrap entrySet(), in this scenario is it better to collect all values() Collection into another Collection and return and another thing is, are we leaking memory (unneeded objects)if we return HashMap’s Collection view?

how to find self signed certificate

I’m confused about website certificate verification. Please see details below:

Connection to the website(www.bitstamp.net) with python urllib2 threw:

urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)>

curl gave a similar error:

$ curl https://www.bitstamp.net
curl: (60) SSL certificate problem: self signed certificate in certificate chain

However, openssl shows each certificate verified (assuming “1” means verified):

$ openssl s_client -showcerts -connect www.bitstamp.net:443
depth=3 C = SE, O = AddTrust AB, OU = AddTrust External TTP Network, CN = AddTrust External CA Root
verify return:1
depth=2 C = GB, ST = Greater Manchester, L = Salford, O = COMODO CA Limited, CN = COMODO RSA Certification Authority
verify return:1
depth=1 C = GB, ST = Greater Manchester, L = Salford, O = COMODO CA Limited, CN = COMODO RSA Domain Validation Secure Server CA
verify return:1
depth=0 OU = Domain Control Validated, OU = Hosted by Incapsula Inc, OU = PositiveSSL Multi-Domain, CN = incapsula.com
verify return:1

What’s going on here? Is there a “self signed certificate” as claimed by curl? If so, which one?


Jaxb how to suppress a tagName but get the value

Using JAXB I am generating xml.The XML must look like

<elem id=101>
<field name=country>US</field>
<field name=criteria>Test criteria</field>

all internal contents are fields. I have java class called ‘field’ which has ‘name’ and ‘value’ string properties with getters and setters. ‘Elem’ class has ‘field’ as arraylist.
Using Jaxb when i marshal it contains “value” also inside field.
What is the efficient way to achieve this? Should i filter ‘value’ tag(suppress) or the java object structure should be changed?
What I am getting is this

<elem id=101>
<field name=country><value>US</value></field>
<field name=criteria><value>Test criteria</value></field>

The field class looks like below

import javax.xml.bind.annotation.XmlAttribute;
public class Field {
    private String name;
    private String value;
    public Field() {
    public Field(String name, String value) {
        this.name = name;
        this.value = value;
    public String getName() {
        return name;
    public void setName(String name) {
        this.name = name;
    public String getValue() {
        return value;
    public void setValue(String value) {
        this.value = value;

How to do a single row query with Android Room

How do I make a single row query with Android Room with RxJava? I am able to query for List of items, no issues. Here, I want to find if a specific row exists. According to the docs, looks like I can return Single and check for EmptyResultSetException exception if no row exists.

I can have something like:

@Query("SELECT * FROM Users WHERE userId = :id LIMIT 1")
Single<User> findByUserId(String userId);

How do I use this call? Looks like there is some onError / onSuccess but cannot find those methods on Single<>.


Any working example will be great!

POST https://stitch.mongodb.com/api/client/v2.0/app/facebookclone-tlwvi/functions/call 403 ()

enter image description here

MongoDB Users:
enter image description here

When I try to delete a document from MongoDB database deployed on Atlas, Forbidden error occurs. (Inserting works fine). Database name is- FbUsers,
Collection- ClonedFbUsers

Below is the code:

    <!DOCTYPE html>

 <link rel="stylesheet" type="text/css" href="style1.css">
<script src="https://s3.amazonaws.com/stitch- 

let db;
let itemsCollection;
let stClient;
let clientPromise = stitch.StitchClientFactory.create('facebookclone- 

function onLoadConnectDB(){
        db = stClient.service('mongodb', 'mongodb-atlas').db('FbUsers');


 function addUser(){
 var n= prompt("Your username: ")
const userId = stClient.authedId();
    itemsCollection.insertOne({ owner_id: stClient.authedId(), userName : n 
, profilePhoto: "NULL", photos: ["NULL"],comments: 
 [{msg:"NULL",time:"NULL",like:0}] })
    ).then(() => itemsCollection.find({}).execute())
  .then(docs =>
  docs.forEach((doc, index) =>
    console.log(`${index}: ${JSON.stringify(doc)}`)

 function deleteUser(){

var d= prompt("Username to delete: ");
const userId = stClient.authedId();

    itemsCollection.deleteOne({ userName: {$eq: d} })
    ).then(() => itemsCollection.find({}).execute())
.then(docs =>
  docs.forEach((doc, index) =>
    console.log(`${index}: ${JSON.stringify(doc)}`)
alert("User "+d+ " deleted.");



 <body onload="onLoadConnectDB()">

<p>Hello My App</p>

<div id="wlcom" align="center">
<button name="adding" onclick="addUser()">Add User</button><br>
<button name="deleting" onclick="deleteUser()">Delete User</button> <br>
<button name="logging">Login</button><br>


Spent many hours on the MongoDB user authentication, built-in roles etc which seems like less useful. Any help is appreciated

how can I pop an input box for a specific choice?

In jenkins I’d like to do this:

parameters {
            name: 'blah',
            choices: 'one\ntwo\ncustom',
            description: 'if you choose custom enter a custom number'

So they have three options on the drop down, but it would be nice if when they select the “custom” choice jenkins pops an input box to type in raw user input.

Is this possible? I don’t want to use user input during the pipeline run because that means they need to choose custom then wait for jenkins to get to the stage where it asks them for input.

“Uncaught TypeError: a.indexOf is not a function” error when opening new foundation project

I’ve created a new Foundation 5 project through bash, with foundation new my-project. When I open the index.html file in Chrome an Uncaught TypeError: a.indexOf is not a function error is shown in the console, originating in jquery.min.js:4.

I created the project following the steps on the foundation site, but I can’t seem to get rid of this error. Foundation and jQuery look like they are included and linked up correctly in the index.html file, and the linked app.js file is including $(document).foundation();

Does anyone know what is causing this error? and what a solution might be?

Console error message screenshot