keyboard – Should I use the name “Enter” or “Return” key?

To be frank, only a selected few are aware that the Enter and Return keys are not the same – whether you refer to it as Enter or Return, users will press either buttons (if they have both buttons). This is due to the fact that on very few software products the Enter and Return keys do different things (Avid’s Pro Tools is the only example I can give).

My own experience is that Enter is a more popular name; “Press the return key” sounds odd, while “Press Enter” sounds natural. I fail to see anyone to whom you’ll say “Press Enter” going “Hu?”, while I can imagine this happening if you’ll say “Press Return”. But that’s just me and based on my own subjective experience; perhaps in Norway they use Return more than Enter. However, as you said, a search for “Press Enter” on Google yields 15 million results, while “Press Return” yields less than a million.

If I had been you I wouldn’t worry about it so much and use Enter.


Trivia

The term Return is a shorthand for Carriage Return.

Originally, the term carriage return referred to a mechanism or lever on a typewriter. It was used after typing a line of text and caused the assembly holding the paper (the carriage) to return to the right so that the machine was ready to type again on the left-hand side of the paper.

Source: Wikipedia.

mysql – Why some DATETIME columns return numbers instead of UTC strings?

Given the following table,

CREATE TABLE test (
  id int unsigned NOT NULL AUTO_INCREMENT,
  created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  completed_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY(id)
);

when I SELECT * FROM test from the MySQL terminal, the date columns all show string dates as expected.

When I use the same select query in a Node backend using the MySQL xDevAPI, the created_at and completed_at columns return numbers while the updated_at column returns a UTC string.

Why does this happen?

I want to only use UTC strings, and only want to change the updated_at date on update statements but MySQL docs seem to not address what’s happening here so I don’t know if it’s MySQL or the xDevAPI.

rest – What to return in case of invalid credentials

I’d like to as you what to return form the backend (I use Spring Boot and Angular) in case of credentials validation.

User enters some credentials like username and password and the clicks on Next button to go to the next step. But in this moment there is invoking endpoint validateCredentials. My question is if I should return to the frontend status 200 OK and object like

{
  status: "SUCCESS"
  account1: true
  account2: true
}

OR

{
  status: "FAILED"
  account1: true
  account2: false
}

Or maybe in case of wrong credentials I should return status 400 BAD REQUEST or another?

How to retrieve data using REST from another Custom List View in SharePoint and return it to Datatable?

  • You should do the changes in the REST URL such as sort, filter as you
    did in the “CreatedToday” view and it will return data accordingly.
  • The data that is returned by REST always depends on the REST URL, so
    modify it accordingly based on your requirement.

Update:

The following example demonstrates how to retrieve list items for a View using SharePoint REST:

function getListItems(webUrl,listTitle, queryText) 
{
    var viewXml = '<View><Query>' + queryText + '</Query></View>';
    var url = webUrl + "/_api/web/lists/getbytitle('" + listTitle + "')/getitems"; 
    var queryPayload = {  
               'query' : {
                      '__metadata': { 'type': 'SP.CamlQuery' }, 
                      'ViewXml' : viewXml  
               }
    };
    return executeJson(url,"POST",null,queryPayload);
}


function getListViewItems(webUrl,listTitle,viewTitle)
{
     var url = webUrl + "/_api/web/lists/getByTitle('" + listTitle + "')/Views/getbytitle('" + viewTitle + "')/ViewQuery";
     return executeJson(url).then(
         function(data){         
             var viewQuery = data.d.ViewQuery;
             return getListItems(webUrl,listTitle,viewQuery); 
         });
}

where:

function executeJson(url,method,headers,payload) 
{
    method = method || 'GET';
    headers = headers || {};
    headers("Accept") = "application/json;odata=verbose";
    if(method == "POST") {
        headers("X-RequestDigest") = $("#__REQUESTDIGEST").val();
    }      
    var ajaxOptions = 
    {       
       url: url,   
       type: method,  
       contentType: "application/json;odata=verbose",
       headers: headers
    };
    if (typeof payload != 'undefined') {
      ajaxOptions.data = JSON.stringify(payload);
    }  
    return $.ajax(ajaxOptions);
}

Usage:

getListViewItems(_spPageContextInfo.webAbsoluteUrl,'Tasks','All Tasks')
.done(function(data)
{
     var items = data.d.results;
     for(var i = 0; i < items.length;i++) {
         console.log(items(i).Title);
     }    
})
.fail(
function(error){
    console.log(JSON.stringify(error));
});

How to get all items in a view using REST API

Django | Error al hacer más de una consulta a la vez y Return a template

Al tratar de hacer dos consultas o filters para enviar al template y mostrar los datos, me devuelve error. ¿Es posible enviar dos consultas a la vez al template?

Error:

introducir la descripción de la imagen aquí

Código:

