Posts

office365api - Profile details in outlook rest api -

starting here: https://dev.outlook.com/restapi/tutorial/php scopes: private static $scopes = array("openid" ,"profile" ,"offline_access" ,"https://outlook.office.com/calendars.read" ,"https://outlook.office.com/contacts.read" ); when authenticate in id_token basic info profile. with: https://outlook.office.com/api/v2.0/me/contacts i nice details contacts, phone numbers i'm specially interested in case. is possible same level of details current user profile 1 of contacts when accessed through api? how using microsoft graph api: get https://graph.microsoft.com/v1.0/me the response should following: http/1.1 200 ok content-type: application/json content-length: 491 { "businessphones": [ "businessphones-value" ], "displayname": "displayname-value", "givenname": "givenname-value", "jobtitle": "jobtit...

node.js - trouble with configuring client using node-xmpp-client -

i'm trying create xmpp http gateway in nodejs using node-xmpp-client , adastra.re xmpp server. i've never worked xmpp before , i'm having trouble configuring client. var client = new xmpp.client({ jid: ???, password: '***', host: " https://adastra.re/ " bosh: ???? }) what jid , bosh? thought jid email of client want log in , password password email. appears not case. , i've been having trouble understanding bosh too. appreciated. xmpp server not understand http protocol. bosh work mediator between your http request , xmpp server. jid user id registered in xmpp server. example xmpp server adastre.re , mahesh@adastre.re. i hope helps.

node.js - login using passport always get error 400 bad request -

hi i'm using express implements passport, don't knows when i'm hit login url error 400 bad request. code : main.js : var express = require('express'); var app = express(); require('./config/passport'); require('./config/static')(app, express); require('./config/routes')(app); require('./config/seed')(); app.listen(3000, function () { console.log('example app listening on port 3000!'); }); passport.js : var passport = require('passport'); var user = require('../api/model/user.model'); var localstrategy = require('passport-local').strategy; passport.use(new localstrategy({ usernamefield: 'email', passwordfield: 'password' }, function(username, password, done) { user.findone({ username: username }, function (err, user) { if (err) { return done(err); } if (!user) { return done(null, false); } if (!user.verifypassword(password)) { return done...

.htaccess - Enable CORS in Wordpress to use JSON -

i'm trying enable cors in wordpress. found lot of documentation. nothing works me. same error. xmlhttprequest cannot load 'access-control-allow-origin' header contains invalid value ''. origin 'file://' therefore not allowed access. try put code in .htaccess , in header.php file in wordpress. test url in http://client.cors-api.appspot.com/ , get. fired xhr event: loadstart fired xhr event: readystatechange fired xhr event: progress fired xhr event: error xhr status: 0 xhr status text: fired xhr event: loadend i'm lost, try everithing nothing works.

jquery - HTML/JavaScript - Populate radio button if checkbox is checked -

i'm trying write javascript code if of checkboxes in group selected, radio button should populated. following code i'm working on: <html> <head> <title>radio buttons , checkboxes</title> </head> <body> <form> <h3>radio buttons</h3> <input type="radio" name="radio1" id="radio1"> radio 1 <br> <input type="radio" name="radio2" id="radio2">radio 2 <br> <br> <h3>checkbox groups</h3> <h4><u>group 1</u></h4> <p align="center"><u>pd</u></p> <ul> <li><input type="checkbox" name="g1pd1">g1 pd1</li> <li><input type="checkbox" name="g1pd2">g1 pd2</li> </ul> ...

gwt - Calling Java Method from within JSNI method -

i trying call java method within jsni method. not getting type of error window.alert() never gets called. package com.mywebsite.myapp.client; public class myapp implements entrypoint(){ /// other stuff.... public native void gettoserver(string trainername)/*-{ $wnd.$.get( "http://testdastuff.dev/trainerstats", { trainer: trainername} ) .fail(function() { $wnd.console.log("error"); }) .done(function( data ) { if(data == "nodata"){ alert("no data"); this.@com.mywebsite.myapp.client.myapp::testjsni()(); } }); }-*/; public void testjsni(){ window.alert("working"); } } it alerting "no data" know wrong way calling method. cant static method. inside of done callback have lost this (it point else now). you need preserve via bind or local variable ( var self = this ).

phpunit - Unit testing of a class reading a configuration file -

i have class "configuration" has method "getconfig" reads configuration file "config.ini" have app configs (database credentials , host, apis keys, .....) for have unit test tests if database entry exists in config file , @ same time confirms array returned method "getconfig" has key "database": function testconfigfilehasdatabaseentry() { $configuration = configuration::getinstance(); $arrconfig = $configuration->getconfig(); $this->assertarrayhaskey('database', $arrconfig); } i have unit test confirms "getconfig" returns variable of type array. my question following: in terms of unit testing best practices, in case test enough confirm function getconfig tested or better confirm every key exists in config file. think confirming entries in config file maybe falls under category of testing, want sure. let me know best practice in case. base on answer of gcontrollez realized better post c...