Posts

vbscript - Compressed (zip) Cannot create output file - error -

vbscript - Compressed (zip) Cannot create output file - error - i using vbscript scan folders, create zip files , add together files them (compress), run script on folders lot of files, next error: "compressed (zip) cannot create output file" my zip handling code follows: dim objfso set objfso= createobject("scripting.filesystemobject" function preformzip(objfile,target,zip_name, number_of_file) set shell = createobject("wscript.shell") zip_target = target + "\" + zip_name +".zip" if not objfso.fileexists(zip_target) makepathifnotexist(target) newzip(zip_target) else if number_of_file=0 objfso.deletefile(zip_target) newzip(zip_target) end if end if set zipapp = createobject("shell.application") asourcename = split(objfile, "\") ssourcename = (asourcename(ubound(asourcename))) zip_file_count = zipapp.namespace(zip_target).items.count zipapp.namespa...

laravel - Querying Relations -

laravel - Querying Relations - i got these tables: table: investigation id name start_city end_city table: city id name start_city , end_city in table investigation refers city.id . this investigation model: public function start_city(){ homecoming $this->hasone('city', 'id', 'start_city'); } public function end_city(){ homecoming $this->hasone('city', 'id', 'end_city'); } city model: public function start_city(){ homecoming $this->belongsto('investigation', 'id', 'start_city'); } public function end_city(){ homecoming $this->belongsto('investigation', 'id', 'end_city'); } investigation controller: public function show($id){ echo '<pre>'; var_dump(investigation::find($id)->start_city->name); } i trying property of non-object . suspect relationship somehow 'broken'. how prepare this? t...

c# - Get all inherited classes of a generic abstract class -

c# - Get all inherited classes of a generic abstract class - i'm looking way classes inherit generic abstract class, , perform method on each of classes. i've been next change parameter type when implementing abstract method have class implementations want, similar this: class="lang-cs prettyprint-override"> public abstract class abstractrequest<tresponsedata> tresponsedata : iresponsedata { public abstract void search(); public abstract gooddata binddata(tresponsedata data); } public interface iresponsedata { } public class aresponse : iresponsedata { } public class bresponse : iresponsedata { } public class : abstractrequest<aresponse> { public override void search() { // aresponse // phone call binddata() aresponse } public override gooddata binddata(aresponse data) { // bind info aresponse gooddata } } public class b : abstractrequest<bresponse> { p...

With django-rest-framework how do I assign a field to the request user when using a ModelViewSet? -

With django-rest-framework how do I assign a field to the request user when using a ModelViewSet? - the documentation recommends apiviews: def pre_save(self, obj): obj.owner = self.request.user this doesn't seem work back: class="lang-js prettyprint-override"> { "owner": [ "this field cannot null." ] } edit: pre_save method never gets called. checked inserting phone call pdb in pre_save method. my serializer plain hyperlinkedmodelserializer model , list of fields specified in meta. on model had overridden clean_fields . signature clean_fields : model.clean_fields(exclude=none) my custom clean_fields : def clean_fields(self, exclude=none): super(applicant, self).clean_fields() # bug here. # custom clean_fields code i didn't pass exclude parameter super class! oh god took me many hours debug. django django-rest-framework

Append byte array to pdf file c# asp.net using FileStream -

Append byte array to pdf file c# asp.net using FileStream - i working in asp.net web application. trying append byte array pdf file using filestream , want result pdf file containing byte arrays. getting lastly byte array saved in pdf. don't want utilize external library. here code appending bytes : public void appendbytetofile(byte[] renderedbytes) { string path = server.mappath("~/printimages/file1.pdf"); var stream = new filestream(path, filemode.append); stream.seek(0, seekorigin.end); if (stream.length==stream.position) { stream.write(renderedbytes, 0, renderedbytes.length); stream.close(); } } where renderebytes rdlc object of local study rendered pdf follows byte[] renderedbytes = report.render("pdf", deviceinfo); thank you c# asp.net pdf byte filestream

syntax error - mySQL corruption "Cannot add foreign key constraint" trying to CREATE table -

syntax error - mySQL corruption "Cannot add foreign key constraint" trying to CREATE table - edit corrupt mysql db problem. pls see "edit:" below trying add together table called client new mysql db: create table `client` ( `id` int not null auto_increment, `person_id` int not null default '0', primary key (`id`) ) collate='latin1_swedish_ci' engine=innodb; every time get: #1215 - cannot add together foreign key constraint . i have looked @ reserved word lists can find. none of them seem have "client". i can utilize "clients" (but not having table plurals -0 others singular), "clientxxx" etc. want utilize "client". there way round this? of import clients not patients. ps have deleted other tables db still not fly. pps although not listed client is ****** reserved word in sql in reality (or @ to the lowest degree heidisql lists it. there way around it? (i th...

javascript - Using function parameter value as dictionary key -

javascript - Using function parameter value as dictionary key - attempting build dictionary using key comes via function parameter. var progres_mark = function(progress_state) { var = date(); console.log({ progress_state : }) } progres_mark("encode") expected { 'encode': 'sun oct 19 2014 18:22:33 gmt+0300 (idt)' } actual { progress_state: 'sun oct 19 2014 18:22:33 gmt+0300 (idt)' } what’s going on? because compiler expects identifier or string , hence not evaluate variable's value. can utilize bracket notation accomplish want. var progres_mark = function(progress_state) { var = date(); var obj = {}; obj[progress_state] = now; console.log(obj) } javascript node.js dictionary