Does cobalt support Factory reset mode or API?

I would like to ask the cobalt whether existing factory mechanism or related interface? If not, whether will have a related work plan, thank you.Factory mode: For example, it will delete all useful info, cookies, and other data, and let changed things to restore the original state. make it the same as when the user first used it. then to restart the application....Read more

factory - How to handle price dynamic

We have requirement to handle price dynamic (referring external system).We would like to know, what is the best way to handle dynamic pricing among below :Approach 1 :Creating Price factory extension and overriding getBasePrice() method of customPricefactoryManager. Please confirm if it uses jalo layer.Approach 2 :In DefaultSLFindPriceStrategy we can customize getBasePrice() method.If any other way too, please lets know.We would like to know which approach can help to handle prices in addtocart operation, checkout and product page details prici...Read more

factory - Add eObject to the parse tree programaticaly

Here is a snapshot of my grammar:Sort: name=ID ;Variable name=ID ':' type=[Sort]My requirement is to have a predefined Sort let's call it Loc. There is no need for the user to define this sort, thus when a Variable is defined with a Loc type, Xtext should automatically reference it to my predefined Sort. How can I initiate the program so that at the beginning a Sort instance is generated? I already used the Factory method 'CreateSort' in my validator class, but no use. any idea?...Read more

factory - Proximity sensor recommendation to detect hand & blood

My company is interested in designing a protection system for small industrial machines, where factory employees insert wooden objects that are then cut by these machines.The protection system needs to be aware of the presence of a human arm when inserted into the input-hall - the human arm will then put a piece of wood and the machine will cut the wood - however, the protection system needs to be able to detect the presence of blood in case for some reason the arm is cut - and in that case shut off the power of the industrial machine.I'm no ex...Read more

factory - Creation of controlled type will call finalize on return

I want to create a function for creating and initializing a controlled type (a bit like a factory) in the following manner:function Create return Controlled_Typeis Foo : Controlled_Type;begin Put_Line ("Check 1") return Foo;end Create;procedure Mainis Bar : Controlled_Type := Create;begin Put_Line ("Check 2")end Main;output:InitializeCheck 1AdjustFinalizeAs the finalize will dispose of some objects that are pointed to in the controlled type I end up with dangling pointers in Bar, and somehow this immediately crashes the program, so I nev...Read more

factory - Create a DbContext that handle a DatabaseFactory to use DapperExtensions more easily

This days I try to create an abstract base repository using some basic CRUD functions proposed by DapperExtensions. But the code given as an exemple use a SqlConnection which is made to connect to a SQL Server database. I want to be able to connect to all kind of Database (SQL Server, MySql, etc...). Also their code sample is repeated for each CRUD function as the code below showusing (SqlConnection cn = new SqlConnection(_connectionString)){ cn.Open(); //Code doing something here... cn.Close();}So i was thinking about to create a DbCo...Read more

factory - PhpStorm type-hinting for factories?

I have code more or less like this:class Foo { public static function factory($str) { $class = "Foo_" . $str; return new $class; }}class Foo_Bar { public function razzle() { print "Foo_Bar->baz() was called"; }}$Obj = Foo::factory('Bar');and I would like PhpStorm to understand that $Obj is a Foo_Bar object, so that for example if I type $Obj->raz, razzle() will show up for autocompletion.Is there any way to get this? To tell PhpStorm that the function Foo::factory($str) returns an object of type Foo_$str?...Read more

Factory Design pattern do-nots?

Whenever I see factory design pattern, it always has a simple new approach. And when creating objects, they have dependencies, but in my case I have an existing projects where I am operating more so in the run-time than at the initialization time (think inside of an existing, intricate code base, as opposed to a simple factory design example). So in order to inject needed dependencies, it is not possible for my implementation of build to just be implemented as return new Blah(new This(), new That()).So what if I want to pass...Read more

Factory pattern:Passing arguments to concrete class

I have two classes coded to a single interface IStore with one method StoreData(data) - one class sends data to a web service that writes to a DB, the other writes data directly to the DB. (factory pattern)public IStore GetStorageClass(StorageType type){ if (type == StorageType.WebService) return new WebService(); else return new DatabaseStore();}Now, the DatabaseStore class needs a connection string to work. The question is, whose responsibility is it to provide the connection string to the DatabaseStore and how? I thought...Read more

D mixin with factory

Consider I have the following classes:/// File classes.dclass C { string type() { return "C"; };}class C1 : C { override string type() { return "C1"; };}class C2 : C { override string type() { return "C1"; };}Now I want to implement a factory somewhere else, like:/// File factory.dmodule factory;import std.functional;import std.stdio;void main() { mixin(import("classes.d")); auto c = cast(typeof(mixin("C1"))) Object.factory("C1"); writeln(c.type());}The compiler (dmd 2.058) says me:factory.d(7): Error argument C1 to typeof is ...Read more