class StationDetailView(DetailView):
    model = Station
    template_name = "station/detail_station.html"

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context('cuadro_list') = Dispositivo.objects.filter(estacion=self.kwargs('pk'),tipo_dispositivo=6 or 7 or 8)
        context2 = super().get_context_data(**kwargs)
        context2('disp_list') = Dispositivo.objects.filter(estacion=self.kwargs('pk'),tipo_dispositivo=1 or 2 or 3 or 4 or 5)
        return context, context2

Why not in does not return values with null values in my select query on postgresql 11?

I have the following sql script:

CREATE temporary table if not EXISTS the_values (
 key SERIAL,
 value INTEGER NULL 
);

insert into the_values(value) values (null),(1),(null),(2),(3),(4),(5),(6),(10),(null),(null);

select * from the_values where value not in (1,2,3,4,5,6,10); 

And I noticed that the query:

select * from the_values where value not in (1,2,3,4,5,6,10); 

Does not return the rows having value NULL, and that, caught my attention. Therefore, I want to know why that happens. I am interested more about the technical aspect of this phenomenon rather that the obvious solution:

select * from the_values where value not in (1,2,3,4,5,6,10) or value IS NULL; 

functions – wp_get_current_user return ID = 0 when used outside of wordpress, such as webhook / fulfillment dialogflow

I want to get the user ID that is currently logged in.
I did it successfully when accessed via a web browser. However, when this function is called via dialogflow as webhook / fulfillment it always returns ID = 0.
This is my full code in PHP.

<?php

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', '/var/www/html/mine/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-config.php');

do_action( 'plugins_loaded' );

$current_user = wp_get_current_user();
 
$method = $_SERVER('REQUEST_METHOD');

// Process only when method is POST
if($method == 'POST'){
    $requestBody = file_get_contents('php://input');
    $json = json_decode($requestBody);

    $action = $json->queryResult->action;
        
    if ($action == "ngopi"){
        if ($current_user->ID != 0){
            $ngopiResponse = "Hai..".$current_user->display_name;
        }
        else{
            $ngopiResponse = "Hai..Guest";  
        }   
    }
    
    $response = new stdClass();
    $response->speech = $ngopiResponse;
    $response->fulfillmentText = $ngopiResponse;
    $response->source = "webhook";
    echo json_encode($response);
}
else
{
    echo "Method not allowed";
}
?>

Please give me a solution for this case or maybe there are other alternative ways that I can do?

Thanks in advance.

sharepoint online – What search syntax can be used to return results where a user profile field is empty?

Working with SharePoint Modern and user profiles that have with category fields to populate with topics of interest.

I’ve set up a search results page for “pages for me” that refines results automatically, based on the value/s the user select/s for their ‘business area’, ‘product’ and other (4) categories that they’re interested in.

…AND {|Refinablestring123:{User.BusinessArea}} AND {|Refinablestring123:{User.Product}}…etc

This works fine, and returns results whether the user has selected one or a number of values in each category.

The problem arises when the user leaves the category field blank, either because they want to see all topics in that category, or that category is not relevant to them. The search results are empty due to the vacant field.

Is there a way to treat a blank category as “all values”?

LogicException : The controller must return a response (success ! given)

i have a service that return for me true in the node (article) successfully create and false if something wrong , but in the controller i am getting this error ‘LogicException : The controller must return a response (success ! given). dans SymfonyComponentHttpKernelHttpKernel->handleRaw() (ligne 169 de /var/www/html/vendor/symfony/http-kernel/HttpKernel.php).’

can anyone tell me where is the problem in the controller return of my code please ?

service

 public function createArticle()
  {
    $node = Node::create(array(
      'type' => 'article custom',
      'title' => 'article custom',
      'langcode' => 'fr',
      'uid' => '1',
      'status' => 1,
      'field_fields' => array(),
    ));
    $node->save();
    if($node)
      return true;
    else
      return false;
  }

the controller methode

 public function myPageCreate()
  {
    $service = Drupal::service('mymodule.ran');
    $createnode = $service->createArticle();
    if($createnode)
      return 'success !';
    else
      return 'somthing wrong !';
  }

usa – Italian with recently expired M1 student visa wants to visit Italy & return to NYC

If you want to return in M-1 status, you’ll need a new M-1 visa. This is true even if your extension request is granted before you leave the US.

Normally, you can get that visa while you are in Italy, but I do not know whether restrictions related to the coronavirus will prevent or delay the process. You will also have to consider the possibility that the current travel restrictions may still be in place, in which case you’ll need to find somewhere else to stay for 14 days between leaving Italy and arriving in the US.

The above takes your question at face value, but perhaps I shouldn’t do that. Keep in mind that there is a distinction between visa validity and status. Your extension application was an application for extension of status. If your visa (that is, the sticker in your passport) is still valid through your anticipated return date, then you won’t have any problems at all other than the coronavirus restrictions.