new LSI megaraid Sas/sata 8286-8e controller won’t import foreign (old) disks

Had a previous controller go bad — new controller is able to see disks, but all as Foreign , unconfigured good. There were 2 VD’s, 1 in each container both arranged as RAID 10 — 2 stripes in each container each disk in the strip mirroring.

Previous controller was definition the problem — as it wouldn’t even see the disks, new controller comes up and lists all the physical disks, but 0 VD’s (instead of the 2, expected). Going into the webbios of the card, it says they are all a foreign config and asks if I want to import them, but no place to say y/n, only a list where it says ‘All configurations’ and under that, configs numbered 1-7. Tried all, but all give ‘error in reading config’. The previous controller was a 8286CV-8e, but I never used the cache-vault feature. I thought this new controller should have just read them in, but not.

It is a bit odd that all are marked as unconfigured good, I thought. Have had situation before where all were marked Unconf-bad, and had to mark each good, and that was it. But now, I was sure it should be able to read the config from the existing set. Don’t understand how it knows they are a foreign set, but can’t read config in from any in either .

I hope someone has a suggestion — as we are talking about 12*4TB and 12*2TB of data between the two drives (with 12 disks on each being mirrors). Thanks!

Database schema design for foreign language dictionary [on hold]

As a side project I’m working on a translation API that will take an English word, and then return the equivalent in another language. However, some words can have multiple meanings when translated so I’d like to return a range of possible definitions and some example sentences to go with them.

I think I’m going to go for a relational database but does it make sense to have two separate tables for words in each language? One for the English words, and then another for the words in a second language? And then both tables have a many to many relationship?

Basic schema representation

Is this a good idea, or can any recommend a better design for my database?

Can any recommend a sensible database design for such an application?

No puedo ingresar un dato de una clave foránea Cannot add or update a child row: a foreign key constraint fails

Buen dia.

Realice un base de datos como proyecto para un hospital con MYSQL. Realice un formulario en HTML para agendar una cita de un paciente ya existente y ocupe PHP para realizar la inserción de los datos . Pero me manda el siguiente error.

BASE DE DATOS

TABLA pacienes (ID_PACIENTE int) PK TABLA consulta (ID_CONSULTA int) PK TABLA doctores (ID_DOCTOR int) PK ---- TABLA asignado (PACIENTE_ID)FK/(CONSULTA_ID)FK/(DOCTOR_ID)FK/  

‘Cannot add or update a child row: a foreign key constraint fails (base2.asignado, CONSTRAINT FK_DR FOREIGN KEY (DOCTOR_ID) REFERENCES doctores (ID_DOCTOR) ON DELETE NO ACTION)’

PHP

    if (!$  conn) {         die("Conexion Fallida").mysqli_connect_error();     }     echo "Conexion Exitosa";     echo "<br>";     $  sql = "INSERT INTO asignado (PACIENTE_ID, CONSULTA_ID, DOCTOR_ID, HORARIO) VALUES ('$  _REQUEST[PACIENTE_ID]', '$  _REQUEST[CONSULTA_ID]', '$  _REQUEST[DOCTOR_ID]', '$  _REQUEST[HORARIO]')";         if (mysqli_query($  conn, $  sql)) {               echo "New record created successfully";         } else {               echo "!!UPS Algo salio mal!!: " . $  sql . "<br>" . mysqli_error($  conn); } mysqli_close($  conn); 

Me podrían ayudar.

Getting the capslock to input foreign caracters and currency

I am having a lot of difficulty with Bionic Beaver inputting foreign characters and currencies. In the past I could easily change the settings to use [capslock] and then o”–>Ö, the came goes with [E-]–>€. Does anyone else have trouble with this in Bionic Beaver?

Configure keyboard shortcuts to CapsLock and Shift + CapsLock in 18.04 Bionic Beaver

as seen in the image there is not the usual keyboard and mouse tab, the settings are also different from say 16.04 etc.

