user variable php with php pdo and mysql

I have something like this:

set @ind:=0;select *,(@ind := @ind + 1) as k, CASE WHEN MOD(@ind,2)= 0 THEN 'out' ELSE 'in' END as 'status' from tabletime where uid LIKE '509854810%' order by TIMESTAMP

It works but I need to use it php with pdo … how to use it?
to get the list
in: timestamp, out: timestamp, diff: time
in: timestamp, out: timestamp, diff: time
in: timestamp, out: at work (if there are no more rows)

magento2 – How to access a variable declared in a phtml from another phtml?

You can configure the variable with register from the first phtml, then you get the value in the second phtml with registry

To do things right without directly injecting the objectManager into phtml, you must create some function in your product block, therefore:

In your block: app/code/Vendor/Modulename/Block/Custom.php

assuming its variable name is: $tech

_coreRegistry = $coreRegistry;
    }

    /**
     * Set var data
     */
    public function setTechData($data)
    {
        $this->_coreRegistry->register('tech', $data);
    }

    /**
     * Get var data
     */
    public function getTechData()
    {
        return $this->_coreRegistry->registry('tech');
    }
}

Then in your first phtml:


setTechData($tech); ?>

In the second phtml:

getTechData(); ?> //you'll get your tech value here

You can do it in phtml to proof Without the block solution:

First phtml:

create("MagentoFrameworkRegistry")->register('tech', $tech);
?>

Second phtml:

create("MagentoFrameworkRegistry")->registry('tech');
echo $techData;
?>

Undefined variable php

I have the following php code:


When I'm going to try the error appears:

Notice: Indefinite variable: major1 online 19

Can somebody help me? I appreciate from now

blocks – How to access a variable declared in a phtml file from another phtml file in Magento2?

I have inserted two blocks in the "catalog_product_view.xml" file:


...

How can I access a variable declared in the first block from the second block?

woocommerce – Woo – the variable subscription product is running out

I have a problem with one of my variable subscriptions.

The product has 3 different sizes, each size has 4 subscription intervals.

One size (and all intervals) is running out, even with stock management disabled.

I searched Google a lot and tried all the suggestions like:

  • clean transitions
  • regenerate product searches
  • set the stock to 1000 in the target table
  • deleted sessions

each solution lasts only a couple of hours (at least), but then returned to -300.
I cannot delete the product, because all running subscriptions would be canceled.

Do you have any idea?

Thank you!!

javascript – Lat long variable extraction problems

I am trying to extract a lat and long as a variable from a geocoder to use it in a routing parameter. I have problems to retrieve the lat from within the function, I am sure that this is something simple, but I am relatively new to JS with my only previous experience in coding 6 months of Python.

As shown in the code below, I can print the long console lat with this code "console.log (result.Response.View (0) .Result (0) .Location.DisplayPosition);"
but I just can't extract the long lat separately so I can go ahead with the code.

Any help would be greatly appreciated.

function loadMap() {
var platform = new H.service.Platform(
    {'id': JSid ,
     'apikey': JSapikey
    });

// Retrieve the target element for the map:
var targetElement = document.getElementById('mapContainer');

var defaultLayers = platform.createDefaultLayers();

var map = new H.Map(document.getElementById('mapContainer'), 
                    defaultLayers.vector.normal.map,
                    {
                        zoom: 10,
                        center: { lat: 53.546, lng: -113.5 }
                    });

var geocoder = platform.getGeocodingService();

var geocodingParams = {
      searchText: '10 downing street, westminster'
    }
var onResult2 = function(result) {
      console.log(result.Response.View(0).Result(0).Location.DisplayPosition);
    }
var onError2 = function(error) {
       console.log(error);
    };

geocoder.geocode(geocodingParams, onResult2, onError2);



var startCoords = 'geo!53.478176,-113.642455'
var endCoords = 'geo!51.1784,-115.57'

var routingParameters = {
  // The routing mode:
    'mode': 'fastest;car',
  // The start point of the route:
    'waypoint0': startCoords,
  // The end point of the route:
    'waypoint1': endCoords,
  // To retrieve the shape of the route we choose the route
  // representation mode 'display'
    'representation': 'display',

    'routeattributes' : 'waypoints,summary,shape,legs',
    'maneuverattributes': 'direction,action',
};

var onResult = function(result) {
  var route,
  routeShape,
  startPoint,
  endPoint,
  linestring;
  if(result.response.route) {
  // Pick the first route from the response:
  route = result.response.route(0);
  // Pick the route's shape:
  routeShape = route.shape;

  // Create a linestring to use as a point source for the route line
  linestring = new H.geo.LineString();

  // Push all the points in the shape into the linestring:
  routeShape.forEach(function(point) {
  var parts = point.split(',');
  linestring.pushLatLngAlt(parts(0), parts(1));
  });

  // Retrieve the mapped positions of the requested waypoints:
  startPoint = route.waypoint(0).mappedPosition;
  endPoint = route.waypoint(1).mappedPosition;

  // Create a polyline to display the route:
  var routeLine = new H.map.Polyline(linestring, {
  style: { strokeColor: 'blue', lineWidth: 3 }
  });

  // Create a marker for the start point:
  var startMarker = new H.map.Marker({
  lat: startPoint.latitude,
  lng: startPoint.longitude
  });

  // Create a marker for the end point:
  var endMarker = new H.map.Marker({
  lat: endPoint.latitude,
  lng: endPoint.longitude
  });

  // Add the route polyline and the two markers to the map:
  map.addObjects((routeLine, startMarker, endMarker));

  // Set the map's viewport to make the whole route visible:
  map.getViewModel().setLookAtData({bounds: routeLine.getBoundingBox()});
  }
};

var router = platform.getRoutingService();

router.calculateRoute(routingParameters, onResult,
  function(error) {
  alert(error.message);
  });

}


