Java – Passing parameters in retrofit2 GET method for Android

Hey guys, okay?

I'm trying to pass a retrofit parameter, but I'm not getting it. I confess that I am very new to Android. I've done some research, but what I've tried has not worked out yet.

When I tested my Postman API method:
http: // localhost: 8080 / api / user /? userEmail=teste@email.com

Everything is quiet so far.

User Service Interface

public interface UserService {

    @GET("user/?userEmail")
    Call getUserByEmail(@Query(value = "email", encoded = true) String email);

Call at main activity

public void getUserByEmail(String email) {

       Call call = userService.getUserByEmail(email);

       call.enqueue(new Callback() {
           @Override
           public void onResponse(Call call, Response response) {
               if (response.isSuccessful()) {
                   User userResponse = response.body();
                   Long id = userResponse.getUserId();
                   String emailU = userResponse.getEmail();
               }
           }

           @Override
           public void onFailure(Call call, Throwable t) {

           }
       });


   }

And now, that's it. I originally used @Path for the interface and passed the same url string as in the postman.

magento2 – Magento 2: Passing variable from phtml to js

Here is my layout

    
  
   
     
       
         
           Vendor_Mymodule/js/view/minicartaddons
           
         
       
     
   
 

Here is a variable in the html file

       

Here is the JS filedefine((
'ko',
'uiComponent',
'Magento_Customer/js/customer-data',
), function (ko, Component, customerData) {
'use strict';
var subtotalAmount;
var maxPrice = maxpriceShipping;
var percentage;
return Component.extend({
displaySubtotal: ko.observable(true),
maxprice:maxPrice.toFixed(2),
/**
* @override
*/
initialize: function () {
this._super();
this.cart = customerData.get('cart');
},
getTotalCartItems: function () {
return customerData.get('cart')().summary_count;
},
getpercentage: function () {
subtotalAmount = customerData.get('cart')().subtotalAmount;
if (subtotalAmount > maxPrice) {
subtotalAmount = maxPrice;
}
percentage = ((subtotalAmount * 100) / maxPrice);
return percentage;
}
});
});

How can I pass the maxpriceShipping variable in phtml to the js file without using a "script" tag? but can use "script type =" text / x-magento-init ""

Javascript passing parameter in a function corresponding to the variable name

I have a variable in which a variable is defined, and then I have a function from which I say the name of the variable so that it can be equal to the defined variable within the function.

Here is the code to explain it better:

var car1 = false; // pre-defined

function myfunction(strToVariable) {

    if (strToVariable == 'car1') {
        myNewVar = car1;
    }

}

myfunction('car1'); //run the function and pass the name of the variable name that you want to use.

How can I get this to work like the code I'm using: if (strToVariable == 'car1') { ... it does not work?

ps: So there are no security issues in this code eval Solutions are alright for me.

Sharepoint Website Template: Passing Personal Data

I have created a template site where I have a list. In this list I have 5 columns of data. One of them is the person or group type. However, when I create a new site with this template, all data columns will be one with my person / group, which will be completely empty
Do you have any idea about the reason?

Thank you for your help :]

Japan passing customs with a tax-free knife

I'm in Japan and bought a kitchen knife (just over ¥ 16,000) that reclaims sales tax. The tax refund office has attached a document to my passport indicating the sale.

Tomorrow I will leave Narita. I have read about the procedure and have to show that I take the knife with me. Of course, as it is a knife, I can not take it in the cabin and leave it on the checked bag.

What will be the right procedure? May I pass the customs before checking in? Or do I have to declare it somehow during the review?

PHP – Erro mysqli_fetch_array () expects parameter 1 to be mysqli_result, passing bool

They tend to have a problem with the following errors:

Warning: mysqli_fetch_array () expects parameter 1 to be mysqli_result, bool in C: xampp htdocs hpveiculos index.php on line 512

Warning: mysqli_fetch_array () expects parameter 1 to be mysqli_result, bool in C: xampp htdocs hpveiculos index.php at line 516

Warning: mysqli_fetch_array () expects parameter 1 to be mysqli_result, bool in C: xampp htdocs hpveiculos index.php at line 526

código:


8 – Passing a Node Argument to the Form Controller to Generate a Complex Gap Text Query

This is a two-part question, please.

  1. Is it possible to pass a node argument from a custom route to a form controller? I tried to add NodeInterface to an implementation of the buildForm function, which resulted in an error. I was inspired by this tutorial. My buildForm method from the controller code is below:

    public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node){
        dsm($node, 'Node Argument');
    }
    

I understand that trying to do this is wrong. The code is just here to illustrate what I'm trying to achieve.

And that's my routing code:

quiz.nodetab:
 path: '/node/{node}/quiz'
 defaults:
  _title: 'Quiz'
  _form: 'DrupalquizFormQuiz'
 requirements:
  _permission: 'access content'

