6.0 marshmallow – Lenovo – Internal Storage and SD-Card empty (on device and pc)

As stated above.
Someone asks me to help him with his phone.
I have no clue what happened, I never heard about thats happening before, soo.. yeah…

The phone is an Lenovo with Android 6.0.
It has an 16Gb SD-Card.

Since a couple of days the pictures weren’t accessable. So my friend brought the phone to me.
When going to the Data Manager (The “App” where you can see all file of internal/external storage) it says “Empty” while trieing to view the internal storage.
It doesn’t even recognize the SD-Card.

Same goes when I look at the phone from my PC (via USB).

The phone still works. WhatsApp still works, but is unable to make BackUps because of “No Internal Storage detected”.

Is there anything I can do? The last BackUp of whatsapp is corrupted and I would hate to have to tell my friend that all the pictures, WhatsApp Chats, etc. is gone.

Thanks for everyone trying to help.

bash – Finding if the first and last column of a string is empty

I have string with a pattern like maze, I want to check if the first and last columns of the string is not empty. I tried using the loop to check if the last character before new line is empty or not, but that logic is not working.

Mylar = “- - - - - - - - - - - -
        - - - - -  - - -  - - -
        - - — — - - - — - 
        .- - - - - - - - - - —
        - - - - - - - - - - - -”

The string has rows and columns and size of rows and columns can be any size. The string consists only of spaces and “-“. there is no separation between two adjacent characters

if [ "$str" == "$nl" ] ;
nl='
'

this is inside a loop that check all the characters.

api – Arduino ESP8266 HTTPS Request returning empty response

I want to get some JSON data from a HTTPS secured Webserver using a ESP8266.
For some reason I’m getting an empty response, I believe there’s an error parsing the GET request.
In Chrome I get the JSON response without problems.

GET Request:

httpsClient.print(String("GET ") + path + " HTTP/1.1rn" +
               "Host: " + host + "rn" +               
               "Connection: closernrn");

Host and Path:

const char *host = "www.adler-mannheim.de";
const char *path = "/jsonapi/game/current";

the whole function:

void connect() {


WiFiClientSecure httpsClient;    //Declare object of class WiFiClient

  Serial.println(host);
  httpsClient.setInsecure();
  
  Serial.print("HTTPS Connecting");
  int r=0; //retry counter
  while((!httpsClient.connect(host, httpsPort)) && (r < 30)){
      delay(100);
      Serial.print(".");
      r++;
  }
  if(r==30) {
    Serial.println("Connection failed");
  }
  else {
    Serial.println("Connected to web");
  }
  
  String getData, Link;

  //GET Data

  Serial.print("requesting URL: ");
  Serial.println(host+Link);

  httpsClient.print(String("GET ") + path + " HTTP/1.1rn" +
               "Host: " + host + "rn" +               
               "Connection: closernrn");

  Serial.println("request sent: ");
  Serial.println(String("GET ") + path + " HTTP/1.1rn" +
               "Host: " + host + "rn" +               
               "Connection: closernrn");
                  
  while (httpsClient.connected()) {
    String line = httpsClient.readStringUntil('n');
    if (line == "r") {
      Serial.println("headers received");
      break;
    }
  }

  Serial.println("reply was:");
  Serial.println("==========");
  String line;
  while(httpsClient.available()){        
    line = httpsClient.readStringUntil('n');  //Read Line by Line
    Serial.println(line); //Print response
  }
  Serial.println("==========");
  Serial.println("closing connection");
    
  delay(2000);  //GET Data at every 2 seconds
}

Someone finding the mistake?

Data files half empty in SQL Server. Is that a problem?

I have a multiple TB database and I have been doing some clean-up and dropped many tables. So now the data files are half empty. If I don’t care about releasing the space to the operating system, is there any other reason to shrink the files?
I am thinking that now at least I do not need to worry about auto-growth settings, which might slow things down if I add a large table with ETL.

