Posts

google chrome extension - Using REST to Invoke JSON Custom Search API -

i'm attempting json data google custom search api using javascript, have been unsuccessful @ retrieving data. this chrome extension. i've read using rest article multiple times, have still been having problems. all right results, , show json result in .html file. help/insight. popup.js file function getcurrenttaburl(callback) { var queryinfo = { active: true, currentwindow: true }; chrome.tabs.query(queryinfo, function(tabs) { var tab = tabs[0]; var url = tab.url; console.assert(typeof url == 'string', 'tab.url should string'); callback(url); }); // methods of chrome extension apis asynchronous. means // cannot this: // // var url; // chrome.tabs.query(queryinfo, function(tabs) { // url = tabs[0].url; // }); // alert(url); // shows "undefined", because chrome.tabs.query async. } function getsearchurl(searchterm, callback, errorcallback) { var mgoogleapikey = "myapikey";...

What is the expected behavior of posting a form with an expired auth token in asp.net mvc with openid connect via azure ad? -

i have asp.net mvc 5 web application uses openid connect via azure ad manage user authentication. think understand once authenticated, auth token valid 1 hour @ point owin middleware handle refreshing auth token in background without user having redirected login page , re-enter username/password. have observed watching address change in address bar of browser after auth token expires. my problem have form users stay on long time (60+ minutes) while doing interviews , entering in data. auth token expires , when user tries submit form auth token refresh happens in background , form never posted application. instead, view refreshed (from http happens after auth token refreshed) , user loses of data they've collected on last hour. is expected behavior or have configured incorrectly?

Container Managed Security, Spring Security and Authentication -

i have been looking everywhere on how can implement spring security based on container managed security model. in test case, using tomcat , it's corresponding tomcat-users.xml file. issue is, cannot spring security play (meaning pass authentication on tomcat) let app server perform authentication , have spring manage role based security once authenticated. using latest spring versions, it's java config not familiar enough xml based config. have read many examples talk using preauthenticatedauthenticationprovider examples poor not mention spring documentation quite confusing imho. downloaded sample preauth code spring security git hub still cannot see how example code tied authentication tomcat performing. when run spring sample code preauth, doesn't authenticate of users in tomcat-users xml file deployed code tomcat 8. wondering if has ideas on can in order understand how spring security , authentication performed tomcat (container managed) happens? update: appe...

Getting undefined setting object's property value using this in javascript -

i trying set fullname property of object person using this , got undefined when logging out full name. var person = { name:'yask', fullname: this.name + ' srivastava' } console.log(person.fullname); this strange, using this while using inside function refers object. here looks it's being referred global object.(window maybe..?) you can use of getter , var person = { name:'yask', fullname(){ return this.name + ' srivastava' } } console.log(person.fullname); basically this in case point context of lexical scope function of object, not object itself.

regex - Breaking up PascalCase in R -

i have series of character strings using pascalcase. "bobdylan" "mikhailgorbachev" "helpfulstackoverflowpeople" i want function in r put spaces between each word. have achieved perl regular expression , gsub( ) function. essentially, putting space before every capital letter not first letter of string. gsub("(?!^)(?=[a-z])", " ","bobdylan",perl=true) [1] "bob dylan" however, of words in list may have capitalized abbreviations in them not want have separated spaces. "bobdylanusa" "mikhailgorbachevussr" "helpfulstackoverflowpeople" applying same syntax before create spaces between every capital letter. gsub("(?!^)(?=[a-z])", " ","mikhailgorbachevussr",perl=true) [1] "mikhail gorbachev u s s r" however, abbreviations stay same. desired output following. [1] "bob dylan usa" [1] "mikhail gorbachev ussr" [1] ...

asp.net core mvc - The required column was not present in the results of a 'FromSql' operation -

i've starting learning mvc6 ef7. have stored proc i'd return portion of fields in model. if don't return every field in model, i'm getting "the required column 'firstname' not present in results of 'fromsql' operation". is there way make columns not required can return portion of fields in model? model: public class loginviewmodel { [key] public int userid { get; set; } [required] [display(name = "username")] public string username { get; set; } [required] [datatype(datatype.password)] [display(name = "password")] public string password { get; set; } [required] [datatype(datatype.password)] [display(name = "protected id")] public string protectedid { get; set; } public string firstname { get; set; } public string lastname { get; set; } } my proc testing: create procedure [dbo].[aaa_topxxuserstest] @numtoreturn int = 10 begin set noc...

multithreading - How to execute multiple django celery tasks with a single worker? -

here celery file: from __future__ import absolute_import import os celery import celery # set default django settings module 'celery' program. os.environ.setdefault('django_settings_module', 'ets.settings') django.conf import settings # noqa app = celery('proj', broker='redis://myredishost:6379/0', backend='redis://myredishost:6379/0', include=['tracking.tasks']) # optional configuration, see application user guide. app.conf.update( celery_task_result_expires=3600, ) if __name__ == '__main__': app.start() here task file: @app.task def escalate_to_sup(id, group): escalation_email, created = escalationemail.objects.get_or_create() escalation_email.send() return 'sup email sent to: '+str(group) @app.task def escalate_to_fm(id, group): escalation_email, created = escalationemail.objects.get_or_create() escalation_email.send() r...