http.get in node.js return undefined

Hi I’ve made a function to make api request and it works fine (when I put console.log where I return a data it perfectly logs what should be there but I can’t make it to write data to variable where I call this function.

Can it be that requestWheather() function finishes before request is done?

How can I fore it to wait until request() function finish?

Here is my code:

const http = require('http')  const accu = {     domain: '',     apiKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',     locationKey: 'XXXXX',     languageCode: 'pl-pl' }  requestWheather()  function requestWheather() {     let location = request(`locations/v1/$  {accu.locationKey}?apikey=$  {accu.apiKey}&language=$  {accu.languageCode}`)     let currentConditions = request(`currentconditions/v1/$  {accu.locationKey}?apikey=$  {accu.apiKey}&language=$  {accu.languageCode}&details=true`)     console.log(location) }  function request(url) {     let requestUrl = accu.domain + url      http.get(requestUrl, (resp) => {          let data = ''          resp.on('data', (chunk) => {           data += chunk         })          resp.on('end', () => {             return JSON.parse(data)         })      }).on("error", (err) => {         console.log(err.message)     })  } 

Unable to get property ‘$4a’ of undefined or null reference

I am trying to customize a SharePoint 2013 calendar. When tried with jQuery, getting the below error. Any help is appreciated.

    <script src="/sites/it-HongKong/Scripts/jquery-1.7.2.min.js"></script> <script type="text/javascript">    _spBodyOnLoadFunctionNames.push('WaitForCalendarToLoad');    function WaitForCalendarToLoad() {       // we will slightly rewrite this existing function as defined originally in SP.UI.ApplicationPages.Calendar.debug.js     var pwold$  4b= SP.UI.ApplicationPages.CalendarNotify.$  4a;  SP.UI.ApplicationPages.CalendarNotify.$  4a = function () {         pwold$  4b();          test();      } } function test() {  var divText = $  ('.ms-acal-sdiv').val(); var b ="CST"; var position = 5; var txt = [divText.slice(0, position), b, divText.slice(position)].join(''); $  (".ms-acal-sdiv").text(txt); alert(divText);  }</script>  

PHP/MySQL Undefined variable no código

Estou tentando executar esse código php, porem me reporta um erro “Notice: Undefined variable: num_row in C:\wamp64\www\saldo\login.php on line 63” A variável foi criada na linha 23 mas ele ainda reporta o erro de não definida, desde já obrigado!

<!DOCTYPE html> <html>  <head>     <meta charset="UTF-8">     <link rel="stylesheet" href="style.css">     <link rel="stylesheet" href="" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">     <title> Saldo</title> </head> <?php  if(isset($  _POST['entrar'])) { $  username = trim($  _POST['login']); $  password = trim($  _POST['senha']); $  query = "SELECT login, senha FROM usuarios WHERE login='$  _POST[login]'AND senha='$  _POST[senha]'";  $  result = mysqli_query($  conn,$  query) or die(mysqli_error()); $  num_row = mysqli_num_rows($  result); $  row=mysqli_fetch_array($  result); if( $  num_row == 1 )      {  $  _SESSION['id']=$  row['id'];  header("Location: home.php");  exit;   }   elseif ($  num_row == 0){    } } ?>  <body>      <body>         <div class="container">             <div class="row">                 <div class="col-sm-9 col-md-7 col-lg-5 mx-auto">                     <div class="card card-signin my-5">                         <div class="card-body">                             <h5 class="card-title text-center">Entrar</h5>                             <form class="form-signin" method="POST" action="login.php">                                 <div class="form-label-group">                                     <input type="email" name="login" id="inputEmail" class="form-control" placeholder="Email address" required autofocus>                                     <label for="inputEmail">Email</label>                                 </div>                                  <div class="form-label-group">                                     <input type="password" name="senha" id="inputPassword" class="form-control" placeholder="Password" required>                                     <label for="inputPassword">Senha</label>                                 </div>                                  <div class="custom-control custom-checkbox mb-3">                                     <input type="checkbox" class="custom-control-input" id="customCheck1">                                     <label class="custom-control-label" for="customCheck1">Lembrar minha senha</label>                                 </div>                                 <button name="entrar" class="btn btn-lg btn-primary btn-block text-uppercase" type="submit">Continuar</button>                                 <?php                                  if ($  num_row == false){                                 echo "<p align = 'center'><font color ='red'> Senha incorreta </font></p>";                                 }                                 ?>                                 <hr class="my-4">                                 <button class="btn btn-lg btn-secondary btn-block text-uppercase" type="submit"><i class="fab  mr-2"></i> Não possui cadastro? Cadastre-se</button>                                 <button class="btn btn-lg  btn-secondary btn-block text-uppercase" type="submit"><i class=" mr-2"></i> Esqueci minha senha</button>                             </form>                         </div>                     </div>                 </div>             </div>         </div>     </body> </body>  </html> 

Apache2 + PHP-FPM – undefined function apache_getenv()

I have a big problem because for several hours I am trying to run a project that uses SetENV in PHP. When he even tries to use a simple function apache_getenv();

<?php $  ret = apache_getenv("SERVER_ADDR"); echo $  ret; ?> 

I receive a feedback error message

Fatal error: Uncaught Error: Call to undefined function apache_getenv() in /var/www/html/env.php:2 Stack trace: #0 {main} thrown in /var/www/html/env.php on line 2 

Using php-cli the same error. My configuration below.

# httpd -v Server version: Apache/2.4.34 (Fedora) Server built:   Sep 21 2018 14:27:56  # php -v PHP 7.2.15 (cli) (built: Feb  5 2019 15:43:35) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies     with Zend OPcache v7.2.15, Copyright (c) 1999-2018, by Zend Technologies  # php -m [PHP Modules] apcu bcmath bz2 calendar Core ctype curl date dom exif fileinfo filter ftp gd gettext hash iconv ldap libxml mbstring mcrypt mysqli mysqlnd odbc openssl pcntl pcre PDO pdo_mysql PDO_ODBC pdo_sqlite Phar posix readline Reflection session shmop SimpleXML soap sockets SPL sqlite3 standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl Zend OPcache zip zlib  [Zend Modules] Zend OPcache  # apachectl -M | grep env env_module (shared) setenvif_module (shared) 

пытаюсь подключить redux но reducer возвращает state undefined

Создал папку store в ней создал файлы actionNews, newsReducer, rootReducer, constants. Подключил “redux”: “^4.0.1”, “react-redux”: “^6.0.1”. в файле newsReducer инициализировал дефолтный state

const defaultState = {     newCity: {         name: 'город',         center: 'центр города',         points: [1,3],       }   };

добавил конструкцию свитч кэйс и по дефолту он возвращает дефолтный state.Далее экспортировал редюсер и импортировал в rootReducer.

в файле rootReducer создал combineReducer

import { combineReducers } from 'redux' import newsReducer from './newsReducer'; const rootReducer = combineReducers( { newsReducer } ); export default rootReducer;

проблема в получении state в файле rootReducer. дефолтное значение не приходит и store созданный в index.js получает значение undefined.

Undefined offset:2


  <td>           <select  id="lista1" name="lista1" contenteditacble="true" class="idTema">             <option selected="true" disabled="disabled"> Seleccioné.. </option>             <?php             include_once "class_areas_asignacion_dal.php";             $  listaAreas = new AreasAsignacionDal;             $  lista=$  listaAreas->getlistAssignmentAreas(2);              foreach ($  lista as $  key => $  value) {               $  idAsignaturas=$  value->idAsignaturas;               $  nombreAsignaturas=utf8_encode($  value->getNombreAsignaturas());               $  idAreaAcademica=$  value->getIdAreaAcademica();               ?>               <option   value="<?php echo $  idAsignaturas ?>"><?php echo "$  nombreAsignaturas"; ?></option>             <?php  }?>           </select>         </td>         <td id="select2lista">         </td> 

el primer select si lo llena , pero para el segundo select2lista hice una jquery que se debe llenar dependiendo del select anterior

       <script type="text/javascript">             $  (document).ready(function(){               $  ('#lista1').val(1);               recargarLista();                $  ('#lista1').change(function(){                 recargarLista();               });             })           </script>           <script type="text/javascript">             function recargarLista(){               $  .ajax({                 type:"POST",                 url:"datos.php",                 data:"idAS=" + $  ('#lista1').val(),                 success:function(r){                   $  ('#select2lista').html(r);                 }               });             }           </script>  

el php datos. dice lo siguiente no coloque la conexión , pero si funciona

<?php     $  conexion=mysqli_connect(AQUI COLOCO LA CONN);    $  idAsignaturas=$  _POST['idAS'];     $  sql="SELECT t.idTema,t.nombreTema     FROM temas t     WHERE t.idAsignaturas='$  idAsignaturas'";     $  result=mysqli_query($  conexion,$  sql);     $  cadena="         <select id='lista2' name='lista2'>";    while ($  ver=mysqli_fetch_row($  result)) {     $  cadena=$  cadena.'<option     value='.$  ver[1].'>'.utf8_encode($  ver[2]).'</option>';    }      echo  $  cadena."</select>";      ?> 

mi problema es que al seleccionar el primer select me aparece el siguiente error Notice: Undefined offset: 2

Undefined index: scheduled_transition_state BaseFieldOverride.php:167

I’m trying to upgrade from Drupal 8.5 to 8.6 and I keep getting this error:

>  [info] Undefined index: scheduled_transition_state > BaseFieldOverride.php:167 TypeError: Argument 2 passed to > Drupal\Core\Entity\ContentEntityStorageBase::onFieldDefinitionUpdate() > must implement interface Drupal\Core\Field\FieldDefinitionInterface, > null given, called in > /var/www/bwd/docroot/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php > on line 207 in > /var/www/bwd/docroot/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php > on line 441 #0 > /var/www/bwd/docroot/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php(207): > Drupal\Core\Entity\ContentEntityStorageBase->onFieldDefinitionUpdate(Object(Drupal\Core\Field\Entity\BaseFieldOverride), > NULL) 

I’ve got a custom profile and lots of configuration to import, but it all works fine on 8.5. I’m using blt setup -n to install Drupal. I’ve got BLT and Lightning and I suspect one of them is causing the problem, but I can’t remove them from my project.

Any advice?

Invalid argument supplied for foreach() line 161 , Undefined variable line 166.167.168

me podrian ayudar a corregir este error

linea 161 <?php foreach ($  busqueda as $  b ) ?>    <tr> linea 166      <td><a href=player.php?aux1=<?php echo ($  b['aux1']); ?>><?php  echo $  b['Apodo'];?></a></td> linea 167     <td><a href=player.php?aux1=<?php echo ($  b['aux1']); ?>><?php  echo $  b['Nombre'];?></a></td> linea 168    <td><a href=player.php?aux1=<?php echo ($  b['aux1']); ?>><img  src="images/jugadores/<?php echo $  b['aux1']; ?>.jpg" width="65" height="106"  /></td>   </tr> 

Fatal error: Uncaught Error: Call to undefined method DOMProcessingInstruction::getAttribute(). PHP E DOMPDF

Estou a tentar criar um pdf com uma tabela que recebe valores de varíaveis php.

A página corre perfeitamente, mas quando utilizo o DOMPDF para criar o pdf da página ele da-me o seguinte erro :

Fatal error: Uncaught Error: Call to undefined method DOMProcessingInstruction::getAttribute() in C:\xampp\htdocs\organizar\dompdf\src\Cellmap.php:554 Stack trace: #0 C:\xampp\htdocs\organizar\dompdf\src\Cellmap.php(518): Dompdf\Cellmap->add_frame(Object(Dompdf\FrameDecorator\Inline)) #1 C:\xampp\htdocs\organizar\dompdf\src\Cellmap.php(518): Dompdf\Cellmap->add_frame(Object(Dompdf\FrameDecorator\TableRowGroup)) #2 C:\xampp\htdocs\organizar\dompdf\src\FrameReflower\Table.php(532): Dompdf\Cellmap->add_frame(Object(Dompdf\FrameDecorator\Table)) #3 C:\xampp\htdocs\organizar\dompdf\src\FrameReflower\Table.php(408): Dompdf\FrameReflower\Table->get_min_max_width() #4 C:\xampp\htdocs\organizar\dompdf\src\FrameDecorator\AbstractFrameDecorator.php(895): Dompdf\FrameReflower\Table->reflow(Object(Dompdf\FrameDecorator\Block)) #5 C:\xampp\htdocs\organizar\dompdf\src\FrameReflower\Block.php(845): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow(Object(Dompdf\FrameDecorator\Block)) #6 C:\xampp\htdocs\organizar\dompdf\src\FrameDecora in C:\xampp\htdocs\organizar\dompdf\src\Cellmap.php on line 554 

Alguem sabe do que possa ser?

A página é a seguinte :

<?php session_start(); require '../../app/listadeferias.php';      ?>   <!DOCTYPE html> <html> <head>     <title></title> </head> <body> <img src="../public/assets/logo.jpeg" style="width: 8%; margin: 0 30px;">    <h1 style="text-align: center;"> Férias Marcadas </h1>  <table class="table" style="width: 100%; margin-bottom:40px; margin-top: 15px; ">       <thead>         <tr>           <th scope="col">Data Inicial</th>           <th scope="col">Data Final</th>           <th scope="col">Numero de dias pedidos</th>           <th scope="col">Ano referente</th>           <th scope="col">Dias de férias disponiveis</th>         </tr>          </thead>          <tbody>             <?php foreach ($  resultado as $  key => $  value) {  ?>          <tr>          <th scope="col"><?= $  value["dferiasinicial"]?></th>           <th scope="col"><?= $  value["dferiasfinal"]?></th>           <th scope="col"><?= $  value["ndias"]?></th>           <th scope="col"><?= $  value["ano"]?></th>           <th scope="col"><?= $  value["feriasrestantes"]?></th>         </tr>             <?php } ?>       </tbody>     </table> </body> </html> 

Dompdf :

use Dompdf\Dompdf;  $  document = new Dompdf();   $  document-> loadHtml(file_get_contents('../public/pages/imprimepgina.php'));    $  document->setPaper('A4', 'landscape');  $  document->render();  $  document->stream();  ?>