Categories
Mastering Development

How do I loop through a firestore document that has an array of maps?

I mostly work with dictionaries since I am fairly new but here we have an embedded struct that I need to loop through. With this, I need to be able to populate expanding cells in UITableView. My struct looks like this: struct Complain: Codable { let eMail, message, timeStamp, userEmail: String let status: Bool let […]

Categories
Mastering Development

sqlite library cannot update database file that has been installed

I can open, read and update a database using the sqlite3 command line tool, like this: C:\ProgramData\spectronix\oximeter>C:\Users\James\code\bin\sqlite3 spectrumalpha.dat SQLite version 3.16.2 2017-01-06 16:32:41 Enter “.help” for usage hints. sqlite> .schema CREATE TABLE run ( run INTEGER PRIMARY KEY, timestamp, desc ); CREATE TABLE distance ( hwid, distance ); CREATE TABLE spectrum ( run, timestamp, hwid, […]

Categories
Development

How to add category even if it doesn’t occur in period?

My SQL queyry SELECT date_trunc(‘day’,timestamp), device_log_sections.name, COUNT(*) FROM “device_logs” RIGHT JOIN “device_log_sections” ON “device_log_sections”.”id” = “device_logs”.”device_log_section_id” WHERE (timestamp >= ‘2020-02-11T00:00:00+02:00’) AND (timestamp <= ‘2020-02-21T23:59:00+02:00’) GROUP BY date_trunc(‘day’,timestamp), device_log_sections.name ORDER BY date_trunc(‘day’,timestamp) The result is My device_log_sections table has categories ping, oob, connection,disconnection, auth, server. I’d like to have a result where each category is represented […]

Categories
Development

Nest 12980 – 02/21/2020, 08:55:42 [ExceptionHandler] Data type “Object” in “GenConfig.gen_value” is not supported by “postgres” database. +14ms

The error occurs when I set the data type of gen_value column to JSON in a NestJS entity file. I have added import ‘reflect-metadata’ to the code but the error still occurs. Why is the error occur? How do I fix it? Here is the sample code. import { BaseCustomEntity } from ‘../../utils/base/entity/base-custom.entity’; import ‘reflect-metadata’; […]

Categories
CMS Development Drupal

How can I reference previously imported media entities – Drupal 8 Migration

I have been trying to attach media entities to node entities in Drupal 8 with a custom migration but despite numerous attempts and countless hours reviewing forums i’m stumped – I’m desperately hoping someone can help explain where I might be going wrong. Steps I have taken: Created a custom migration to import files (Using […]

Categories
Development

Add Timestamp while insertMany() in mongoDB

Hi I am MySQL user and new to mongoDB. I get data from my IOT devices as following: $body={ “key”: “121239”, “secrete”: “Your_Device_Secrete”, “data”: [ { “Temperature”:50, “Humidity”:30, “Vibration”:100, “Time”:”2020-1-26 00:00:01″ }, { “Temperature”:55, “Humidity”:34, “Vibration”:50, “Time”:”2020-1-26 00:00:02″ } ] } I am inserting it into mongoDB using PHP CodeIgnitor as following: $this->mongo->batch_insert($body[“key”],$body[“data”]); data is […]

Categories
Development

Create trigger in MySQL to log changes in database

UPDATE! The Delimiter thing actually solved my original problem. But I now ended up with a new Error. I’ll describe it below along with the implementet changes that solved the first problem. I am trying to write a trigger that will log changes in the database to a seperate table. But I keep getting the […]

Categories
Development

Cannot import pandas: ImportError: cannot import name ‘ops’

I am not able to import pandas in the conda environment py35 in a virtual machine. I get this error in the notebook, I started getting this error after I force conda installed tpot package. After I installed conda force installed tpot, I conda force installed pandas again since I was getting another attribute error, […]

Categories
Development

How to Convert a UTC datetime to BST Time British Summer Time (BST) Laravel Carbon

I am trying to convert UTC time to BST. It shows incorrect results if I am correct. $timestamp = ‘2020-03-30 16:34:00’; $date = \Carbon\Carbon::createFromFormat(‘Y-m-d H:i:s’, $timestamp, ‘Europe/London’); $date->tz(‘BST’); $bst = $date->toDateTimeString(); Above code outputs 2020-03-30 15:34:00. Note that BST is one hour less in the output.

Categories
CMS Development Drupal

Configuration Import Error

I have a drupal8 in local system. I want to import my production environment configurations into my local. So i am running drush cim -y I got the following error. Unexpected error during import with operation update for core.entity_view_display.paragraph.card.full: The “linkit” plugin does not exist. Valid plugin IDs for Drupal\Core\ Field\FormatterPluginManager are: address_country_default, address_default, address_plain, […]