But I get the following error message in which the use of the build form Interface is wrong:

Fatal Error: The declaration of Drupal quiz Form Quiz :: buildForm (Array $ form, Drupal Core Form FormStateInterface $ form_state, Drupal node NodeInterface $ node) must be compatible with Drupal Core Form FormInterface :: buildForm ($ form_array, Drupal Core Form FormStateInterface $ form_state) in /var/www/composerDrupalTest/web/modules/custom/quiz/src/Form/Quiz.php on line 9

  1. The reason why I am trying to tie a node into a form controller is that I need to create a blank text question that is a form with many picklist options like this one. The node contains the gap data.

How can I create such a form with multiple picklist options?

c ++ – Passing the pointer array to a vector with CudaMemcpyDeviceToHost ()

I want to use a vector in the kernel of the program, but I can not use a direct vector in the kernel. Therefore, I use thrust :: vector in the main program and pass it to the pointer array in the argument in the kernel, if I would like to pass the d_odata in a h_odata vector the received error that the runtime check fails # 3 – the variable & # 39; h_odata & # 39; is used without being initialized. I do not declare values ​​of h_odata because it is not important to initialize h_odata. What is the problem with the assignment and the program?

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

__global__ void transpose(float *odata, float *idata, int width, int height)
{
    __shared__ float block(BLOCK_DIM)(BLOCK_DIM+1);

    // read the matrix tile into shared memory
        // load one element per thread from device memory (idata) and store it
        // in transposed order in block()()
    unsigned int xIndex = blockIdx.x * BLOCK_DIM + threadIdx.x;
    unsigned int yIndex = blockIdx.y * BLOCK_DIM + threadIdx.y;
    if((xIndex < width) && (yIndex < height))
    {
        unsigned int index_in = yIndex * width + xIndex;
        block(threadIdx.y)(threadIdx.x) = idata(index_in);
    }

        // synchronise to ensure all writes to block()() have completed
    __syncthreads();

    // write the transposed matrix tile to global memory (odata) in linear order
    xIndex = blockIdx.y * BLOCK_DIM + threadIdx.x;
    yIndex = blockIdx.x * BLOCK_DIM + threadIdx.y;
    if((xIndex < height) && (yIndex < width))
    {
        unsigned int index_out = yIndex * height + xIndex;
        odata(index_out) = block(threadIdx.x)(threadIdx.y);
    }
}


void main( int argc, char** argv) 
{

 const unsigned int size_x = 242;
 const unsigned int size_y = 200;


// size of memory required to store the matrix
 const unsigned int mem_size = sizeof(float) * size_x * size_y;


    vectorh_idata;
    srand(15235911);
    for( unsigned int i = 0; i < (size_x * size_y); ++i) 
    {
           h_idata.push_back((float)i); 
    }

    //copy host to device 
    thrust::device_vector idata(h_idata);
    float* d_idata =  thrust::raw_pointer_cast(&idata(0));

    float* d_odata;
    cudaMalloc( (void**) &d_odata, mem_size);



// setup execution parameters
    int gridSize_x = (int) ceil((float) size_x / BLOCK_DIM);
    int gridSize_y = (int) ceil((float) size_y / BLOCK_DIM);
    dim3 grid(gridSize_x, gridSize_y , 1);
    dim3 threads(BLOCK_DIM, BLOCK_DIM, 1);

  transpose<<< grid, threads >>>(d_odata, d_idata, size_x, size_y);


// copy results from device to host
    vector*h_odata;
    cudaMemcpy(&h_odata(0), d_odata, (size_x * size_y), 
     cudaMemcpyDeviceToHost) ;
    for(int i=0 ; i< size_x * size_y ; i++){
        printf("h_odata(%d) =%f" ,i , h_odata(i));
        printf("n");}

// cleanup memory
    cudaFree(d_idata);
    cudaFree(d_odata);



}

I do not know how to convert the pointer array in a kernel to a vector because I want to use the vector in the Continue program.

vector*h_odata;
cudaMemcpy(&h_odata(0), d_odata, (size_x * size_y), cudaMemcpyDeviceToHost) ;

PHP – Common practice of passing class names to views in Laravel

I have a controller method that passes model names and class names to a view. These classes are then instantiated in a different controller method. In this case, I use the Laravel Excel package.

public function index()
{
    $exports = (
        'Model name 1' => TestExport::class,
        'Model name 2' => AnotherExport::class
    );

    return view('export', compact('exports'));
}


public function download(string $collection)
{
    return Excel::download(new $collection(), 'Export.xlsx');
}

My view file then redirects to the download Controller method with the specific class name.

@foreach($exports as $name => $collection)
  Download
@endforeach

Since I'm learning design patterns and have determined that this would violate the DRY rule, I did not want any other controller method or Excel file that I downloaded.

Is this a good practice or can it be done better?