Posts

symfony - codeception symfony2 unit test throws a fatal error -

using classical phpunit style generate:test symfony2 helper. can service , can assert ok. // tests public function testgetserviceurl() { $ecservice = $this->getmodule('symfony2')->grabservicefromcontainer("ecservice"); $this->assertequals("https://ecoconnect2.niwa.co.nz/services", $ecservice->getserviceurl()); $this->assertequals("xxx", $ecservice->getserviceurl()); } however in second case assertion fails exception: trying test service url (demotest::testgetserviceurl) - failed php fatal error: call member function getresponse() on non-object in /users/watkinsav/workspace/cd/ecoconnect_web/vendor/codeception/codeception/src/codeception/util/framework.php on line 30 php stack trace: php 1. {main}() /users/watkinsav/workspace/cd/ecoconnect_web/vendor/codeception/codeception/codecept:0 php 2. symfony\component\console\application->run() /users/watkinsav/workspace/cd/ecoco...

linux - can not restore table which was dropped using mongorestore -

i test mongorestore utility the following test procedure: mongo 127.0.0.1/mytest -u alex -p alex > db.createcollection("test1") { "ok" : 1 } > db.test1.insert({id:1,name:"alex"}) > db.test1.find() { "_id" : objectid("519b3d7808b450e533c8ea5e"), "id" : 1, "name" : "alex" } > show collections; system.indexes system.users test1 testtable > exit ps -ef|grep mongod root 3201 3180 0 16:46 pts/1 00:00:00 vi /etc/mongod.conf root 3583 1 0 17:27 ? 00:00:00 /opt/mongodb/bin/mongod -f /etc/mongod.conf root 3600 3267 0 17:28 pts/3 00:00:00 grep mongod kill -9 3583 do file backup using mongodump /opt/mongodb/bin/mongodump --dbpath /data/db/ --journal --out /data/dump tue may 21 17:26:38.107 [tools] journal dir=/data/db/journal tue may 21 17:26:38.107 [tools] recover begin tue may 21 17:26:38.107 [tools] recover lsn: 33813 tue may 21 17:26:38.107 [tools] r...

ruby on rails - Using a form and a button to call a method in view -

beginner rails question here. created web scraper populate model information , wanted call method button view. more importantly, wanted pass contents of form parameter method. i'm kinda lost on how using forms, far have: i placed method directory app/helpers/admin_pages_helper.rb module adminpageshelper def populate(term) . . end end i have view located @ app/views/admin_pages/index.html.erb i'm unsure of how go using form_tag/text_field_tag/submit_tag parameter; of examples i've seen involve database queries using forms instead. thanks the simplest form of usage - firstly need route form can submit to: # in routes.rb match "/admin_pages/my_action" => "admin_pages#my_action", as: "my_admin_pages_action" this route request "/admin_pages/my_action" "my_action" action in adminpagescontroller. gives several helper methods can use build url string in views and/or controllers. # in view <%...

MySQL - How to select Multiple rows from Multiple tables -

i have question sql statement, reason script not working properly.. scenario; have 6 tables patient -patientid -patientname -employerid fk employer.employerid. employer -employerid -employername carrier -carrierid -carriername appointment -appointmentid -aptdatetime -patientid fk patient.patientid insuranceplan -planid -groupname -employerid fk employer.employerid -carrierid fk carrier.carrierid inssub -insubid -dateeffective -planid fk insplan.planid -suscriber fk patient.patientid my script: need rows 5 tables,, not sql indexes validation, that's why script not working ! select p.patientname, e.employername, c.carriername, ip.groupname, a.aptdatetime, i.dateeffective patient p, employer e, inssub i, insuranceplan ip, carrier c, appointment e.employernum = p.employernum , i.subscriber = p.patientid , i.planid = ip.planid , ip.carrierid = c.carrierid , ip.employerid = e.employerid , ip.planid = i.planid , a.patientid = p.pat...

javascript - Ajax progress bar with a big list -

i have ajax call grabbing large json list. there way can make progress bar gets real value of json load (for example status bar says 1 out of 200 loaded)? right have pretty basic ajax call function sendajax(urlmethod, jsondata, returnfunction) { $.ajax({ type: "get", contenttype: "application/json; charset=utf-8", url: urlmethod, data: jsondata, datatype: "json", success: function (msg) { if (msg != null) { returnjson(msg); } }, error: function (xhr, status, error) { // boil asp.net ajax error down json. var err = eval("(" + xhr.responsetext + ")"); // display specific error raised server alert(err.message); } }); } try using ajaxstart on application global scope. means can put code in layout file, , if processing long, show progress indicator... $(...

java - Got Findbugs issue “NP_NULL_ON_SOME_PATH” when null test is in a separate method. Is this a false alarm? -

i have code similar following snippet: public void foo(order o) { ... checkinput(o, "some error message"); dosomehing(o.getid()); } private void checkinput(object o, string message) { if (o == null) { throw new someruntimeexception(message); } } and got findbugs reporting 'np_null_on_some_path' issue. here description: there branch of statement that, if executed, guarantees null value dereferenced, generate nullpointerexception when code executed. of course, problem might branch or statement infeasible , null pointer exception can't ever executed; deciding beyond ability of findbugs. my questions are: can treat false positive in example? is practice put null test in separate method? actual null check method bit longer sample method don't want repeat code everywhere. thanks! it looks findbugs not able detect case, @ least 2.0.2 in eclipse. 1 workaround return value checkerror , annotate method @nonnull...

c# - AES CBC Not Producing Correct Vectors -

i have 2 methods encryption , decryption in cbc mode. have ready verified ecb methods , function properly. issue when test encryption in cbc test vectors passes them. , when test cbc decryption same vectors make sure can go other way, passes tests well. when pass encryption decryption, don't same vector back. doesn't make sense me. public byte[,] encrypt(byte[,] datatoencrypt, byte[] givenkey, byte[] initializationvector) { //xor data iv (int row = 0; row < 4; row++) { datatoencrypt[row,0] ^= initializationvector[4*row]; datatoencrypt[row, 1] ^= initializationvector[(4 * row) + 1]; datatoencrypt[row, 2] ^= initializationvector[(4 * row) + 2]; datatoencrypt[row, 3] ^= initializationvector[(4 * row) + 3]; } ecb encryptor = new ecb(); return encryptor.encrypt(datatoencrypt, givenkey); } public byte[,] decrypt(byte[,] datatodecrypt, byte[] givenkey, byte[] initiali...