document.addEventListener('DOMContentLoaded', function() {
  console.log('DOM is ready');
  loadMap();
});

java – I am making a compiler using the libraries of Lexer, LexerCup and Sintax, how to validate a variable? and a semantic analyzer

How do I make a semantic analyzer and validate a variable

package compiler;

import java_cup.runtime.Symbol;

parser code
{:
    private Symbol s;

public void syntax_error(Symbol s){
    this.s = s;
}
public Symbol getS(){
    return this.s;
}

:};

Terminal Line, Quotation Mark, Character, Make, Double, Yes, Integer, While, For,
    same, more, less, by, between, semicolon, major, minor, parenthesis_a, parenthesis_c,
    key_a, key_c, start, end, Delimiter, print, store, Identifier, number, ERROR;
non terminal START, JUDGMENT, DECLARATION, JUDGMENT STORE, IF, JUDGMENT_BOOLEANA, JUDGMENT_IF,
             JUDGMENT_OPERATIONS, WHILE, DO_WHILE, JUDGMENT_FOR, DECLARATION_FOR,
             FOR;

start with HOME;

HOME :: =
    start key_a JUDGMENT end key_c
;
JUDGMENT :: =
    DECLARATION |
    IF |
    JUDGMENT_BOOLEANA |
    JUDGMENT_IF |
JUDGMENT_OPERATIONS |
    WHILE |
    DO_WHILE |
    JUDGMENT_FOR |
    DECLARATION_FOR |
    FOR
;
DECLARATION :: =
    Integer Identifier Delimiter SENTENCIA_ALMACENAR |
    Integer IF Delimiter Identifier |
    Integer WHILE Delimiter Identifier |
    Integer Identifier Delimiter DO_WHILE |
    Integer Identifier Delimiter FOR |
    Character Identifier Delimiter FOR |
    Double Identifier Delimiter SENTENCIA_ALMACENAR |
    Integer Identifier Delimiter JUDGMENT_OPERATIONS |
    Integer Identifier Delimiter Integer Identifier Delimiter Character Identifier Delimiter SENTENCIA_OPERACIONES |
    Integer Identifier Delimiter Integer Identifier Delimiter Integer Identifier Delimiter SENTENCIA_OPERACIONES |
    Integer Identifier equal number Delimiter Integer Identifier Delimiter Integer Identifier equal number Delimiter SENTENCIA_OPERACIONES |
    Integer Identifier Delimiter Integer Identifier Delimiter SENTENCIA_ALMACENAR |
    Double Identifier Delimiter SENTENCIA_OPERACIONES SENTENCIA_ALMACENAR |
    Character Identifier Delimiter SENTENCIA_ALMACENAR |
    Integer Identifier equal number Delimiter SENTENCIA_ALMACENAR |
    Integer Identifier equal number Delimiter SENTENCIA_OPERACIONES SENTENCIA_ALMACENAR |
    Integer Identifier equal number Delimiter Integer Identifier equal number Delimiter SENTENCIA_ALMACENAR |
    Integer Identifier equal number Delimiter Integer Identifier equal number Delimiter SENTENCIA_OPERACIONES |
    Character Identifier equal Comillas Comillas Delimiter SENTENCIA_ALMACENAR |
    Double Identifier equal number Delimiter SENTENCIA_ALMACENAR |
    Double Identifier equal number point number Delimiter SENTENCIA_ALMACENAR |
    Double Identifier equal number Delimiter Double Identifier equal number Delimiter SENTENCIA_ALMACENAR |
    Double Identifier equal number Delimiter SENTENCIA_OPERACIONES |
    Double Identifier equal number point number Delimiter SENTENCE_OPERATIONS |
    Double Identifier equal number point number Double Identifier equal number point number Delimiter SENTENCIA_ALMACENAR |
    Double Identifier equal number point number Double Identifier equal number point number Delimiter SENTENCIA_OPERACIONES |
    Double Identifier equal number point number Double Identifier equal number point number Delimiter Double Identifier equal number point number Delimiter SENTENCIA_OPERACIONES |
    Character Identifier equal Comillas Identifier Comillas Delimiter SENTENCIA_ALMACENAR
