How to favor exact matches in entity reference autocomplete?

Right now if you use entity reference autocomplete for short titles of a node type or entity type, and you have many items, due to the fact that by default they are ordered by entity id (nid), less relevant entries show up before exact matches.

For example, if you create a content type for stock symbols, and you have tens of thousands of them, and you want to search for “EA” or “DIS”, longer strings that contain these substrings show up before exact matches.

How can you change the behavior so exact matches show up before other matches with lower entity ids?

Reference request: Numerical methods for Hamilton-Jacobi-Bellman equations with state constraints

I have two questions on numerical methods for solving Hamilton-Jacobi-Bellman (HJB) equations with state constraints.

  1. Consider an optimal control problem given by $ $ v(x) = \max_{\{u(t)\}_t} \int_o^\infty e^{-\rho t}r(x(t), u(t))\, dt, \quad x(0) = x, $ $ subject to the law of motion $ $ \dot x = f(x(t),u(t))$ $ and the state constraint $ $ g(x) \ge 0. \tag1$ $ The HJB equation associated with this problem is given by $ $ \rho v(x)= \max_{u} r(x,u) + \nabla v(x) \cdot f(x,u),\tag2 $ $ where the state constraint (1) is imposed by requiring that $ v$ is subsolution of (2) at the boundary points $ \bar x \in \{x : g(x)=0\}$ .

The types of problems I am working on are typically solved numerically by the so called “upwind scheme” using finite difference methods. My question is, how to incorporate the state constraint $ g(x) \ge 0$ in these (or some other) numerical schemes. I have seen some papers considering one state and one control variable, but the methods in these papers seem to be quite 1-dimensional; I would need to handle a slightly more general case with two states and two controls. Thus, I am looking for a clear and comprehensive reference for the numerical (finite difference) methods handling this problem.

  1. To make the problem slightly more interesting, consider a sort of free boundary problem, where (1) is replaced by a more general constraint $ g(x,u)\ge 0$ depending also on the control variable $ u$ . Is there any theory for such problems (existence, uniqueness), and how about numerical methods for solving the problem? What would be the reference?

This question arises from macroeconomic models of the housing market, when imposing loan-to-value (LTV) collateral constraint of type $ B \le \theta PH$ , where $ B$ denotes the household debt, $ H$ denotes the amount of housing, $ \theta$ is a parameter describing maximal LTV ratio and $ P=P(H, u)$ is the (endogenously determined) price of housing, given the state $ x=(H,B)$ ; here $ $ g(x,u) = \theta PH-B.$ $

Macos reference manual [on hold]

all, I’m looking for a really good, exhaustive book on all the internal workings of macos, along the lines of Amit Singh’s “Mac OS X Internals” book from 2006, but that is a bit more up-to-date. I’ve come across Jonathan Levin’s “MacOS and iOS Internals” series that looks really good — can anyone suggest any other good ones? Thank you!

Reference entire row data or row-by-value from other sheets

I’ve a Google Spreadsheet where my first sheet is a Products table. The columns are SKU, Title, Price, Category, Type

I’ve some tasks in front of me where I need to create some bundles of different products. These varieres in number of products and categories and types.

I don’t know if this is possible with the Spreadsheet app or I have to find alternative methods but I would love if I could reference e.g. the SKU number or the Title instead of my Sheet cell.

So, in a new sheet called Bundle 01: Texture instead of saying =Products!A4 I somehow reference =Products!SKU015 and then the entire row from Products is inserted.
I can make calculations and aggregates on the price/total price and other variables and should I change a Product row in **Products sheet* it will automatically update across all sheets in that spreadsheet.

Beside the benefits listed above it would also create an easy and quick overview of each bundle, both for myself but also for other actors which have interest in these.

The closets I’ve come to using data across one spreadsheet is but this is just a reference to the cell.

Any help is deeply appreciated.

How to insert 2 docs (by reference) to mongodb (mongoose ODM)?

I am trying to insert 2 documents into mongodb (using mongoose) instance. I am using factories that export User1 and User2. when I run my test, assert complains that there is nothing being saved when I do the find() operation. My prior test (create a user) works perfectly. What am I doing wrong? I would like to keep using the ‘factory’ idea as my data set will grow in length as I develop other collections once I get past this User collection.

**user-test.js** it('creates a user', (done) => {    const user = new User(factories.User1()).save()      .then(() => {        expect(!user.isNew);        done();      });  });   // ** READ ALL  it.only('returns all users', (done) => {     const user1 = new User(factories.User1()).save();     const user2 = new User(factories.User2()).save();     User.find().then((docs) => {;        expect(docs).to.have.length(2);        done();    })  });  ** Sample of factories.js**  module.exports.User1 = () => {   return {     fname: "Tony",      mname: "Q",      lname: "snuggles",      comlPhone: 1234567890,      email: "",      username: "aqj",      hash: "ASDFGHJKLOIUYT1234"   }; }; 

undifined reference pthread_cancel

estoy haciendo un chat con sockets en c++ mediante hilos. Total, que tengo incluido todas las librerias necesarias, pero en una funcion que tengo para cancelar los hilos, uso el metodo “pthread_cancel”, cuando lo compilo me sale el siguiente error :

