How do I load a JavaScript function when the view loads?

I have a view called "Program Search". I want to disable certain fields based on the Javascript function while the page is loading. I have already created a custom.js script. Not sure what the name of the function to load the program search page should be?

How do I create a javascript function that loads when the view page is loaded?

My page url is: https: // xyzdomain / program-search and I just want to notify "hello" while this page is loading. I'm new to Drupal – Javascript Combo. Any help ?!

Web server – is there a web server load balancer that supports location based algorithms?

I asked the same question in this post and it's closed and marked as non-thematic to get product recommendations.

Now I'm just asking Are there any web server load balancing tools that support location-based algorithms? Deliver data with the fastest response and lowest latency?

Note: I will not use / request external CDN solutions

How do I load entities with null values?

The exception is the result of how EntityStorageBase::loadByProperties() builds up the underlying WHERE Clause; it uses ::buildPropertyQuery() what throws NULL then used to an array IN operator to be compared; This won't work because you need one IS NULL Find query NULL Entries in the DB.

Instead, you can create your own entity store query in a similar way loadByProperties()::

$es = Drupal::entityTypeManager()->getStorage('foo_module_division')
$q = $es->getQuery();
$results = $q->condition('parent_code', NULL, 'IS')->condition('enabled', TRUE)->execute();
return $results ? $es->loadMultiple($results) : array();

Load entities with zero value into Drupal 8

The following fails with an invalid query exception

Drupal :: entityTypeManager () -> getStorage (& # 39; foo_module_division & # 39;) -> loadByProperties ((& # 39; enabled & # 39; => TRUE, & # 39; parent_code & # 39; => NULL)) .

How else do I specify that I want to load entities whose parent_code field is NULL

Web server – Are there distance-based algorithms for load balancing for web servers?

I want to know if there are any any Kind of Load balancing tool what support distance based Load distribution. I mean, for a perfect load balancing, maybe I just check my preferred algorithm icmp / ping response time from the visitor location to my different server locations and answer the visitor from the first feedback (since I know that the ping response time depends very much on the actual location and the distance and even if not, it has a direct impact on the delivery and response time).

I'm looking for it because I want to buy servers from different countries to reduce the latency of the main server so that content can be delivered to very distant clients from different locations and delivered as quickly as possible (reducing the TTFB to the minimum possible) .

I don't have any special web server or load balancing combination in mind and I have no experience in this area (but I currently prefer to use OpenLitespeed as a web server as there are very fast response times against Apache and Nginx). If you have experience with a combination with good results, it is nice to share your experience.

Software installation – Wargus cannot load game data

I just installed Wargus from Stratagus ppa.
I had it on my old computer where it worked well.
I can create a multiplayer game and connect from my laptop, but when I try to start the game it shows that the game data could not be loaded.
I can start a single player campaign.
I am using an ISO file from the Australian Warcraft 2 CD.
All correct files appear to be in ~ / .stratagus /
I have no idea where to start diagnosing this problem.
I want to try an earlier version, but couldn't find one.
I have Ubuntu 18.04 on my desktop and Lubuntu 16.04 on my laptop.

Any help would be appreciated.

Are the servers behind a load balancer replica or partition?

When it comes to load balancing (,
Do people assume that the servers behind a load balancer are replicas or partitions or something else?

  • With replication, Load Balancer can forward a request to any server.

  • For partitions, the load balancer can only forward a request to a server. I imagine that what data is stored on each server has to be adjusted in order to balance the loads between the servers.

Thanks a lot.

java – code to save / load a class object

I have an Objective class in use. There can only be one destination that I need to save / load. I do that with SharedPreferences and Gson. Could you take this code into account and report its shortcomings?

public class Objective {

    private float objectiveWeight;
    private float currentWeight;
    private long finalDate;

    private static Gson gson = new Gson();

    public Objective(float objectiveWeight, float currentWeight, long finalDate) {
        this.objectiveWeight = objectiveWeight;
        this.currentWeight = currentWeight;
        this.finalDate = finalDate;

    public float getCurrentWeight() {
        return currentWeight;

    public void setCurrentWeight(float currentWeight) {
        this.currentWeight = currentWeight;

    public float getObjectiveWeight() {
        return objectiveWeight;

    public void setObjectiveWeight(float objectiveWeight) {
        this.objectiveWeight = objectiveWeight;

    public long getFinalDate() {
        return finalDate;

    public void setFinalDate(long finalDate) {
        this.finalDate = finalDate;

    public static Objective loadObjective(Context context){
        SharedPreferences settings = context.getSharedPreferences(OBJECTIVE_SAVE_KEY, Context.MODE_PRIVATE);
        String json = settings.getString(OBJECTIVE_SAVE_KEY,null);
        return gson.fromJson(json,Objective.class);

    public static void saveObjective(Objective objective,Context context){
        SharedPreferences settings = context.getSharedPreferences(OBJECTIVE_SAVE_KEY, Context.MODE_PRIVATE);
        String json = gson.toJson(objective);

Javascript – How do I ONLY load RECAPTCHA scripts when I click the "Submit" button on the form?

When I looked at the performance of my website in GTMETRIX, I found that the Recaptcha scripts cause my score to drop significantly.

I only use recaptcha for search and comment forms. Less than 0.01% of hits use these forms. So I wanted the Recaptcha script to be called ONLY when visitors click the comment submission form.

Recaptcha script