Posts

php - Is it possible to inject a method into a service in symfony services.yml -

there plenty of documentation on internet injecting service service this: http://symfony.com/doc/current/components/dependency_injection/introduction.html however, have service called objectcache configured in symfony's services.yml this: object_cache: class: app\bundle\apibundle\service\objectcache this service has 2 methods getting , setting user object. example: $user = new user(); // assume entity database $this->get('object_cache')->setuser($user); // ... $this->get('object_cache')->getuser(); // instance of $user i want create new service depends on user, makes sense inject user @ service creation: class someservice { public function __construct(user $user) { } } how configure services.yml such user injected new service? object_cache: class: app\bundle\apibundle\service\objectcache some_service: class: app\bundle\apibundle\service\someservice arguments: [@object_cache->getuser()????] this didn't wor...

Too few arguments inheritance c++ -

i'm working on learning inheritance making generic list class. list can unordered list, ordered list, stack , or queue . my list class looks this: class list { public: class node { public: int data; node * next; node(int data); }; int sizeoflist = 0; node * head = nullptr; list::list(); virtual void get(int pos); virtual void insert(int data); virtual void remove(int pos); virtual void list(); virtual int size(); }; my unordered list class looks this: class unorderedlist : public list { public: unorderedlist(); void get(); void insert(int data); virtual void remove(); //takes no parameters because first item removed }; in main() , create array of lists this; list * lists[8]; and make unordered list this: lists[0] = new unorderedlist(); my question: lists[listnum]->get(); gives error "too few arguments in function call" because thinks trying c...

c - Difference between a struct and a pointer to a struct -

i trying understand difference between struct , struct pointer. following code example. code example : #include<stdio.h> typedef struct{ const char *description; float value; } swag; typedef struct{ swag *swag; } combination; as can see there 2 structs here swag, combination. struct combination has pointer struct swag. why can't this: typedef struct{ swag swag; } combination; why have swag *swag . can please explain me difference between 2 code examples? both possible, how appear in memory: case 1 +----+-----+----------+ +->| p | value | struct swag | +----------+----------+ | const char* float | | +----------+ +--+ swag | struct combination +----------+ swag* case 2 +-----------------------+ |+----+-----+----------+| || p | value || struct combination |+----------+----------+| +-----------------------+ the...

What's the difference between "deletemany" and "remove" in mongodb? -

what's difference between 2 commands here? db.collection.deletemany({condition}) db.collection.remove({condition}) as far can say, db.collection.deletemany returns: document containing: > boolean acknowledged true if operation ran write concern or false if write concern disabled > deletedcount containing number of deleted documents ref: db.collection.deleteall where as db.collection.remove return writeresult and remove single document, there similar command, db.collection.removeone db.collection.remove need set , option called justone option limit delete 1 document. otherwise guess similar. node.js drivers when talking node.js drivers , remove has been deprecated (and may removed in future releases) , deleteone or deletemany . hope makes sense ....

character encoding - karaf configuration property is garbled -

i implement org.osgi.service.cm.managedservice interface karaf configuration. when give chinese value property, garbled.initially, files in etc folder encoded in latin1. have tried set utf-8 encoding, has no effect. can me? in karaf, configurations files (ie etc/*.cfg ) handled felix subproject "fileinstall". fileinstall doesn't support yet specified custom character encoding configuration, uses properties class , properties.load(inputstream) , documents: the load(reader) / store(writer, string) methods load , store properties , character based stream in simple line-oriented format specified below. load(inputstream) / store(outputstream, string) methods work same way load(reader)/store(writer, string) pair, except input/output stream encoded in iso 8859-1 character encoding . characters cannot directly represented in encoding can written using unicode escapes defined in section 3.3 of java™ language specification; single 'u' ch...

SQL Server, Having Clause, Where, Aggregate Functions -

in problem trying solve, there performance values table: staff performanceid date percentage -------------------------------------------------- staffname1 1 2/15/2016 95 staffname1 2 2/15/2016 95 staffname1 1 2/22/2016 100 ... staffname2 1 2/15/2016 100 staffname2 2 2/15/2016 100 staffname2 1 2/22/2016 100 and sql statement follows: select top (10) tbl_staff.staffname, round(avg(tbl_staffperformancesvalues.percentage), 0) averagerating tbl_staff inner join tbl_academictermsstaff on tbl_staff.staffid = tbl_academictermsstaff.staffid inner join tbl_staffperformancesvalues on tbl_academictermsstaff.staffid = tbl_staffperformancesvalues.staffid (tbl_staffperformancesvalues.date >= @datefrom) , (tbl_academictermsstaff.schoolcode = @schoolcode) , (tbl_academictermsstaff.academictermid = @academictermid) gro...

icloud - iOS app with cloud based service -

Image
i'm trying create, update, insert records icloud along app's id. did created record type in icloud dashboard , working when device contains icloud account has been logged in. how use icloud service devices using app ? saw api access , how implement token based access ? please me problem. here screenshot of showing permissions box. you can see here can grant read access anonymous users if wish, although unwise if plan release app on apps store obvious reasons hope.