Is this foreign call some kind of scam and what kind is it?

Every few days I get a call on my mobile phone from a number like 370 621 65748, which seems to be a Lithuanian number, but it only rings once and then disconnects. It happens enough to seem intentional, but since they don’t even wait until I answer, it’s not clear what possible gain could be had.

Is this a known scam or attack vector? Could they be calling numbers at random and probing for vulnerability in some way even without me answering?

“Cannot drop index ‘unique_token_data’: needed in a foreign key constraint” in MySQL without a foreign key

When I try to remove a unique index, MySQL Ver 5.7.26-0ubuntu0.19.04.1 says that it is needed in a foreign key constraint:

mysql> ALTER TABLE project_erc20token DROP INDEX unique_token_data; ERROR 1553 (HY000): Cannot drop index 'unique_token_data': needed in a foreign key constraint 

But there is no such foreign key in the DB!

What is the error?

DB dump follows:

-- MySQL dump 10.13  Distrib 5.7.26, for Linux (x86_64) -- -- Host: localhost    Database: crypto4ngo -- ------------------------------------------------------ -- Server version   5.7.26-0ubuntu0.19.04.1  /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;  -- -- Table structure for table `auth_group` --  DROP TABLE IF EXISTS `auth_group`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `auth_group` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `name` varchar(150) NOT NULL,   PRIMARY KEY (`id`),   UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `auth_group` --  LOCK TABLES `auth_group` WRITE; /*!40000 ALTER TABLE `auth_group` DISABLE KEYS */; /*!40000 ALTER TABLE `auth_group` ENABLE KEYS */; UNLOCK TABLES;  -- -- Table structure for table `auth_group_permissions` --  DROP TABLE IF EXISTS `auth_group_permissions`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `auth_group_permissions` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `group_id` int(11) NOT NULL,   `permission_id` int(11) NOT NULL,   PRIMARY KEY (`id`),   UNIQUE KEY `auth_group_permissions_group_id_permission_id_0cd325b0_uniq` (`group_id`,`permission_id`),   KEY `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` (`permission_id`),   CONSTRAINT `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`),   CONSTRAINT `auth_group_permissions_group_id_b120cbf9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `auth_group_permissions` --  LOCK TABLES `auth_group_permissions` WRITE; /*!40000 ALTER TABLE `auth_group_permissions` DISABLE KEYS */; /*!40000 ALTER TABLE `auth_group_permissions` ENABLE KEYS */; UNLOCK TABLES;  -- -- Table structure for table `auth_permission` --  DROP TABLE IF EXISTS `auth_permission`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `auth_permission` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `name` varchar(255) NOT NULL,   `content_type_id` int(11) NOT NULL,   `codename` varchar(100) NOT NULL,   PRIMARY KEY (`id`),   UNIQUE KEY `auth_permission_content_type_id_codename_01ab375a_uniq` (`content_type_id`,`codename`),   CONSTRAINT `auth_permission_content_type_id_2f476e4b_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `auth_permission` --  LOCK TABLES `auth_permission` WRITE; /*!40000 ALTER TABLE `auth_permission` DISABLE KEYS */; /*!40000 ALTER TABLE `auth_permission` ENABLE KEYS */; UNLOCK TABLES;  -- -- Table structure for table `django_admin_log` --  DROP TABLE IF EXISTS `django_admin_log`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `django_admin_log` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `action_time` datetime(6) NOT NULL,   `object_id` longtext,   `object_repr` varchar(200) NOT NULL,   `action_flag` smallint(5) unsigned NOT NULL,   `change_message` longtext NOT NULL,   `content_type_id` int(11) DEFAULT NULL,   `user_id` int(11) NOT NULL,   PRIMARY KEY (`id`),   KEY `django_admin_log_content_type_id_c4bce8eb_fk_django_co` (`content_type_id`),   KEY `django_admin_log_user_id_c564eba6_fk_user_user_id` (`user_id`),   CONSTRAINT `django_admin_log_content_type_id_c4bce8eb_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`),   CONSTRAINT `django_admin_log_user_id_c564eba6_fk_user_user_id` FOREIGN KEY (`user_id`) REFERENCES `user_user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `django_admin_log` --  LOCK TABLES `django_admin_log` WRITE; /*!40000 ALTER TABLE `django_admin_log` DISABLE KEYS */; /*!40000 ALTER TABLE `django_admin_log` ENABLE KEYS */; UNLOCK TABLES;  -- -- Table structure for table `django_content_type` --  DROP TABLE IF EXISTS `django_content_type`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `django_content_type` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `app_label` varchar(100) NOT NULL,   `model` varchar(100) NOT NULL,   PRIMARY KEY (`id`),   UNIQUE KEY `django_content_type_app_label_model_76bd3d3b_uniq` (`app_label`,`model`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `django_content_type` --  LOCK TABLES `django_content_type` WRITE; /*!40000 ALTER TABLE `django_content_type` DISABLE KEYS */; /*!40000 ALTER TABLE `django_content_type` ENABLE KEYS */; UNLOCK TABLES;  -- -- Table structure for table `django_migrations` --  DROP TABLE IF EXISTS `django_migrations`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `django_migrations` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `app` varchar(255) NOT NULL,   `name` varchar(255) NOT NULL,   `applied` datetime(6) NOT NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `django_migrations` --  LOCK TABLES `django_migrations` WRITE; /*!40000 ALTER TABLE `django_migrations` DISABLE KEYS */; INSERT INTO `django_migrations` VALUES (1,'contenttypes','0001_initial','2019-06-02 23:48:08.042378'),(2,'contenttypes','0002_remove_content_type_name','2019-06-02 23:48:08.109635'),(3,'auth','0001_initial','2019-06-02 23:48:08.175753'),(4,'auth','0002_alter_permission_name_max_length','2019-06-02 23:48:08.340695'),(5,'auth','0003_alter_user_email_max_length','2019-06-02 23:48:08.355964'),(6,'auth','0004_alter_user_username_opts','2019-06-02 23:48:08.365035'),(7,'auth','0005_alter_user_last_login_null','2019-06-02 23:48:08.372186'),(8,'auth','0006_require_contenttypes_0002','2019-06-02 23:48:08.374797'),(9,'auth','0007_alter_validators_add_error_messages','2019-06-02 23:48:08.379832'),(10,'auth','0008_alter_user_username_max_length','2019-06-02 23:48:08.386091'),(11,'auth','0009_alter_user_last_name_max_length','2019-06-02 23:48:08.391981'),(12,'user','0001_initial','2019-06-02 23:48:08.454908'),(13,'admin','0001_initial','2019-06-02 23:48:08.702918'),(14,'admin','0002_logentry_remove_auto_add','2019-06-02 23:48:08.814770'),(15,'admin','0003_logentry_add_action_flag_choices','2019-06-02 23:48:08.837096'),(16,'auth','0010_alter_group_name_max_length','2019-06-02 23:48:08.853074'),(17,'auth','0011_update_proxy_permissions','2019-06-02 23:48:08.864174'),(18,'project','0001_initial','2019-06-02 23:48:08.907983'),(19,'project','0002_project_user','2019-06-02 23:48:09.008687'),(20,'project','0003_auto_20180329_0214','2019-06-02 23:48:09.147515'),(21,'project','0004_auto_20180330_0432','2019-06-02 23:48:09.221409'),(22,'project','0005_auto_20180331_2048','2019-06-02 23:48:09.296913'),(23,'project','0006_project_disabled','2019-06-02 23:48:09.352610'),(24,'project','0007_auto_20180405_1811','2019-06-02 23:48:09.492833'),(25,'project','0008_projectversion_owner','2019-06-02 23:48:09.538680'),(26,'project','0009_auto_20180405_1957','2019-06-02 23:48:09.600958'),(27,'project','0010_auto_20180405_1958','2019-06-02 23:48:09.666514'),(28,'project','0011_auto_20181212_0029','2019-06-02 23:48:09.733264'),(29,'project','0012_auto_20190426_1926','2019-06-02 23:48:09.753808'),(30,'project','0013_paymenturls','2019-06-02 23:48:09.785307'),(31,'project','0014_auto_20190427_1253','2019-06-02 23:48:09.899803'),(32,'project','0015_auto_20190427_1255','2019-06-02 23:48:09.955520'),(33,'project','0016_auto_20190427_1256','2019-06-02 23:48:10.028208'),(34,'project','0017_auto_20190427_1308','2019-06-02 23:48:10.088524'),(35,'project','0018_auto_20190510_1306','2019-06-02 23:48:10.169626'),(36,'project','0019_auto_20190510_1319','2019-06-02 23:48:10.294121'),(37,'project','0020_auto_20190510_1406','2019-06-02 23:48:10.319996'),(38,'project','0021_auto_20190523_1329','2019-06-02 23:48:10.329473'),(39,'project','0022_auto_20190524_0749','2019-06-02 23:48:10.508430'),(40,'project','0023_auto_20190525_1012','2019-06-02 23:48:10.518815'),(41,'project','0024_auto_20190525_2307','2019-06-02 23:48:10.531579'),(42,'project','0025_auto_20190526_0752','2019-06-02 23:48:10.538459'),(43,'project','0026_auto_20190527_0238','2019-06-02 23:48:10.705232'),(44,'project','0027_project_current_erc20_wallet','2019-06-02 23:48:10.860732'),(45,'project','0028_auto_20190527_1941','2019-06-02 23:48:10.955087'),(46,'project','0029_remove_project_current_erc20_token','2019-06-02 23:48:10.994059'); /*!40000 ALTER TABLE `django_migrations` ENABLE KEYS */; UNLOCK TABLES;  -- -- Table structure for table `project_erc20token` --  DROP TABLE IF EXISTS `project_erc20token`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `project_erc20token` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `created` datetime(6) NOT NULL,   `owner` varchar(42) NOT NULL,   `contract_address` varchar(42) NOT NULL,   `contract_symbol` varchar(255) NOT NULL,   `contract_name` varchar(255) NOT NULL,   `project_id` int(11) NOT NULL,   `wallet_id` int(11) DEFAULT NULL,   `unqiue_hack` char(32) NOT NULL,   PRIMARY KEY (`id`),   UNIQUE KEY `unique_token_data` (`project_id`,`contract_address`,`contract_symbol`,`contract_name`,`owner`),   UNIQUE KEY `unqiue_hack` (`unqiue_hack`),   UNIQUE KEY `wallet_id` (`wallet_id`),   CONSTRAINT `project_erc20token_project_id_d389b8fb_fk_project_project_id` FOREIGN KEY (`project_id`) REFERENCES `project_project` (`id`),   CONSTRAINT `project_erc20token_wallet_id_db01a319_fk_project_e` FOREIGN KEY (`wallet_id`) REFERENCES `project_ethereumwallet` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `project_erc20token` --  LOCK TABLES `project_erc20token` WRITE; /*!40000 ALTER TABLE `project_erc20token` DISABLE KEYS */; /*!40000 ALTER TABLE `project_erc20token` ENABLE KEYS */; UNLOCK TABLES;  -- -- Table structure for table `project_ethereumwallet` --  DROP TABLE IF EXISTS `project_ethereumwallet`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `project_ethereumwallet` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `created` datetime(6) NOT NULL,   `address` varchar(42) NOT NULL,   `project_id` int(11) NOT NULL,   PRIMARY KEY (`id`),   UNIQUE KEY `unique_ethereum_data` (`project_id`,`address`),   CONSTRAINT `project_ethereumwallet_project_id_f02b3077_fk_project_project_id` FOREIGN KEY (`project_id`) REFERENCES `project_project` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `project_ethereumwallet` --  LOCK TABLES `project_ethereumwallet` WRITE; /*!40000 ALTER TABLE `project_ethereumwallet` DISABLE KEYS */; /*!40000 ALTER TABLE `project_ethereumwallet` ENABLE KEYS */; UNLOCK TABLES;  -- -- Table structure for table `project_paymenturl` --  DROP TABLE IF EXISTS `project_paymenturl`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `project_paymenturl` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `order` int(10) unsigned NOT NULL,   `url` varchar(200) NOT NULL,   `title` varchar(255) NOT NULL,   `project_version_id` int(11) NOT NULL,   PRIMARY KEY (`id`),   KEY `project_paymenturls_order_7c405be4` (`order`),   KEY `project_paymenturls_project_version_id_82ae8cc8_fk_project_p` (`project_version_id`),   CONSTRAINT `project_paymenturls_project_version_id_82ae8cc8_fk_project_p` FOREIGN KEY (`project_version_id`) REFERENCES `project_projectversion` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `project_paymenturl` --  LOCK TABLES `project_paymenturl` WRITE; /*!40000 ALTER TABLE `project_paymenturl` DISABLE KEYS */; /*!40000 ALTER TABLE `project_paymenturl` ENABLE KEYS */; UNLOCK TABLES;  -- -- Table structure for table `project_project` --  DROP TABLE IF EXISTS `project_project`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `project_project` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `created` datetime(6) NOT NULL,   `updated` datetime(6) NOT NULL,   `user_id` int(11) NOT NULL,   `disabled` tinyint(1) NOT NULL,   `current_erc20_wallet_id` int(11) DEFAULT NULL,   PRIMARY KEY (`id`),   KEY `project_project_user_id_8710107a_fk_user_user_id` (`user_id`),   KEY `project_project_current_erc20_wallet_6187e471_fk_project_e` (`current_erc20_wallet_id`),   CONSTRAINT `project_project_current_erc20_wallet_6187e471_fk_project_e` FOREIGN KEY (`current_erc20_wallet_id`) REFERENCES `project_ethereumwallet` (`id`),   CONSTRAINT `project_project_user_id_8710107a_fk_user_user_id` FOREIGN KEY (`user_id`) REFERENCES `user_user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `project_project` --  LOCK TABLES `project_project` WRITE; /*!40000 ALTER TABLE `project_project` DISABLE KEYS */; /*!40000 ALTER TABLE `project_project` ENABLE KEYS */; UNLOCK TABLES;  -- -- Table structure for table `project_projectversion` --  DROP TABLE IF EXISTS `project_projectversion`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `project_projectversion` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `created` datetime(6) NOT NULL,   `title` varchar(200) NOT NULL,   `description` longtext NOT NULL,   `money_usage` longtext NOT NULL,   `allow_advertisement` tinyint(1) NOT NULL,   `allow_press_releases` tinyint(1) NOT NULL,   `ownership` smallint(6) NOT NULL,   `country` varchar(2) NOT NULL,   `organization_name` varchar(255) NOT NULL,   `organization_number` varchar(20) NOT NULL,   `project_id` int(11) NOT NULL,   `url` varchar(200) NOT NULL,   `bitcoin_address` varchar(35) DEFAULT NULL,   PRIMARY KEY (`id`),   KEY `project_projectversion_project_id_b2445cad_fk_project_project_id` (`project_id`),   CONSTRAINT `project_projectversion_project_id_b2445cad_fk_project_project_id` FOREIGN KEY (`project_id`) REFERENCES `project_project` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `project_projectversion` --  LOCK TABLES `project_projectversion` WRITE; /*!40000 ALTER TABLE `project_projectversion` DISABLE KEYS */; /*!40000 ALTER TABLE `project_projectversion` ENABLE KEYS */; UNLOCK TABLES;  -- -- Table structure for table `user_user` --  DROP TABLE IF EXISTS `user_user`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user_user` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `password` varchar(128) NOT NULL,   `last_login` datetime(6) DEFAULT NULL,   `is_superuser` tinyint(1) NOT NULL,   `username` varchar(150) NOT NULL,   `first_name` varchar(30) NOT NULL,   `last_name` varchar(150) NOT NULL,   `email` varchar(254) NOT NULL,   `is_staff` tinyint(1) NOT NULL,   `is_active` tinyint(1) NOT NULL,   `date_joined` datetime(6) NOT NULL,   `ssh_pubkey` longtext NOT NULL,   `pgp_pubkey` longtext NOT NULL,   `show_email` tinyint(1) NOT NULL,   `show_keys` tinyint(1) NOT NULL,   PRIMARY KEY (`id`),   UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `user_user` --  LOCK TABLES `user_user` WRITE; /*!40000 ALTER TABLE `user_user` DISABLE KEYS */; /*!40000 ALTER TABLE `user_user` ENABLE KEYS */; UNLOCK TABLES;  -- -- Table structure for table `user_user_groups` --  DROP TABLE IF EXISTS `user_user_groups`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user_user_groups` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `user_id` int(11) NOT NULL,   `group_id` int(11) NOT NULL,   PRIMARY KEY (`id`),   UNIQUE KEY `user_user_groups_user_id_group_id_bb60391f_uniq` (`user_id`,`group_id`),   KEY `user_user_groups_group_id_c57f13c0_fk_auth_group_id` (`group_id`),   CONSTRAINT `user_user_groups_group_id_c57f13c0_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`),   CONSTRAINT `user_user_groups_user_id_13f9a20d_fk_user_user_id` FOREIGN KEY (`user_id`) REFERENCES `user_user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `user_user_groups` --  LOCK TABLES `user_user_groups` WRITE; /*!40000 ALTER TABLE `user_user_groups` DISABLE KEYS */; /*!40000 ALTER TABLE `user_user_groups` ENABLE KEYS */; UNLOCK TABLES;  -- -- Table structure for table `user_user_user_permissions` --  DROP TABLE IF EXISTS `user_user_user_permissions`; /*!40101 SET @saved_cs_client     = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user_user_user_permissions` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `user_id` int(11) NOT NULL,   `permission_id` int(11) NOT NULL,   PRIMARY KEY (`id`),   UNIQUE KEY `user_user_user_permissions_user_id_permission_id_64f4d5b8_uniq` (`user_id`,`permission_id`),   KEY `user_user_user_permi_permission_id_ce49d4de_fk_auth_perm` (`permission_id`),   CONSTRAINT `user_user_user_permi_permission_id_ce49d4de_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`),   CONSTRAINT `user_user_user_permissions_user_id_31782f58_fk_user_user_id` FOREIGN KEY (`user_id`) REFERENCES `user_user` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;  -- -- Dumping data for table `user_user_user_permissions` --  LOCK TABLES `user_user_user_permissions` WRITE; /*!40000 ALTER TABLE `user_user_user_permissions` DISABLE KEYS */; /*!40000 ALTER TABLE `user_user_user_permissions` ENABLE KEYS */; UNLOCK TABLES;  -- -- Dumping events for database 'crypto4ngo' --  -- -- Dumping routines for database 'crypto4ngo' -- /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;  /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;  -- Dump completed on 2019-06-03  3:06:39 

