Posts

bookTest.java prints out author arrayList, but not isbn -

requirements: accommodate multiple authors using 1 of components java collection framework. requires 1 book isbn , collection of authors. junit: guidance testvalidate: test @ least 2 cases (one case book properties hold correct data types , not empty nor hold null value, 1 not). guidance testequals: test @ least 2 cases (one case authors , isbn match, 1 not). test @ least 2 authors. teacher told me: testequals need add isbn , 2 authors. create arraylist. add 2 authors it. create book object , add arraylist instance , isbn. think that's have done, authors printing, isbns not. total newbie , @ loss! can help? edit/addition got isbn print, printing second isbn have. need change both of them print? or matter? here output: testsuite: library.domain.booktest equals author list: [bob smith, jane doe] isbn: 67890 validate author list: [bob smith, jane doe] isbn: 67890 tests run: 2, failures: 0, errors: 0, skipped: 0, time elapsed: 0.23 sec ------------- standard output ------...

java - Verification key for jose4j JwtConsumer -

Image
i using jose4j validate , process jwt. jwt looks following , passes validation in jwt homepage. however, can't same using jose4j java library. exception complains verification key set. there many types of keys defined in library , tried them no luck. code following: import java.util.map; import org.jose4j.jwt.jwtclaims; import org.jose4j.jwt.consumer.invalidjwtexception; import org.jose4j.jwt.consumer.jwtconsumer; import org.jose4j.jwt.consumer.jwtconsumerbuilder; import org.jose4j.keys.hmackey; public class ygjwt { public static void main(string args[]) throws invalidjwtexception { string jwt = "eyjhbgcioijiuzi1niisinr5cci6ikpxvcj9.eyjzdwiioiixmjm0nty3odkwiiwibmftzsi6ikpvag4grg9liiwiywrtaw4ionrydwv9.tjva95orm7e2cbab30rmhrhdcefxjoyzgefonfh7hgq"; string secret = "secret"; jwtconsumer jwtconsumer = new jwtconsumerbuilder() .setverificationkey(new hmackey(secret.getbytes())) //what kind of key need use here? ...

node.js - Graphicsmagick for node not writing the jpg -

i using https://github.com/aheckmann/gm resize image. var gm = require('gm').subclass({ imagemagick: true }); var fs = require('fs'); var dir = __dirname+'/img'; var readstream = fs.createreadstream(dir + '/desert.jpg'); var writestream = fs.createwritestream(dir + '/resize.jpg'); gm(readstream) .size({bufferstream: true}, function(err, size) { this.resize(50, 50, '%') this.write(writestream, function (err) { if (!err) console.log('done'); }); }); i using above code resize image....the problem empty image getting generated , error message {[error: write epipe] code:'epipe',errno: 'epipe', syscall:'write'} write method takes string output filename. try stream method: gm(readstream) .size({bufferstream: true}, function(err, size) { this.resize(50, 50, '%') .stream() .o...

javascript - JQuery enter event doesn't trigger form submission -

usually, when press enter on input inside form submit button triggers form submission, when tried same result calling jquery's trigger function doesn't work. idea why? var ev =$.event('keydown',{keycode:13}); $('#myinput').trigger(ev); the event called form doesn't submit. $('#id').on('change',function(){ document.getelementsbyname('formname').submit(); });

How do I control my callbacks in Node.js? -

so i'm working on application written in coffeescript , i'm using sequelize orm application. i'm @ stage i'm integrating passport.js. part i'm having issues getting user out of database when trying authenticate. know issue function returning before sequelize function have written has had chance return can't figure out how control flow properly. here code i've got far: user model exports.getuserbyusername = (username, callback) -> user.findone({ : { username : username }}, (err, user) -> console.log 'hello?' return callback(err) if err return callback(undefined, user) if user ) hello doesn't called that's step 1 of knowing it's returning soon. in verification callback inside passport strategy have this: (username, password, done) -> chatmodel.getuserbyusername username, (err, user) -> console.log 2 return done err if err return done null, false, message: 'inco...

mysql - Add nonexistent ID to database -

i have database starts @ id = 1000. want add entry @ id = 1. using mysql. done once, , not care rest of 2 - 999 values. concerned adding @ id = 1, id not exist cannot update it. you can insert , define id rather allowing auto_increment normal job. insert table (id, another_column, ... ) values (1, 'some value', ... );

angularjs - Getting the current month by default in a dropdownlist -

i working in project user on first visit can see content of current month default. if want see contents of month need select month , year dropdown list. <div class="row" ng-show="firstvisit"> <div class="col"> <select ng-init="item1=m+1" ng-model="item1" ng-change="onchangemonth()" style="width:100%;text-align:center;"> <option style="text-indent:30%" ng-repeat="item1 in ideamonthlist" value="{{item1}}" >{{item1}}</option> </select> </div> </div> <div class="row" ng-hide="firstvisit"> <div class="col"> <select ng-model="item1" ng-change="onchangemonth()" style="width:100%;text-align:center;"> <option style="text-indent:30%" ng-repeat=...