Posts

java - Copy objects into arraylist instead of pointing -

i trying create arraylist of nodes used come 1 place(node) another. nick name of place , node's pi previous node in path. arraylist<node> bestway = new arraylist<node>(); while(chosen.nick != from){ bestway.add(chosen); chosen = chosen.pi; } the problem elements in bestway becomes same. when print bestway place1, place1, place1, place1 , , not place1, place2, place3, place4 . is possible copy elements array, , not add pointers chosen-element changes on line after. lot! here example trying mimic explained. works me hence, error should somewhere else guess: public class example { public static void main(string[] args) { list<node> bestway = new arraylist<node>(); node chosen = new node("place1"); string = chosen .add("place2") .add("place3") .add("place4") .add("place5") ....

java - Spring security between web apps- NOT SSO -

i'm using spring security 3.1.4 , have following question: have 2 web apps 1 "admin" , other "users". admin calls other using controllers. communication use spring security, thought of option create special "login" controller in user app admin , create special "admin user" authentication information (login name, password , role..) , every time want communicate admin app use controller. valid , common solution?

Protractor + AngularJS + Jasmine get output results on xml file -

i'm trying export protractor results xml files, found great link on web: https://github.com/angular/protractor/issues/60 after running : npm install jasmine-reporters i added following lines protracotr config file: require('jasmine-reporters'); jasmine.getenv().addreporter(new jasmine.junitxmlreporter( 'c:\temp\test', true, true)); and following error: jasmine.console_reporter.js:2 if (! jasmine) { ^ referenceerror: jasmine not defined i attached here config file, please advise doing wrong, , how can fix this: require('jasmine-reporters'); jasmine.getenv().addreporter(new jasmine.junitxmlreporter( 'c:\temp\test', true, true)); // example configuration file. exports.config = { seleniumaddress: 'http://localhost:4444/wd/hub', chromeonly: true, capabilities: { 'browsername': 'chrome' }, specs: ['../test/protractor/publisher_list_e2e.js...

jQuery on binding when loading partial -

i'm loading partial shown here: <div id="catering-dialog" title="catering new booking"> <div id="itemstable"> @{html.renderaction("addcateringitem", new { model.booking.bookingid });} </div> </div> and have jquery .on() $('a.editrow').on("click", function () { alert("clicked"); }); basically, partial table , each row has cell "edit" in , when clicked should display alert "clicked" nothing @ happens. any ideas? to update: <div id="cateringtable"> <table border="2" bgcolor="#ffffff" id="cateringlisttable"> <thead> <tr> <th>time:</th> <th>description:</th> <th>quantity:</th> <th>cost £:</th> </tr> </thead> <tbody> @foreach (var item in model) { html....

ruby - Using constraints in Rails to change the default root_path for some users -

i looking way change default routing (root_path specifically) of app using other simple if/then check different types of users. found this code example online, can't make work app , main problem don't understand underlying code does, therefore cannot adapt code app. first create rule in router: root 'admin#index', constraints: roleconstraint.new(:admin) then create new file called role_constrait.rb in lib directory , user code: class roleconstraint def initialize(*roles) @roles = roles end def matches?(request) @roles.include? request.env['warden'].user.try(:role) end end i see guy using warden here, using cancan, , since piece of code makes no sense me, can't make changes it, have tried, keep getting undefined local variable or method `root_path' error. would highly appreciate help! i don't think router should in charge of doing that. it's hard implement , hard test. more than, it's extremely inco...

uniqueness with nested_form_for rails is not working -

i have models vehicle, tag, vehicletag class vehicletag < activerecord::base attr_accessible :vehicle_id, :tag_id, :capacity belongs_to :vehicle belongs_to :tag validates_uniqueness_of :tag_id, :scope => [:vehicle_id] end and have used 'nested_form_for' enter value in vehicle_tags tables validates_uniqueness_of not working when user select same tags multiple times , saving data in tables. but when have single record in vehicle_tag tag_id=2, vehicle_id=24 , when user select same tag again time thronging uniqueness validation. getting first time don't have value in db , second time have. but want through uniqueness when user select multiple same tag. edit: vehicle_tag table structure: +-----+------------+--------+----------+---------------------+---------------------+ | id | vehicle_id | tag_id | capacity | created_at | updated_at | +-----+------------+--------+----------+---------------------+---------------------+ | 241 |...

validate and expire the link using gwt - java -

my requirement sent mail concerned users when record created. mail contains link our system lets user interacting system without login. link expires after time. mailing done using javax.mail . how can expire link? i generate key/id add link , store database. filters (web.xml) can check if url (id) still valid , pass on desired page. if provide more details, can give more detailed answer.