Posts

node.js - Multiple authentication controllers on one route -

i trying add 2 authentication controllers 1 route. example, trying make: router.route('/employees') .get(authcontroller1.isauthenticated, mycontroller1.get1) .get(authcontroller2.isauthenticated, mycontroller2.get2); the isauthenticated function follows: exports.isauthenticated = passport.authenticate('basic', { session: false }); does know how possible? thanks, daniel route: router.route('/employees') .get(authcontroller.isauthenticated1, authcontroller.isauthenticated2, mycontroller1.get1) authcontroller : exports.isauthenticated = function(req, res, next) { // authentication code if (!req.isauthenticated) { // not authenticated return res.status(401).send({ message: 'user not authenticated' }); } next(); }; exports.isauthenticated2 = function(req, res, next) { // authentication2 code if (!req.isauthenticated2) { // not authenticated ...

Does R optimise the order of matrix multiplications? -

if multiplying 3 matrices together, abc. depending on size of matrices may more efficient perform either (ab)c or a(bc). if evaluate: a %*% b %*% c will optimised in anyway? thanks colonel beauvel setting me on right path - test it. using example wikipedia , scaling suitably: > mult <- 100 > ar <- 10 * mult > ac <- 30 * mult > br <- 30 * mult > bc <- 5 * mult > cr <- 5 * mult > cc <- 60 * mult > > <- matrix(rnorm(ar * ac), ar, ac) > b <- matrix(rnorm(br * bc), br, bc) > c <- matrix(rnorm(cr * cc), cr, cc) > > system.time({ (a %*% b) %*% c }) user system elapsed 3.01 0.00 3.01 > system.time({ %*% (b %*% c) }) user system elapsed 25.34 0.03 25.37 > system.time({ %*% b %*% c }) user system elapsed 2.98 0.00 2.98 > system.time({ t(c) %*% t(b) %*% t(a) }) user system elapsed 25.61 0.03 25.64 incidently - r evaluates left righ...

java - how to show autocomplete in gwt in tabular format with multiple column? -

following code shows 1 column in autocomplete want shows data in tabular foramte multiple column[in short want show suggestion box in tabular formate]. how can that? in advance please suggest anything.. flowpanel panel = new flowpanel(); initwidget(panel); final bulletlist list = new bulletlist(); list.setstylename("token-input-list-facebook"); final listitem item = new listitem(); item.setstylename("token-input-input-token-facebook"); final textbox itembox = new textbox(); itembox.getelement().setattribute( "style", "outline-color: -moz-use-text-color; outline-style: none; outline-width: medium;"); final suggestbox box = new suggestbox(getsuggestions(), itembox); box.getelement().setid("suggestion_box"); item.add(box); list.add(item);

python - takes exactly 1 positional argument (0 given) -

i'm trying make every time click button can run different. counter = 0 def b_c(counter): counter = counter + 1 if counter == 1: print("1") elif counter == 2: print("2") else: if counter == 3: print("3") but get typeerror: b_c() takes 1 positional argument (0 given) try this: counter = 0 def b_c(): global counter counter += 1 if counter == 1: print("1") elif counter == 2: print("2") else: if counter == 3: print("3") b_c() b_c() b_c() output: 1 2 3 first thing: python case sensitive, counter not equal counter. , in function can use global counter don't need pass counter button click.

javascript - Catching the response of the iFrame once receiving the response -

i posting message iframe. iframe returns response boolean. need catch response when response arrives parent window iframe. code not working. idea onthis? iframe <iframe id="opiframe" src="https://localhost:9443/oauth2/session" > </iframe> i'm sending message iframe periodically var iframe = document.getelementbyid("opiframe"); setinterval(function(){ message ='test' ; console.log('request rp: ' + message); iframe.contentwindow.postmessage(message,"https://localhost:9443/oauth2/session"); },6000); what need receive response of iframe periodically. code working. added eventlistener iframe below. iframe.addeventlistener("message",test,false); function test(event){ alert("test"); } but not firing periodically it simple: added listener on iframe (as element of parent window's dom), instead of on iframe's window...

unable to take screenshot of mouseover in selenium -

Image
i trying take screenshot of sub menu happens on hovering in selenium using takesscreenshot . not working. screenshot taken sub menu not present in image. have tried using implicit wait after hover, nothing worked. please suggest method capture screenshot of sub menu. contactus.hoverhm(); screenshot = ((takesscreenshot) pagefactorybase.getsharedwebdriver()).getscreenshotas(outputtype.bytes); scenario.embed(screenshot, "image/png"); this did trick me. pretty sure work you. _driver = new firefoxdriver(); _driver.navigate().gotourl("http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_event_mouseover_mouseout"); _driver.switchto().frame(_driver.findelement(by.id("iframeresult"))); actions builder = new actions(_driver); builder.movetoelement(_driver.findelement(by.tagname("p"))).build().perform(); var screenshot = ((itakesscreenshot)_driver).getscreenshot...

xaml - Show one of multiple items on the page (tab-like interface) -

i want have tab-like interface have multiple buttons (tabs) , when user press 1 of button show corresponding container , hide other ones. something like: <!-- buttons --> <stackpanel verticalalignment="stretch" grid.column="0"> <button style="{staticresource detailsectionbutton}" content="info" click="button_click"/> <button style="{staticresource detailsectionbutton}" content="map" click="button_click2"/> <button style="{staticresource detailsectionbutton}" content="attachment" click="button_click3"/> </stackpanel> <!-- info --> <scrollviewer x:name="secinfo" grid.column="1" visibility="collapsed" ... <!-- map --> <map:mapcontrol zoomlevel="6" x:name="secmap" gri...