magento2.3 – entity_type_code_entity table is empty in magento2

I am trying to insert data into the EAV tables, but my main entity table isn’t saving any data but the value tables data is inserted.
My Entity Type code is vinay_employee, my table vinay_employee_entity has three columns entity_id employee_name and employee_email. Data is not inserting into vinay_employee_entity when i am calling save() function but other values tables like vinay_employee_entity_datetime get their data.

Model/EmployeeData.php

namespace VinayEmployeeModel;

use MagentoFrameworkDataObjectIdentityInterface;
use MagentoFrameworkPricingSaleableInterface;
use VinayEmployeeApiDataEmployeeInterface;
use MagentoFrameworkApiAttributeValueFactory;

class EmployeeData extends MagentoFrameworkModelAbstractModel{

    const ENTITY = "vinay_employee";

    protected function _construct() {
        $this->_init('VinayEmployeeModelResourceModelEmployeeData');
    }
}

ResourceModel/EmployeeData.php

namespace VinayEmployeeModelResourceModel;

class EmployeeData extends MagentoEavModelEntityAbstractEntity{
    
    protected function _construct()
    {
        $this->_read = 'vinay_employee_read';
        $this->_write = 'vinay_employee_write';
    }
    
    public function getEntityType() {
        if(empty($this->_type)) {
            $this->setType(VinayEmployeeModelEmployeeData::ENTITY);
        }

        return parent::getEntityType();
    } 
}

Controller/Adminhtml/Emp/Save.php

namespace VinayEmployeeControllerAdminhtmlEmp;

class Save extends VinayEmployeeControllerAdminhtmlEmpAbstractAction {

    //put your code here

    private $connection;
    private $employeeDataFactory;
    private $employee, $employeeDataFactoryResource, $registry;

    public function __construct(
            MagentoBackendAppActionContext $context,
            MagentoFrameworkRegistry $registry,
            MagentoFrameworkAppResourceConnection $resourceConnection,
            VinayEmployeeModelResourceModelEmployeeDataFactory $employeeDataFactoryResource,
            VinayEmployeeModelEmployeeDataFactory $employeeDataFactory) {
        $this->connection = $resourceConnection->getConnection();
        parent::__construct($context);
        $this->employee = $employeeDataFactory;
        $this->registry= $registry;
        $this->employeeDataFactoryResource = $employeeDataFactoryResource;
    }

    public function execute() {
        $postObj = $this->getRequest()->getPostValue();
        echo "<pre>";
        $employeeModel = $this->employee->create(("employee_name", "employee_email"));
        $result = $employeeModel->setData($postObj)->save();
        print_r($result->getData());
        die();
        $this->employeeDataFactoryResource->create()->save($employeeModel);
        return $this->_redirect("employee/emp/index");
    }
}

$result

Array
(
    (form_key) => HSR4TCVPyzs6r6Wi
    (employee_name) => vinn
    (employee_email) => viin
    (employee_address) => ddsdds
    (is_permanent) => 0
    (joined_at) => 2021-04-15 10:02:35
    (vinaykharayat11) => ssdsd
    (parent_id) => 0
    (created_at) => 2021-04-15 04:32:37
    (updated_at) => 2021-04-15 04:32:37
    (entity_id) => 37
)

magento2.3 – Magento 2.3.3 + elasticsearch 6 – empty catalog. Elasticsearch adds WHERE (NULL) to product collection

I have elasticsearch 6.8 and M2.3.3.
On the both category and search pages Magento display:

We can't find products matching the selection.

(MYSQL engine works correctly)

Reindex and cache are refreshed. I also added 2 patches:
https://github.com/magento/magento2/issues/27112#issuecomment-748916677

https://devdocs.magento.com/guides/v2.3/release-notes/release-notes-2-3-3-open-source.html#apply-the-catalog-pagination-issue-on-elasticsearch-6x-patch-to-resolve-a-critical-search-result-pagination-issue