CMakeFiles/Socket.dir/main.cpp.o: In function `request_cancellation(std::thread&)': /home/k1k4ss0/CLionProjects/Socket/main.cpp:111: undefined reference to `pthread_cancel' CMakeFiles/Socket.dir/main.cpp.o: In function `std::thread::thread<void (*)(Socket&, sockaddr_in, std::__exception_ptr::exception_ptr&), std::reference_wrapper<Socket>, std::reference_wrapper<sockaddr_in>, std::reference_wrapper<std::__exception_ptr::exception_ptr> >(void (*&&)(Socket&, sockaddr_in, std::__exception_ptr::exception_ptr&), std::reference_wrapper<Socket>&&, std::reference_wrapper<sockaddr_in>&&, std::reference_wrapper<std::__exception_ptr::exception_ptr>&&)': /usr/include/c++/7/thread:122: undefined reference to `pthread_create' collect2: error: ld returned 1 exit status 

Las lineas a las que hacen referencia son las siguientes:

void request_cancellation(std::thread& thread) {           int cancelar=pthread_cancel(thread.native_handle());  // native handle se usa para obtener el manejador interno de tipo "pthread_t" codigo dado          if(cancelar!=0){              throw std::system_error(errno,std::system_category(),"El hilo no se ha podido cancelar");         }         else{             std::cout<<"Hilo eliminado correctamente"<<std::endl;          }     } 

La 111, donde tengo mi funcion para la cancelacion de hilos

Los hilos los creo de la siguiente forma :

std::thread *hilo1,*hilo2; 

Y son llamados en las siguientes lineas:

Manejador de señales:

 .... if (signum == SIGINT) {     std::cout << "¡Señal SIGINT interceptada!" << std::endl;     request_cancellation(*hilo2);     quick_exit(EXIT_SUCCESS);  // exit pero para hilos  }  ..... 

Y en el main:

....          try{             std::cout<<"Puerto a conectar: "<<puerto<<std::endl;             sockaddr_in  local=make_ip_address("", puerto);                    // usamos el puerto especificado con nuestra direccion local             sockaddr_in  destino=make_ip_address(ip_server, 1);                         // usarmos la direccion especificada, con el puerto 1              Socket here(local);                   // socket con la direccion local               std::exception_ptr eptr1{};              hilo1 = new std::thread(&enviar,std::ref(here),std::ref(destino),std::ref(eptr1));        // para especificar los parametros de enviar(...), hay que usar std::ref(parametro)                std::exception_ptr eptr2{};              hilo2 = new std::thread(&recibir,std::ref(here),std::ref(destino),std::ref(eptr2));                while (!quit);                                                              // hacemos bucles infinitos  hasta que se tenga que terminar aka quit==true             request_cancellation(*hilo1);   // mandamos a terminar el hilo 1             // llamamos a terminar los dos hilos             request_cancellation(*hilo2);   // mandamos a terminar el hilo 2             hilo1->join();    // Bloquear el hilo principal hasta que hilo1 termine      // obligamos al hilo principal a esperar que estos dos terminen             hilo2->join();    // Bloquear el hilo principal hasta que hilo2 termine                if(eptr1){                 std::rethrow_exception(eptr1);              }               if(eptr2){                 std::rethrow_exception(eptr2);              }             }         catch(std::bad_alloc& e){             std::cerr<<"mytalk :"<<": memoria insuficionte\n";             return 1;          }         catch(std::system_error& e){             std::cerr <<"mytalk" << ":" <<e.what()<<'\n';             return 2;          } 

Mathematical research in North Korea — reference request

Question: Where can one find information on which areas of mathematics are represented at which of the more than 20 universities in the Democratic People’s Republic of Korea (DPRK), and on which mathematicians are working there?

The DPRK is a country with a population of about 25 million people, and it is industrialised to a degree which has permitted it to successfully construct nuclear weapons and ICBM’s. So one would expect that there are a decent number of mathematicians working at its universities.

However as the country operates an intranet of its own, not much from there is visible from the open internet. — So in particular Google will not help much further here. Also, most results by researchers from the DPRK are published only in national journals, and mathematicians from the country cannot be found in the Mathematics Genealogy Database.

On the other hand, people in the DPRK who need the internet for their work do have access — of course with sites like Google or Facebook blocked as allowing these would open all doors for the CIA, the NSA et cetera. Also, the exchange of email between people in the DPRK and people elsewhere in the world is possible (possibly monitored, for the obvious reasons of national security — keep in mind that the US are formally still at war with the country, and have recently even threatened it with total destruction).

As a side note — general impressions from the country can be obtained from Korea Central TV (TV broadcasts on workdays from about 06:00 UTC to 13:30 UTC, thus from the morning to the early afternoon in European time zones, roughly during the night in American time zones and roughly in the afternoon and in the evening in Asian time zones). A documentation which has been broadcast there on January 5, 2019 can be watched here.

Important remark: Please stay on-topic! — In particular this is not the place to discuss politics. Everyone who would like to say something which does not belong here is welcome to contact me privately by email.