;
JUDGMENT_STORE :: =
    Identifier equal store parenthesis_a parentesis_c Delimiter SENTENCIA_IF |
    Identifier equal store parenthesis_a parentesis_c Delimiter Equal identifier store parentesis_a parentesis_c Delimiter SENTENCIA_IF
;
IF :: =
     If parenthesis_a JUDGMENT_BOOLEANA parenthesis_c key_a SENTENCE_IF key_c
;
JUDGMENT_BOOLEANA :: =
    Identifier equal equal number
;
JUDGMENT_IF :: =
    print parentesis_a Identifier parentesis_c Delimiter |
    print parentesis_a Comillas Identifier Comillas parentesis_c Delimiter |
    print parentesis_a Comillas Identifier Comillas more Identifier parentesis_c Delimiter |
    print parentesis_a Identifier more Identifier parentesis_c Delimiter |
    print parentesis_a Identifier less Identifier parentesis_c Delimiter |
    print parentesis_a Identifier by Identifier parentesis_c Delimiter |
    print parentesis_a Identifier between Identifier parentesis_c Delimiter
;
JUDGMENT_OPERATIONS :: =
    Equal identifier Identifier more Identifier Delimiter SENTENCIA_ALMACENAR |
    Equal identifier Identifier less Identifier Delimiter SENTENCIA_ALMACENAR |
    Equal Identifier Identifier by Identifier Delimiter SENTENCIA_ALMACENAR |
    Equal identifier Identifier between Delimiter Identifier SENTENCIA_ALMACENAR
;
WHILE :: =
      While parenthesis_a BOOLEANA JUDGMENT parenthesis_c key_a SENTENCE_IF key_c
;
DO_WHILE :: =
      Make key_a JUDGMENT_IF key_c While parenthesis_a JUDGMENT_BOOLEANA parenthesis_c Delimiter
;
FOR :: =
        For parentesis_a JUDGMENT_FOR parentesis_c key_a DECLARATION_FOR key_c |
        For parentesis_a JUDGMENT_FOR parentesis_c key_a JUDGMENT_IF key_c
;
JUDGMENT_FOR :: =
    Identifier equal number Delimiter Identifier minor number Delimiter Identifier more more |
    Identifier equal number Delimiter Identifier greater number Delimiter Identifier more more |
    Identifier equal number Delimiter Identifier minor number Delimiter Identifier less less |
    Identifier equal number Delimiter Identifier greater number Delimiter Identifier less less
;
DECLARACION_FOR :: =
    Identifier more delimiter SENTENCIA_IF |
    Identifier less less Delimiter SENTENCIA_IF
;

Averages of column values ​​placed in your own column or workflow variable

I have researched this, and although I have found many useful articles near it, nothing reaches exactly what I need.

I am trying to complete a variable in a workflow OR a column with the averages of all numbers in an existing column (that is, multiple items in the list). I cannot use the "total", etc., at the top (or bottom) of the page. This must be a real value with which I can work and show.

linux: incorrect local variable name

I created this function in a bash script:

gpio() {
  local folder = "/sys/class/gpio/gpio$1"
  if ( ! -d $folder )
  then
    cd /sys/class/gpio
    echo $1 > export
    cd $folder
    echo out > direction
  fi
}

But I receive this error:

local: /sys/class/gpio/gpio47: bad variable name

at local folder = "/sys/class/gpio/gpio$1" line when i call it using gpio 47.

What's wrong with it?

How to use a variable from another class in Kotlin?

I only have one simple (hopefully) question. How do I make a variable in a class that can be accessed by another class in Kotlin?

Then class A:
var isBlue = 1

class B:
if isBlue == 1 then …