Elasticseach is configured properly:

curl -X GET http://elasticsearch:9200/test_product_1_v15/_search?q=sergei

{"took":7,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":1,"max_score":4.255225,"hits":({"_index":"test_product_1_v15","_type":"document","_id":"246","_score":4.255225,"_source":{"store_id":"1","sku":"Sergey","status":"1","status_value":"Enabled","visibility":"4","name":"Sergey","category_ids":(2,52,84,125),"position_category_2":"0","name_category_2":"Test Category","position_category_52":"0","name_category_52":"Test Category 2","position_category_84":"0","name_category_84":"Test Category 3","position_category_125":"0","name_category_125":"Test","price_4_1":"80.000000","price_0_1":"100.000000","price_1_1":"100.000000","price_2_1":"100.000000","price_3_1":"100.000000","price_5_1":"100.000000","price_6_1":"100.000000"}})}}

Here is the final SQL query from list.phtml – it contains strange condition WHERE (NULL)

SELECT `e`.*, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, IFNULL(review_summary.reviews_count, 0) AS `reviews_count`, IFNULL(review_summary.rating_summary, 0) AS `rating_summary` FROM `catalog_product_entity` AS `e`
 INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
 LEFT JOIN `review_entity_summary` AS `review_summary` ON e.entity_id = review_summary.entity_pk_value AND review_summary.store_id = 1 AND review_summary.entity_type = (SELECT `review_entity`.`entity_id` FROM `review_entity` WHERE (entity_code = 'product')) WHERE (NULL)

Without this condition all seems fine.

I logged collection in this method (I suppose it’s elasticsearch output(?)): MagentoElasticsearchModelLayerCategoryItemCollectionProvider::getCollection()

and WHERE (NULL) already here:

SELECT `e`.* FROM `catalog_product_entity` AS `e` WHERE (NULL)

Any ideas why elastic search adds this condition and how can I rightly discard it?

If elastic search (magento extension) adds NULL because the answer from elastic search is empty, how can I debug it in magento?

magento2 – Magento 2 – need super simple way of assessing whether cart is empty or not in list.phtml file

Client wants to display a conditional message on the category list.phtml page depending on whether or not the cart has ANYTHING in it

I’ve found a lot of posts about creating a custom module to be able to assess cart items etc. but surely there must just be a simple way of identifying whether the cart contains anything or not without the need for a whole module to do so.

I don’t care if we’re counting items, reporting totals, assessing whether a cart exists or however it’s done I just need a ‘cart_empty’ true or false variable

Any ideas?

find if the column of the PostgreSQL table is empty with minimum cost

As far as I know (but not sure), if there are no data at all for the column, there is some property in the database saying that the chunk or the table has no data for this column, at least this happens when adding a new column to the existing table, so the database doesn’t update all existing rows if the default value of a new column is NULL

If the row data ends early, it assumes all column after that for that particular row are NULL, or in newer versions, are whatever DEFAULT was at the time the column was added. But this says nothing at all about what might be in other rows.

You can’t avoid scanning the table unless you a had a very strange constraint which forces the values to all be NULL. But you should be able to scan the table just once, not once for every column.

select count(col1), count(co2), count(col3)...count(col100) from the_table;

mysql – Is adding empty rows bad practice?

I’m struggling to find a definitive answer about saving empty records in a DB. I do realise the question might be a bit vague, but if it’s required, I’m happy to modify the question and provide some scenarios I’m thinking about.

If a client makes a request trying to create a new record in the DB, but the request contains absolutely no data, then my point of view is that the record should not be created at all. In other words, my personal preference is to reject the request and only allow the DB to create a new record only if some data is present. I would also assume that allowing a client to create an empty record also means making all of the fields nullable.

Also, as a side note, I realise this question might not exactly seem specific to the DBA SE, as I feels it covers more topics than just DB-related best practices, but I’m most interested in the DB layer of the application.

Thanks!