Securing a Laptop from a Foreign Intelligence Agency

What would be the best practices for securing a single-purpose Windows laptop against a determined foreign intelligence agency from tampering with data on the machine? The machine would be used several times per year by two individuals who independently verify each other’s work and print the results. The machine would not need access to the Internet, but when in use would need to be connected to a printer.

Some of the things I’ve thought of so far:

  • Use a laptop with a TPM module.
  • Encrypt the drive.
  • Disable the NIC.
  • Disable the USB ports.
  • Use a strong password on the machine.
  • Physically store the machine in a locked safe while not in use.
  • When used, transport the laptop using two different security personnel.
  • While out of the safe, the laptop would always be attended by at least two individuals.
  • The laptop would be a fresh install of windows with no 3rd party software installed on it (not sure about updates in a situation like this).
  • The custom software on the computer, when run, would compute the hash of it’s binary files (e.g. exe and dll) and generate a code that the user would compare to a known value to detect tampering.

Any changes or additions?

Extending IdentityUser with nullable foreign key to another IdentityUser

I’m working on a framework which builds on .net core Identity. Let’s say I wanted to extend the IdentityUser<TKey> class with a ParentUserId property while the developer should still be able to decide which type to use for the TKey primary key. This property would be a foreign key to another user, but could be null if the user doesn’t have a parent.

