I just created a Store System using Electron, React, Material-UI, Redux, Redux-Saga, MySQL and Sequelize, and here is the result

This project is part of my personal portfolio, so, I’ll be happy if you could provide me any feedback about the project, code, structure or anything that you can report that could make me a better developer!

Also, you can use this Project as you wish, be for study, be for make improvements or earn money with it!

https://github.com/steniowagner/store-system

const whenShouldHelpCommunity = () => {     const when = 'always';      return when; } 

Possible to avoid cost increase in move to GCP MySQL Second Generation?

I was using pay-per-use with MySQL first generation. It was a website with all I was using pay-per-use with MySQL first generation. It’s for a website with all pages cached in memcached and only evicted from cache when I update content. Writes to SQL can also occur if somebody register for newsletter or similar (happens ~10 times/month). I was getting away for free with the pay-per-use model, but that model is not available in the second generation.

As far as I can understand, there is no way to get below $ 7 per month now with the new model. Is that correctly understood?

Or is there an API where I can turn on/off the SQL instance when I receive a registration or update content? It feels strange to pay so much for a service I use for less than a second 10-100 times per month.

cache_set max size in mysql?

https://api.drupal.org/api/drupal/includes%21cache.inc/function/cache_set/7.x

Some storage engines only allow objects up to a maximum of 1MB in size to be stored by default. When caching large arrays or similar, take care to ensure $ data does not exceed this size.

I am trying to store array of nodes more than 50,000 records in cache, which of last 4 years, which will never expire. Is there any way we can store in cache.

It seems like longblob type is used for data column in cache table which seems support 4 gigabytes.

Is that possible to achieve that if so how we can do, please suggest !

Witch one of these methods is better/safer to use? Simple MySql or MySql Class?

Witch one of these methods is better/safer to use? And what benefits i could get using one or other? I m really new to classes.

Simple mysqli:

connection.php

$  DBServer = "localhost"; $  DBPort = "3306"; $  DBUser = "root"; $  DBPass = ""; $  DBName = "test";  $  conn = new mysqli($  DBServer, $  DBUser, $  DBPass, $  DBName, $  DBPort); if ($  conn->connect_error) {     echo "Database connection failed: " . $  conn->connect_error, E_USER_ERROR; } mysqli_set_charset($  conn,"utf8"); 

index.php

include_once("connection.php");  $  l_name = mysqli_real_escape_string($  conn, $  _GET['l_name']);  $  query = mysqli_query($  conn, "SELECT * FROM test WHERE lname='".$  l_name."'"); while($  row = mysqli_fetch_array($  query)){     echo $  row['f_name'].' '.$  row['l_name'].'<br>'; } 

mysqli with class:

connection.php

class Connect {      var $  host = 'localhost';     var $  user = 'root';     var $  pass = '';     var $  db = 'test';     var $  con;      function connect() {         $  con = mysqli_connect($  this->host, $  this->user, $  this->pass, $  this->db);          if (!$  con) {             //die('Could not connect to database!');         } else {             $  this->con = $  con; //echo 'Connection established!';         }         mysqli_set_charset($  this->con,"utf8");          return $  this->con;      }      function close() {         mysqli_close($  con);     }  } 

index.php

include_once("connection.php");  $  con = new Connect(); $  con->connect();  $  l_name = mysqli_real_escape_string($  con->con, $  _GET['l_name']);  $  query = mysqli_query($  con->con, "SELECT * FROM test WHERE lname='".$  l_name."'"); while($  row = mysqli_fetch_array($  query)){     echo $  row['f_name'].' '.$  row['l_name'].'<br>'; } 

Thanks in advance!

Função pra editar retornando NULL PHP e MYSQL

Boa noite a todos, sou novato em programação e estou seguindo um tutoria de criação de um sistema de controle de estoque.

