## database design – The right way to model multiple FACTs schema

Background

I’m in a process of designing a database (using a STAR schema).

There are three tables to model: products, tests, states.

The database will be used to store results of tests conducted on products (in a great simplification). There can be many tests pointing out to a single product but each test is unique (they are not shared among products). Besides, I need to record the current state of the product, at the time when the test was conducted. Let’s assume that the state of a product describes its current location and owner, which are changing very often. That will most likely involve SCD lvl 2 – to track the history of state changes and to be able to locate a product with all its tests as well as the states it had during these tests.

Problem

I’m not entirely sure how to model this problem. It seems obvious to store every test in a FACT table. This table would then consist of thousands of transactions. On the other hand, there will also be hundreds (and later thousands) of products, so I should probably keep them in a second FACT table. Then, there will also be thousands of state changes, so in order to record their entire history, I would need to keep them in a … FACT table as well? I’ve been told that FACT tables are typically used to store multiple-rows data but on the other hand where are the DIMs in this model?

I also don’t know how to model the relationships between these tables. Productsstates is a 1:* relationship. Productstests is a 1:* as well. Finally, statestests is a 1:* too. I would then go with linking products to states and then states to tests (products 1<-* states 1<-* tests), what would allow me to find all states for a particular product and all tests (in all states or in a selected state). What do you think about that? The problem here is that, as I keep adding states, I have two options: either keep duplicating products in the products table (with added “recorded_timestamp” column) or use a SCD lvl 2 in states table, pointing out to the products table with a FK, but this would effectively make the product table a DIM!

Any help here would be very appreciated.

## [ Politics ] Open Question : Valentina Sampaio becomes Sports Illustrated's first trans model, what do conservatives think?

She is no stranger to making history. In 2017 she became the first trans woman to appear on the cover of Vogue Paris. Two years later, she was the first openly transgender model to be hired by Victoria’s Secret. Now in 2020, 23-year-old Valentina Sampaio continues to break barriers in the modeling industry by becoming the first trans woman to be featured by Sports Illustrated Swimsuit Issue.

## boot loop – Cant flash my firmware on my huawei p8 lite ( Model Num: ALE-UL00___Build num: ALE-UL00C00B230) Also cant find firmware avalable anywhere?

I have been at this for almost 2 days straight now, Here is the scenario: I bought a phone off of E-bay, but it has a wierd firmware on it which didnt allow me to connect to wifi, but instead had a Wlan only option, and no wifi to be found anywhere. It also had all these wierd chinese apps on it with tons of ads bombarding my screen. and no wifi to be found anywhere.

So i decided to load a different version firmware off of an SD card, and not only did the new firmware not work, but it overwrote the old firmware aswell. Now i’m stuck in a bootloop. I have tried about 10 different firmware’s by now and i cant get my device to successfully install it. So then i turned to Windows Powershell.

I followed online instructions, my computer detects my phone in Fastboot mode, but i cant for the love of GOD get my commands applied, it keeps saying:”” FAILED (remote: Command not allowed)“” ‘. Another note, before this whole mess, i enabled USB debugging, but i couldnt find an “”Enable OEM “” slider, I also cant find my exact Firmware anywhere. (So i just played around with simar titled Frimwares. )

**(My Model Number is: ALE-UL00)

(And my Build number is: ALE-UL00C00B230)**

**So now my phone is stuck with no OS/Firmware, and i cant use POWERSHELL because i dont have OEM enabled. SOME PLEASE TELL ME WHAT I CAN DO TO FIX THIS. My current fastboot screen sais : PHONE locked ** does that have something to do with the OEM setting and is that why i cant apply my Powershell Commands? please advise me, IM BEGGING YOU INTERNET!!!

## domain driven design – Serialization in REST API: Generating Representations Based on a Model

I am developing a RESTful API using .NET technology to implement the service.

The part that I am having problems with is the dynamic nature of the representation types that the service will return.

For example, let’s say I have a Person model, and the Person has a bunch of Beyblades toys they can battle other people with.

My model would look something like:

``````public class Person{
public guid ID {get; set;}
public string Name {get; set;}
//...
}
``````

The API will return a list of People by going to “urlpeople”. The representation for the people returned will contain the person’s ID, name, and a link to “urlbeybladesperson-ID” that can be followed instead of the serialized list of their Beyblades (if they have any).

Seems pretty straightforward, but the implementation of a dynamically generating links for lists-of-things (and not the list’s themselves) is what I’m trying to find the best solution for.

My initial thought was to create templates for the representations returned. The template would check the model in order to output the correct representation data. For example, the template would check if the person has any Beyblades, and if so it would generate the link (instead of the serialized list of Beyblade models); likewise, it would generate a self link for each person as well.

The problem with this solution is that if my API is to support JSON (Hal), XML, and say HTML as possible representation output types, I would have to manage at least 3 templates whenever something in the model were changed.

My next thought is to design a serialization framework by implementing a series of MediaTypeFormatter types that would naturally consider my business logic to convert lists into appropriate links; however, this too could become problematic while maintaining the API since there would have to be some sort of standard mapping between lists of things and API URLs and this may not be apparent when changes are made.

Since REST is not a new thing, I was wondering if .NET already has tools for serializing models into a RESTful representations?

Or if there was a best practices document/tutorial on this topic?

Or maybe I’m conceptually going about this wrong and someone here could point me in the right direction?