Using string for TKey would work without problems because strings are nullable and don’t conflict with the where TKey : IEquatable<TKey> constraint (although I don’t know why). But if the developer decides to use int, I’m screwed.

Currently I’m thinking about a solution like this:

public class FrameworkUser<TKey, TNullableKey> : IdentityUser<TKey>         where TKey : IEquatable<TKey> {     public virtual TNullableKey ParentUserId { get; set; }      // for better understanding     public virtual FrameworkUser<TKey, TNullableKey> ParentUser { get; set; } } 

But I’m very unsure and don’t think it’s beautiful.

  1. The developer could do something like new FrameworkUser<string, int?>() by mistake. Would be great if something like where TNullableKey : Nullable<TKey> were possible.

  2. I can’t constraint TNullableKey. IEquatable doesn’t allow nullable value types (i.e. int?), although I don’t know if this will result in worse performance when used as a foreign key anyway. struct won’t allow strings.

  3. Getting the value of ParentUserId will differ depending on the type. For instance to securely get the value of an int?, I would check for int?.HasValue to be true and then get it’s value from int?.Value. The same procedure is quite different for a string which could be null, empty, or have some chars. This would make switches from one type to another without extra work difficult/impossible.

Another solution could be having two implementations, one for string and one for struct, but that’s not feasible because then I would also need to have two IdentityStore<TUser>s and so on.

So, what would you do?

Extending IdentityUser with nullable foreign key to another IdentityUser

I’m working on a framework which builds on .net core Identity. Let’s say I wanted to extend the IdentityUser<TKey> class with a ParentUserId property while the developer should still be able to decide which type to use for the TKey primary key. This property would be a foreign key to another user, but could be null if the user doesn’t have a parent.

Using string for TKey would work without problems because strings are nullable and don’t conflict with the where TKey : IEquatable<TKey> constraint (although I don’t know why). But if the developer decides to use int, I’m screwed.

Currently I’m thinking about a solution like this:

public class FrameworkUser<TKey, TNullableKey> : IdentityUser<TKey>         where TKey : IEquatable<TKey> {     public virtual TNullableKey ParentUserId { get; set; }      // navigation property depending on ParentUserId     public virtual FrameworkUser<TKey, TNullableKey> ParentUser { get; set; } } 

But I’m very unsure and don’t think it’s beautiful.

  1. The developer could do something like new FrameworkUser<string, int?>() by mistake (could be catched at runtime). Would be great if something like where TNullableKey : Nullable<TKey> were possible.

  2. I can’t constraint TNullableKey. IEquatable doesn’t allow nullable value types (i.e. int?), although I don’t know if this will result in worse performance when used as a foreign key anyway. struct won’t allow strings.

  3. Getting the value of ParentUserId will differ depending on the type. For instance to securely get the value of an int?, I would check for int?.HasValue to be true and then get it’s value from int?.Value. The same procedure is quite different for a string which could be null, empty, or have some chars. This would make switches from one type to another without extra work difficult/impossible.

Another solution could be having two implementations, one for string and one for struct, but that’s not feasible because then I would also need to have two IdentityStore<TUser>s and so on.

So, what would you do?