No suitable mapping model found for core data migration
Tag : ios , By : user150744
Date : March 29 2020, 07:55 AM
this one helps. The mapping model generated by Xcode 4 does not produce the correct hashes needed for the migration to occur. You can compare the output from the migration log to your mapping file's hashes with the code below: NSString *mappingModelPath = [[NSBundle mainBundle] pathForResource:@"MappingFile" ofType:@"cdm"];
NSMappingModel *mappingModel = [[NSMappingModel alloc] initWithContentsOfURL:[NSURL fileURLWithPath:mappingModelPath]];
for (NSEntityMapping *entityMapping in mappingModel.entityMappings) {
NSLog(@"%@: %@", entityMapping.sourceEntityName, entityMapping.sourceEntityVersionHash);
NSLog(@"%@: %@", entityMapping.destinationEntityName, entityMapping.destinationEntityVersionHash);
}
|
Suitable Data Model design (RDBMS) for multiple permutations of data
Date : March 29 2020, 07:55 AM
may help you . Yes there is a better strategy. It's called Dimensional Modeling, or Star Schema. You store one table, called the Fact Table, which has columns for Campaign, Medium, and Supermarket. CREATE TABLE FactTable (
campaign_id INT,
medium_id INT,
supermarket_id INT,
conversions INT,
PRIMARY KEY (campaign_id, medium_id, supermarket_id),
FOREIGN KEY (campaign_id) REFERENCES Campaigns(campaign_id),
FOREIGN KEY (medium_id) REFERENCES Mediums(medium_id),
FOREIGN KEY (supermarket_id) REFERENCES Supermarkets(supermarket_id)
);
SELECT SUM(conversions) FROM FactTable
JOIN Campaigns USING (campaign_id)
WHERE campaign = 'Baked Beans';
SELECT SUM(conversions) FROM FactTable
JOIN Campaigns USING (campaign_id)
JOIN Mediums USING (medium_id)
WHERE campaign = 'Baked Beans' AND medium = 'Facebook';
SELECT SUM(conversions) FROM FactTable
JOIN Supermarkets USING (supermarket_id)
WHERE supermarket = 'Walmart';
SELECT SUM(conversions) FROM FactTable
JOIN Mediums USING (medium_id)
JOIN Supermarkets USING (supermarket_id)
WHERE medium = 'Facebook' AND supermarket = 'Walmart';
SELECT SUM(conversions) FROM FactTable
JOIN Campaigns USING (campaign_id)
JOIN Mediums USING (medium_id)
JOIN Supermarkets USING (supermarket_id)
WHERE campaign = 'Ketchup' AND medium = 'Flash Banner Ad' AND supermarket = 'Safeway';
|
C++, suitable data model, polymorhpism
Tag : cpp , By : Moe Skeeto
Date : March 29 2020, 07:55 AM
should help you out hmm... how about composition? I have made the handle copyable, for completeness #include <utility>
#include <memory>
#include <vector>
#include <iostream>
int f(int a, int t) {
return a * t;
}
struct has_a
{
int a;
};
/// when some T is not derived from has_a, its getat method will return 0
template<class T, std::enable_if_t<not std::is_base_of<has_a, T>::value>* = nullptr>
int impl_getat(const T&, int t) { return 0; }
// when some T is derived from has_a, its getat method will return f(a, t)
template<class T, std::enable_if_t<std::is_base_of<has_a, T>::value>* = nullptr>
int impl_getat(const T& a, int t) { return f(a.a, t); }
// ditto for has_b
struct has_b
{
int b;
};
template<class T, std::enable_if_t<not std::is_base_of<has_b, T>::value>* = nullptr>
int impl_getbt(const T&, int t) { return 0; }
template<class T, std::enable_if_t<std::is_base_of<has_b, T>::value>* = nullptr>
int impl_getbt(const T& b, int t) { return f(b.b, t); }
// ditto for has_c
struct has_c
{
int c;
};
template<class T, std::enable_if_t<not std::is_base_of<has_c, T>::value>* = nullptr>
int impl_getct(const T&, int t) { return 0; }
template<class T, std::enable_if_t<std::is_base_of<has_c, T>::value>* = nullptr>
int impl_getct(const T& c, int t) { return f(c.c, t); }
// an object to hold the polymorphic model
struct handle
{
// the concept that defines the operations on the model
struct concept {
// rule of 5 when virtual destructors are involved...
concept() = default;
concept(const concept&) = default;
concept(concept&&) = default;
concept& operator=(const concept&) = default;
concept& operator=(concept&&) = default;
virtual ~concept() = default;
// cloneable concept
virtual std::unique_ptr<concept> clone() const = 0;
// concept's interface
virtual int getat(int t) = 0;
virtual int getbt(int t) = 0;
virtual int getct(int t) = 0;
};
// a model models the concept, by deriving from any number of discrete parts
template<class...Parts>
struct model : concept, Parts...
{
model(Parts...parts)
: Parts(std::move(parts))...
{}
model(const model&) = default;
// model the clone op
std::unique_ptr<concept> clone() const override {
return std::make_unique<model>(*this);
}
// defer to impl functions (see above) for the calculations
int getat(int t) override { return impl_getat(*this, t); }
int getbt(int t) override { return impl_getbt(*this, t); }
int getct(int t) override { return impl_getct(*this, t); }
};
std::unique_ptr<concept> _impl;
// interface - note: not polymorphic, so we can be stored in a container
int getat(int t) { return _impl->getat(t); }
int getbt(int t) { return _impl->getbt(t); }
int getct(int t) { return _impl->getct(t); }
// constructor - construct from parts
template<class...Parts>
handle(Parts...parts)
: _impl(std::make_unique<model<std::decay_t<Parts>...>>(std::move(parts)...))
{
}
// let's make it copyable
handle(const handle& r)
: _impl(r._impl->clone())
{
}
// rule of 5 because we meddled with the copy constructor...
handle(handle&& r) : _impl(std::move(r._impl)) {}
handle& operator=(const handle& r) {
_impl = r._impl->clone();
return *this;
}
handle& operator=(handle&& r) = default;
};
int main()
{
std::vector<handle> v;
v.emplace_back(has_a{10}, has_b{12});
v.emplace_back(has_a{1}, has_b{2}, has_c {3});
int aa = 1;
for (auto& x : v)
{
std::cout << x.getat(aa) << std::endl;
std::cout << x.getbt(aa) << std::endl;
std::cout << x.getct(aa) << std::endl;
std::cout << std::endl;
++aa;
}
// prove it's copyable etc
auto y = v.back();
std::cout << y.getat(aa) << std::endl;
std::cout << y.getbt(aa) << std::endl;
std::cout << y.getct(aa++) << std::endl;
std::cout << std::endl;
// and moveable
y = handle(has_a{4}, has_b{5}, has_c{6});
std::cout << y.getat(aa) << std::endl;
std::cout << y.getbt(aa) << std::endl;
std::cout << y.getct(aa++) << std::endl;
std::cout << std::endl;
}
10
12
0
2
4
6
3
6
9
16
20
24
|
What kind of data structure is suitable for facebook-model users
Tag : cpp , By : Jody Bannon
Date : March 29 2020, 07:55 AM
|
libvirtError: XML error: expected unicast mac address, found multicast
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I'm setting up KVM automation via ansible and I have one VM which keeps giving me this error: , Best I can tell this is NOT a multicast mac address... 0 1 0 1 0 0 1 1
^ ^
| |
U/L I/G
|