I realize that REST and OO doesn’t seem go hand-in-hand, so maybe there isn’t anything like what I am seeking. It just feels like I’m inventing a wheel that someone has probably already done.

## ag.algebraic geometry – A normal proper model of an abelian variety with geometrically integral special fiber smooth at the reduction of the origin

Let $$A$$ be an abelian variety over $$mathbb{Q}_p$$. Does there exist a proper flat morphism $$Xto mathrm{Spec}:mathbb{Z}_p$$ such that the special fiber is geometrically integral and smooth at the reduction of the origin, the generic fiber is isomorphic to $$A$$, and $$X$$ is normal? This is true if $$A$$ is one-dimensional.

## django – save model on TabularInline

I want to update the quantity whenever a new purchase is made. I am using admin for it.

``````    class Purchased_InventoryInline(admin.TabularInline):
model=Purchased_Inventory

extra=0
classes = ('collapse')
raw_id_fields=('vendor_name')
can_delete=False
def save_model(self, request, obj, form, change):
obj.user = request.user
obj.item.quantity+=obj.qty
obj.item.save()
obj.save()
super().save_model(request, obj, form, change)
inlines=(Purchased_InventoryInline)
def save_model(self, request, obj, form, change):
obj.user = request.user
pur=0
consu=0
if Purchased_Inventory.objects.filter(item=obj).exists() :
for o in Purchased_Inventory.objects.filter(item=obj):
pur+=o.qty
if Consumed_Inventory.objects.filter(item=obj).exists():
for o in Consumed_Inventory.objects.filter(item=obj):
consu+=o.qty
pc=pur-consu
obj.save()
super().save_model(request, obj, form, change)
``````

Here is my models.py:
Here Vendor is another class with Vendor details which is added as raw_id

``````class Inventory_Checklist(models.Model):
item=models.CharField(max_length=30)
quantity=models.FloatField(default=0, null=True)
units=models.CharField(max_length=10)
min_qty=models.IntegerField(default=0)
vendor=models.ForeignKey(Vendor,on_delete=models.SET_NULL, null=True)
categories=models.CharField(max_length=20)
class Meta:
verbose_name_plural="Inventory Management"
def __str__(self):
return self.item
class Purchased_Inventory(models.Model):
time_purchased=models.DateTimeField(default=timezone.now())
qty=models.IntegerField(default=0)
price=models.IntegerField(default=0, verbose_name="Total Cost")
item=models.ForeignKey(Inventory_Checklist, on_delete=models.SET_NULL, null=True )
vendor_name=models.ForeignKey(Vendor,on_delete=models.SET_NULL, null=True)
class Meta:
verbose_name_plural="Purchased"
def __str__(self):
return ""
``````

## binary tree – Is this model of converting integers to Gray code correct?

The model shown in the figure converts all numbers that have k digits in the binary system to Gray code without any calculation, but I have no proof that guarantees this claim.

Here is some information on how to use it.

Conversion model of all integers that have k digits in the binary system in Gray code.

Rules

1. You will need k columns of numbers. The numbers to be encoded are arranged in the last column.

2. The conversion is done gradually by transferring groups of numbers to the adjacent columns in the way the arrows show. There are two types of paired arrows, parallel (=) and intersecting (×). Symbolically, the (=) and (×) are considered inverse of each other.

3. Each column with arrows is formed by an exact copy of the previous column and by a copy of the previous column that has inverted pairs of arrows, which is placed below the exact copy.

Observation

If we set “=” = 0 and “×” = 1, then the successive columns containing arrows form the Thue Morse sequence which essentially forms the rules for converting integers to Gray code.

## java – Using a domain model to persist metrics

I am currently developing a spring boot web application in which no entity is persistent, and hence will not be saved on a database.

Although, I need to be able to query some business metrics from it. Suppose the following scenario:

1. `EntityA` belongs to a third party API.
2. An user on my web app requests to see some details of `EntityA`.
3. My app then requests `EntityA` from the third party API, does some processing (could be combining that data with some other available on the web), and returns the desired info to the requesting user.

I am not required to persist `EntityA` because it is already being persisted inside the third party API. All the processing done is transient. But, I want to be able to check how many times `EntityA` was requested by an user on my web application, and what data it contained on each request. This metric is useful for audit purposes, for example, since the third party accepts input and output of data. I want to be able to check who input a certain piece of data, and how many times it was done.

If I were to persist `EntityA`, I would not need all fields that the domain model contain. Also, I would have to add some metadata fields to it (date of request, requesting user, etc.).

What is the correct approach to it?

1. Persist the domain model of `EntityA` in my web app, adding the metadata fields on, for example, a superclass?
2. Create a new entity that express the desired metric, for example `RequestedEntity`, and map the desired fields of `EntityA` to RequestedEntity before persisting?

## How can Kneser-Ney Smoothing be integrated into a neural language model?

I found a paper titled Multimodal representation: Kneser-Ney Smoothing/Skip-Gram based neural language model. I am curious about how the Kneser-Ney Smoothing technique can be integrated into a feed-forward neural language model with one linear hidden layer and a softmax activation. What is the purpose of the Kneser-Ney in such a neural network, and how can it be used for learning the conditional probability for the next word?

## i use database first in entity framework in visual studio but when I click ” update model from database ” changes do not apply

i use database first in entity framework in visual studio but when I click ” update model from database ” then I see the message ” using this text template can potentially harm your computer . do not run it if you obtained it from an unstructed source” I click Ok ; but model dont update from database