    if(isset($  _GET['id'])) {        $  idFabricante = $  _GET['id'];        var_dump($  resp = $  fabricante->EditFabricante($  idFabricante));      echo'  <div class="col-md-6">           <!-- general form elements -->           <div class="box box-primary">             <div class="box-header with-border">               <h3 class="box-title">Fabricante</h3>             </div>             <!-- /.box-header -->             <!-- form start -->             <form role="form" action="../../App/Database/insertfabricante.php" method="POST">               <div class="box-body">                 <div class="form-group">                   <label for="exampleInputEmail1">Nome da Empresa</label>                   <input type="text" name="NomeFabricante" class="form-control" id="exampleInputEmail1" placeholder="Nome Fabricante" value="'.$  resp['Fabricante']['Nome'].'">                 </div>                 <div class="form-group">                   <label for="exampleInputEmail1">CNPJ</label>                   <input type="text" name="CNPJFabricante" class="form-control" id="exampleInputEmail1" placeholder="CNPJ" value="'.$  resp['Fabricante']['CNPJ'].'">                 </div>                 <div class="form-group">                   <label for="exampleInputEmail1">E-mail</label>                   <input type="text" name="EmailFabricante" class="form-control" id="exampleInputEmail1" placeholder="E-mail" value="'.$  resp['Fabricante']['Email'].'">                 </div>                 <div class="form-group">                   <label for="exampleInputEmail1">Endereco</label>                   <input type="text" name="EnderecoFabricante" class="form-control" id="exampleInputEmail1" placeholder="Endereço" value="'.$  resp['Fabricante']['Endereco'].'">                 </div>                 <div class="form-group">                   <label for="exampleInputEmail1">Telefone</label>                   <input type="text" name="TelefoneFabricante" class="form-control" id="exampleInputEmail1" placeholder="Telefone" value="'.$  resp['Fabricante']['Telefone'].'">                 </div>                 <hr />                 <div class="box-header with-border">               <h3 class="box-title">Representante</h3>             </div>                  <div class="form-group">                   <label for="exampleInputEmail1">Nome</label>                   <input type="text" name="NomeRepresentante" class="form-control" id="exampleInputEmail1" placeholder="Nome do Representante">                 </div>                 <div class="form-group">                   <label for="exampleInputEmail1">Telefone</label>                   <input type="text" name="TelefoneRepresentante" class="form-control" id="exampleInputEmail1" placeholder="Telefone">                 </div>                 <div class="form-group">                   <label for="exampleInputEmail1">E-mail</label>                   <input type="text" name="EmailRepresentante" class="form-control" id="exampleInputEmail1" placeholder="E-mail ">                 </div>                    <input type="hidden" name="iduser" value="'.$  idUsuario.'">                  <input type="hidden" name="idFabricante" value="'.$  idFabricante.'">               <!-- /.box-body -->                <div class="box-footer">                 <button type="submit" name="upload" class="btn btn-primary" value="Cadastrar">Cadastrar</button>                 <a class="btn btn-danger" href="../../views/prod">Cancelar</a>               </div>             </form>           </div>           <!-- /.box -->           </div> </div>'; 

estou tentando fazer com que ao clicar em editar preencha automaticamente os campos, mais depois de usar var_dump ta retornando sempre NULL.

Segue a Function com o select:

esse está dentro de uma class fabricante.class.php

public function EditFabricante($  idFabricante){    $  this->query = "SELECT * FROM `fabricante` WHERE 'idFabricante'=    '$  idFabricante'";      if($  this->result = mysqli_query($  this->SQL, $  this->query) or die (         mysqli_error($  this->SQL))){        if($  row = mysqli_fetch_array($  this->result)){            $  NomeFabricante = $  row['NomeFabricante'];           $  CNPJFabricante = $  row['CNPJFabricante'];           $  EmailFabricante = $  row['EmailFabricante'];           $  EnderecoFabricante = $  row['EnderecoFabricante'];           $  TelefoneFabricante = $  row['TelefoneFabricante'];           $  Usuario_idUser = $  row['Usuario_idUser'];          $  array = array('Fabricante' => ['Nome' => $  NomeFabricante, 'CNPJ' => $  CNPJFabricante, 'Email' => $  EmailFabricante, 'Endereco' => $  EnderecoFabricante, 'Telefone' => $  TelefoneFabricante, 'Usuario_idUser' =>$  Usuario_idUser,]);         return $  array;        }    }else{      return 0;   }  } 

Se alguem puder dar uma força agradeço desde de já!

Php Mysql one table username where password length is 60 what md5 or function don’t know

Php Mysql one table username where password length is 60 but i dont know what is function length is 60 . and i forgot my password. so my question is like i have created new user but which function length is 60 i dont know so let me know function name like md5 or other

Thank You, Your Faithfully, Mehul Kanjariya

enter image description here

Debian Wheezy to Jessie — MySQL Dead Slow

We just upgraded the Debian Wheezy(7) to Jessie(8).

All upgrades went smooth except MySQL which I think is causing some or exhaustive slowness specially in the MySQL’s information Schema.

the more lively example that is showing this is from PHPMyAdmin — when we try to update or change a column type, the query takes more than 100 seconds to return back. something similar is happening with other changes on MyISM database tables.

Probable suspects: During Upgrade, we rebooted the server immediately after the upgrade procedure was complete and mysql_upgrade could not complete. This is my own perception as the mysql DB size is more than 400 GB and it might have not completed at all.

Now, the MySQL is behaving insanely on most parts and slowness is observed generally.

Can someone please recommend what would be best option to make things more reliable in terms of the MySQL

Please understand that I have eliminated the risks of Apache2/PHP by completely re-installing them, only left over is the MySQL which is not returning properly.

Can I run the mysql_upgrade now, when the system upgrade is complete and things are back in production — please suggest.

here is an abstract of my.cnf — this is a 130 Gigs to RAM Server, with 1000 connections at a given time.

[client] port            = 3333 socket          = /var/run/mysqld/mysqld.sock [mysqld_safe] socket          = /var/run/mysqld/mysqld.sock nice            = 0 [mysqld] user            = mysql pid-file        = /var/run/mysqld/mysqld.pid socket          = /var/run/mysqld/mysqld.sock port            = 3333 basedir         = /usr datadir         = /var/lib/mysql tmpdir          = /tmp language        = /usr/share/mysql/english skip-external-locking old_passwords=1 ft_min_word_len = 2 skip-name-resolve bind-address            = 0.0.0.0 key_buffer              = 512M key-buffer-size         = 20G sort_buffer_size        = 32M read_buffer_size        = 16M max_allowed_packet      = 1500M thread_stack            = 256K thread_cache_size       = 300 myisam-recover          = BACKUP max_connections        = 1000 table_cache             = 4096 tmp_table_size          = 512M query_cache_limit       = 16M query_cache_size        = 128M join_buffer_size        = 2M innodb_buffer_pool_size = 1000M server-id               = 1 log_bin                 = mysql-bin expire_logs_days        = 10 max_binlog_size         = 100M [mysqldump] quick quote-names max_allowed_packet      = 16M [mysql] [isamchk] key_buffer              = 16M [mysqld_safe] syslog 

Agregar codificación utf-8 al descargar un xls con javascript desde mysql

Estoy descargando un archivo con mis de las tablas traídas de mysql pero al momento de abrir mi archivo xls no tiene la codificación utf-8 y hay caracteres ilegibles.

Este es el código JavaScript que estoy utilizando para descargar ese archivo xls

 <script>         $  (document).ready(function(){              $  .datepicker.setDefaults({                   dateFormat: 'yy-mm-dd'               });              $  (function(){                   $  ("#from_date").datepicker();                   $  ("#to_date").datepicker();              });              $  ('#filter').click(function(){                   var from_date = $  ('#from_date').val();                   var to_date = $  ('#to_date').val();                   if(from_date != '' && to_date != '')                   {                        $  .ajax({                             url:"up_calendar.php",                             method:"POST",                             data:{from_date:from_date, to_date:to_date},                           beforeSend: function() {                             $  ('#order_table').css('background', 'url(/img/ajaxloader.gif) no-repeat center top')                           },                           complete: function(){                             $  ('#order_table').css('background', 'none')                           },                           success:function(data)                             {                                  $  ('#order_table').html(data);                             }                        });                   }                   else                   {                        alert("Selecione Fecha");                   }              });         });    </script>

y este es mi botón con el que ejecuto la función de Javascript

<button onclick="exportTableToExcel('order_table-col', 'members-data')">Export Table Data To Excel File</button>

mysql: может ли у поля с типом varchar быть primary key?

Нужно создать таблицу, в которой буду хранить хеши объектов (товары, заказы и т.д.)

насколькоя понимаю, то в таблице могут быть только 2 поля:

entity_id - primary hash - varchar, not null, len 255 

Вопрос в том, что entity_id может быть не числовым, поэтому скорее всего ему нужно задать тип varchar. Можно ли так делать?

Или как лучше сделать, чтобы потом поиск по этой таблице работал быстро? Размер таблицы будет примерно 500 тыс записей, нужно часто искать в ней, и изменять хеши (итогда нужно будет и удалять записи, но это редко).

Помогите пожалуйста правильно спроектировать таблицу.