Posts

Showing posts from April, 2015

Using extra_data from python-social-auth in Django template -

i using python-social-auth log in own web application linkedin. logged in , redirect home page. next step utilize data (i.e. usersocialauth.extra_data). give example how access data in either django templates or django views? this settings had. social_auth_login_url = '' social_auth_pipeline = ( 'social.pipeline.social_auth.social_details', 'social.pipeline.social_auth.social_uid', 'social.pipeline.social_auth.auth_allowed', 'social.pipeline.social_auth.social_user', 'social.pipeline.user.get_username', 'social.pipeline.user.create_user', 'social.pipeline.social_auth.associate_user', 'social.pipeline.social_auth.load_extra_data', 'social.pipeline.user.user_details' ) social_auth_linkedin_oauth2_scope = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share'] social_auth_linkedin_oauth2_field_selectors = ['first-name', 'last-name', 'ema...

Need information about AEM 6 Lead Developer Certification -

can provide details around topic need covered part of aem lead developer certification check out aem_6_lead_developer_eg

ios - NSWidgetExtensionContext openURL Swift -

Image
i have been attempting implement button open ios app widget. realize issue has been beaten death on forums cannot find explanation specific error receiving. perhaps of more experienced ios developers can shed light on this. i developing update 1 of ios apps ios 10 using xcode 8.1 , swift 2. code widget's button: url scheme added widget's info.plist: the runtime error receive when pressing openapp button: appwidget[11872:3577323] __55-[_ncwidgetextensioncontext openurl:completionhandler:]_block_invoke failed: error domain=nsosstatuserrordomain code=-10814 "(null)" // note: app name has been substituted appropriate generics. i find os status lookup site pretty useful infer details errors. os error code -10814 klsapplicationnotfounderr , describes scenario when: no application in launch services database matches input criteria. it sounds application has not been registered system consumer of url scheme using. have double-double (double!...

ruby - docker-compose: connection refused between containers, but service accessible from host -

tl;dr: how have change below docker-compose.yml in order allow 1 container use service of on custom (non-standard) port? i have pretty common setup: containers web app (padrino [ruby]), postgres, redis, , queueing framework (sidekiq). web app comes custom dockerfile, remaining services come either standard images (postgres, redis), or mount data web app (sidekiq). ties via following docker-compose.yml : version: '2' services: web: build: . command: 'bundle exec puma -c config/puma.rb' volumes: - .:/myapp ports: - "9000:3000" depends_on: - postgres - redis sidekiq: build: . command: 'bundle exec sidekiq -c config/sidekiq.yml -r ./config/boot.rb' volumes: - .:/myapp depends_on: - postgres - redis postgres: image: postgres:9.5 environment: postgres_user: my-postgres-user postgres_password: my-postgres-pass ports: - '9001:5432...

angular - CLOSED - angular2 semantic-ui dropdown fails on route change -

(first post ever .. sorry mistakes) i have been playing around angular2 , semantic-ui dropdown. i'm losing mind since it's been 2 days , can't figure out problem. i have component "dropdown.component" when runs ngafterviewinit calls //////////////////// // dropdown.component //////////////////// ngafterviewinit(){ this.dom.loaddrop($(this.elementref.nativeelement).find('select')); } ngondestroy(){ //i doing .dropdown('destroy') -- although disable. //could not find nothing unbind dropdown. } //////////////////// //inside dom class //////////////////// loaddrop(elm: any) { if (typeof (elm) === 'string') { elm = $(elm); } $(document).ready(function () { elm.dropdown({ allowadditions: true }) }); } this works perfect when reload page on first time (with 1 or multiple dropdown.component), although when access page router.navigate, routerlink or simple page dropdown.component exists, browser fr...

haskell - How to return an array with each element responding to a certain check -

i return list of bools each responds check, here javascript example: if(x == 2) = false; if(x == 3) b = false; if(y == 2) c = false; if(y == 3) d = false; return [a, b, c, d]; dirty example, know. wondering approach might be. x=5 y=3 elementary zipwith (==) [x,x,y,y] [2,3,2,3] [false,false,false,true] or magic import control.monad (liftm2) liftm2 (==) [x,y] [2,3] [false,false,false,true]

Apache FTP Server: MVN Build Failed on Java 8 (SSL) -

i trying build apache ftp server on arch linux box. os: arch linux 64-bit (up-to-date). kernel: 4.8.6-1. java: oracle 1.8.0_112. maven: 3.3.9. both open-ssl , tls installed. whenever run "mvn install" in build directory, following errors. believe problem due java 8 disabling ssl v3.0 in favor of tls? if so, seems bad idea compile older version of java. should library not used, or there better way handel this? results : tests in error: teststorewithprotpandreturntoprotcinpassivemode(org.apache.ftpserver.ssl.minaexplicitssltest): no appropriate protocol (protocol disabled or cipher suites inappropriate) testcommandchannel(org.apache.ftpserver.ssl.minaexplicitssltest): no appropriate protocol (protocol disabled or cipher suites inappropriate) testreissueauth(org.apache.ftpserver.ssl.minaexplicitssltest): no appropriate protocol (protocol disabled or cipher suites inappropriate) testissecure(org.apache.ftpserver.ssl.minaexplicitssltest): no appropria...

regex - How to get the words that start with '#' in string using php? -

this question has answer here: retrieve hashtags tweet in php function 6 answers i have sentence "my name's #jeff,what thy name?" and want #jeff sentence. have tried code for ($i=0; $i <=substr_count($text,'#'); $i++) { $a=explode('#', $text); echo $a[$i]; } but returns #jeff,what thy name? not soul desires there simpler solution it. use preg_match() find target part of string using regex. preg_match("/#\w+/", $str, $matches); echo $matches[0] check result of code in demo if want matches string, use preg_match_all() find matches. preg_match_all("/#\w+/", $str, $matches); print_r($matches[0]);

how to run a java program from command line with a text file as an input argument -

this question has answer here: how run java program command line on windows? 9 answers i have assignment university , want make program reads maze text file. question how can adjust program make run command line this: java thiseas path_to_file/filename.txt if helps using java.util.scanner file reader. haven't found online this, , honest don't know how correctly. if has ideas on how make work please reply. thanks in advance edit: question couldn't clearer. found answer myself, has same question have file f = new file(args[1]); then able run program command window file input argument (args[1]). first make sure jdk installed , path set then u can generate byte code javac program_name.java run java program_name

c# - How can I use Unity toggles and toggle groups to save a selected toggle in a toggle group as player prefs? -

i have scene input fields , toggle groups want save player input in playerprefs reusing in consecutive game sessions. text label of toggle selected in toggle group. here code far. have compiler error says cannot convert guitext string. think have inputfield strings saved fine toggle groups tricky. using unityengine; using system.collections; using unityengine.ui; public class createholder : monobehaviour { public inputfield input1; public inputfield input2; public inputfield input3; public inputfield input4; public togglegroup discount; public togglegroup params; public togglegroup time; public void grabdata() { playerprefs.setstring("offername", input1.text); if (playerprefs.haskey("offername") == true) { debug.log("something has saved"); debug.log(playerprefs.getstring("input1").tostring()); } playerprefs.setstring("offerdesc", inp...

recursion - Prolog- family tree of children -

Image
if wanted recursively go down family tree in prolog , return children of every branch, how start that? thanks assume following tree, children in red a simple solution be: male(lennart). male(mike). male(donald). male(usain). male(joar). male(adam). male(dan). male(simon). female(hillary). female(elise). female(lisa). female(lena). parent(mike, lennart). parent(mike, lena). parent(lennart, donald). parent(lennart, hillary). parent(lennart, usain). parent(lena, adam). parent(lena, simon). parent(adam, dan). parent(donald, lisa). parent(hillary, joar). parent(hillary, elise). child(lisa). child(joar). child(elise). child(dan). child(simon). %% predicate rules father(x,y) :- male(x),parent(x,y). mother(x,y) :- female(x),parent(x,y). son(x,y) :- male(x),parent(y,x). daughter(x,y) :- female(x),parent(y,x). family_children(x, x):- child(x). family_children(x, child):- parent(x,y), family_children(y, child). test run: [debug] ?- family_children(mike,...

c++ - Enter size of an array in a struct -

i have array in struct , want enter size of via user's input. struct queue { int maxsize; int count; int* element; }; element array, , want set size of '5' , initialize of '5' cells '0' struct queue q; *element -> ?? you tagged question c++ , here c++ solution. forget pointers , use std::vector<int> . #include <vector> struct queue { int maxsize; int count; std::vector<int> element; queue(int n=5) : element(n) {} }; then queue q; will construct queue object 5 elements in element member. no need malloc , calloc or free . note: if change tags c instead of both c , c++ , see why it's important use correct tags. can't above in c , , same thing using pointer , using malloc other answers have given.

c - Wrong output from tolower fuction -

i have problem tolower function. tried use argv output $0@. what's wrong code? #include <stdlib.h> #include <stdio.h> void makelower(char *s) { int i; for(i = 0; s[i] != '\0'; i++){ s[i] = tolower(s[i]); } printf("%s", s); } int main(int argc, char *argv[]) { argv[0]="a"; makelower(argv); return 0; } argv pointer pointer, char** . function takes char* . so, need pass like: makelower(argv[0]); but isn't going work because argv[0] points string literal. modifying string literal undefined . instead pass modifiable array like: int main(int argc, char *argv[]) { char arr[] = "a"; makelower(arr); return 0; } other option make copy of string literal passed (via argv[0] ) , able modify it. basically, idea can't legally modify string literals in c.

monogame - Loading asset files that are not part of your .mgcb project -

i trying build editor in monogame can create levels other monogame projects. problem i'm facing editor needs able load assets other monogame projects @ runtime, without being given explicit reference project beforehand. can find file path assets, when try load them, throws error. the issue seems monogame won't load assets not included part of .mgcb project. there way directly load assets not part of .mgcb project? or alternatively, there way dynamically load new .mgcb project @ runtime can access assets?

c - GNU Makefile parallel execution of two files -

i using makefile first time , want execute 2 files @ same time. server , client file, every file has it's own main, , 2 files communicate each other. till have written following makefile: all: server client server: server.c gcc server.c -o server ./server client: client.c gcc client.c -o client ./client so want start server first client can connect afterwards. , problem: if execute makefile server starts. possible start client directly after server instead of 1 file @ time? it's unusual try both build , run programs makefile (except running automated regression tests, example.) normally, run make, run code. personally, i'd start sever in terminal window run client in first one. but if want makefile, try following: all: server client run server: server.c gcc server.c -o server client: client.c gcc client.c -o client run: ./server & ./client killall server the last line kills off server afte...

lisp - How to extract subexpressions in maxima? -

let's assume maxima function gave me fraction result. example (%o1) bla / blubb where bla , blubb again more complicated expressions. now want process numerator , denominator separately. how can extract them separate variables? i know bla/blubb internally represented list in lisp, :lisp (setq $oneofthem (nth 2 $%o1)); to lisp representation of numerator or denominator. however, feel maxima , lisp representation differ in commutation, i'm not sure in advance if maxima variable oneofthem contains first or second factor (either bla or (mtimes blubb -1) ). the main functions part , inpart . see substinpart , pickapart , reveal .

Compile and start java file in bash without saving compiled file -

is possible compile , run java file in bash without saving compiled file? i'm using command javac file.java && java file . works creates file.class file. can somehow pipe compiled file java command? have tried javac file.java | java not work. to knowledge, not possible, , doesn't make sense. you see, jvm comes many megabytes of precompiled classes; , many of them loaded while running small class. there no point in saving 1 k or whatever file.class consumes on disk space. so should step , re-think kind of problem think can solve such approach.

php - Get driving distance between two points using Google Maps API and calculate time -

how display time example 16:00 have idea how make this? function getdrivingdistance($lat1, $lat2, $long1, $long2) { $url = "https://maps.googleapis.com/maps/api/distancematrix/json?origins=".$lat1.",".$long1."&destinations=".$lat2.",".$long2."&mode=driving&language=de"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_proxyport, 3128); curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_ssl_verifypeer, 0); $response = curl_exec($ch); curl_close($ch); $response_a = json_decode($response, true); $dist = $response_a['rows'][0]['elements'][0]['distance']['text']; $time = $response_a['rows'][0]['elements'][0]['duration']['...

Prolog. Combining predicates -

i have make predicate/2 takes list of "correct" numbers validation, , function needs validated. numbers in function (represented number(x) ) has same numbers in validation list, become "true". i have no problem making 2 seperate predicates/1 give correct answer when list "hard-coded" in library, can god of mine not combine these. i have far: number(x) :- member(x, [1,2,3,4,5]). this gives correct result when ask for example and(number(2),number(4)) , says yes, , and(number(2),number(6)) gives no. but have predicate/2 , takes list first argument. can help/give hint? predicate(validationlist, function) :- ???? you can use call predicate: and(x,y) :- call(x), call(y). or(x,y) :- call(x); call(y). predicate(list, function) :- function =.. [p,x,y], call(p, member(x, list), member(y, list)). for example: ?- predicate([1,2,3], and(1,3)). true. ?- predicate([1,2,3], and(1,4)). false. ?- predicate([1,2,3], or(1,4)). t...

python - How to get everything from the list except the first element using list slicing -

this question has answer here: explain slice notation 24 answers so have parsing, here example of do: list = ['a', 'b', 'c'] and using list slicing have return me first index. in case: ['b', 'c'] i have been messing stuff list[:-1], list[::-1], list[0:-1], etc. can't seem able find out. what actual doing is: * have error message has error code in beginning such as: ['226', 'transfer', 'complete'] and want display transfer complete on popup widget. of course casting string. thank help, , if answer differs via python 2.7.x , python 3.x.x please answer both versions. thanks, looked lot around stackoverflow , python tutorials couldn't quite looking for. help! you can [1:]. work on both versions.

compiling an embedding python 3.5 in a visual 97 windows c program -

i trying create program using c , python. attempting do, create plots dynamically. plot programs i've found require file or static source. python part want create have api able use c program wish create. an earler request helped me find correct python libery (i needed download python again). thank much. added path library , compile error. i error of: c:\python35\libs\python35_d.lib : fatal error lnk1106: invalid file or disk full: cannot seek 0x5666a758 i using microsoft developer studio 97 include directories are: c:\program files (x86)\devstudio\vc\include c:\program files (x86)\devstudio\vc\mfc\include c:\program files (x86)\devstudio\vc\atl\include c:\python35\include the library directories are: c:\program files (x86)\devstudio\vc\lib c:\program files (x86)\devstudio\vc\mfc\lib c:\python35\libs the source directories are: c:\program files (x86)\devstudio\vc\mfc\src c:\program files (x86)\devstudio\vc\mfc\include c:\program files (x86)\devstudio\vc\at...

ios - Command Failed due to signal: Segmentation Fault 11 -- Xcode 8 Swift 3 -

Image
after intense googling , brainstorming, can't find solution let's see if stack overflow has magic solution need. using contacts framework fetch dates contact. however, works need sort dates in order work. result, extending array of cncontact , , inside extension have function work. no errors show in issue navigator when build issue in report navigator saying command failed due signal: segmentation fault 11 . believe issue use of generics because report navigator pointing line, , googling suggests that issue coming have no workarounds. (i highly suspect i'm not sure.) let me share code you: this inside extension of array of cncontacts. typealias contactdate = cnlabeledvalue<nsdatecomponents> func filteredandsorteddates() -> [contactdate : cncontact] { // error occurs on line according issue. var alldates: [contactdate : cncontact] = [:] var sorteddates: [contactdate: cncontact] = [:] contact in self { if contact.iskeyavailable(cnc...

javascript - Physical security item with Google Chrome -

the escenario: user attach usb pen drive or somerhing else , webapp allows user work withe tabs. if object detached webapp deny operation i've seen fido u2f doesnt reslly work because user must click key send auth code chrome. if allowed webapp actively poll usb key solución, but, said, u2f allows key send key if user press button. is there solution problem?

javascript - $scope variable doesnt integrate with express api -

the static part of app seems load ok. added service uses express simple api, when try set #scope module's controller seems if hasn't loaded. puzzled why happening because claims find , load correctly based on server output... appreciated :) here project: https://github.com/abott1222/simple-mean-app get / 304 4.637 ms - - get /js/angular.min.js 304 1.523 ms - - get /js/angular-route.min.js 304 1.627 ms - - get /style.css 304 0.376 ms - - get /app/app.js 304 0.391 ms - - get /app/controllers/todolistcontroller.js 304 0.730 ms - - get /app/controllers/todocontroller.js 304 0.717 ms - - get /app/services/todoprovider.js 304 0.666 ms - - get /app/partials/todo_list.html 304 0.269 ms - - i forgot work node need make api calls async. change in static/app/controllers/* $scope.todolist = todoprovider.getalltodos(); to $scope.todolist = todoprovider.getalltodos(function (err, todos) { $scope.finished_loading = true; if (err) { $scope...

Add custom js file to JHipster -

i'm trying include javascript file not available bower. so copied src/main/webapp/content , referenced in index.html in dev profile fine -- works. now, after generating war file prod profile, custom.js file not included in war (tried unpack -- file not there). i have discovered gulp merging css , js files, did miss config this? when app loaded, browser complains 404 in index.html -- js file not found. how can fix this? right way include js (or css) file jhipster app? thank you. js not expected in content folder. for css, copy file src/main/webapp/content/css . for js, copy file src/main/webapp/app possibly in dedicated sub folder. you don't have inject them in index.html , gulp you. suppose did not see in dev profile because not running gulp serve as explained in doc

laravel - Artisan Error: Failed to listen on localhost:8000 (reason: An attempt was made to access a socket in a way forbidden by its access permissions. ) -

i'm having problem starting laravel installation. whenever type in terminal php artisan serve , throws me error below: c:\wamp\www\blog>php artisan serve laravel development server started on http://localhost:8000/ [sat nov 05 21:18:39 2016] failed listen on localhost:8000 (reason: attempt made access socket in way forbidden access permissions.) 1) first firewall restore default 2) change artisan serve port using command php artisan serve --port=3232 trust me works :)

javascript - Getting function from within object function -

i've been learning oop , playing around in javascript, , wondering how looks work... function myapp(){ this.nav = function(){ function toggle(state = 'show'){ //toggle nav code... } toggle(); } } var app = new myapp(); app.nav(); how go accessing toggle function here this... app.nav().toggle('hide'); you need return this . here example: function myapp(){ this.nav = function(){ this.toggle = function(state = 'show'){ console.log(state); } this.toggle(); return this; } } const app = new myapp(); app.nav(); // show app.nav().toggle('hide'); // show hide also need attach function object ( this.toggle ). hope help.

Swap key,value inside a node.js collections dictionary -

i using node.js collection module. http://www.collectionsjs.com/ i swap key value inside collections dictionary. to illustrate, here original dictionary. "use strict"; var dict = require("collections/dict"); var data_type = new dict( { "00": "data_0", "01": "data_1", "02": "data_2", }); after swapping, new dictionary this; var data_type_swapped = new dict( { "data_0": "00", "data_1": "01", "data_2": "02", }); there no duplicate values in original dictionary. i using node.js v6. i not familiar library, skimmed documentation , came this: let dict = require('collections/dict'); let d = new dict({ 'key1': 'value1', 'key2': 'value2' }); d.keys().foreach(key => { d.set(d.get(key), key); d.delete...

javascript - postMessage from child to parent window in Safari using window.open -

i'm using window.open(...) open new window (same domain, same subdomain, same directory, same everything, different .html file). in child window, i'm using send messages parent: window.opener.postmessage({status:'ready'}, window.opener.location); it works great in chrome , firefox ... not in safari. here alternatives tried did not work: window.opener.* // no matter put, safari says .opener empty object window.parent // child refers self despite different window, same subdomain how can reference parent window can send postmessage(...) messages back?

How to convert a String into an Ecto.DateTime in Elixir? -

i need convert string containing valid utc time ecto.datetime one, insert database correct format later. have tried using ecto.datetime.cast(date) method doesn't seem work. string sat aug 04 11:48:27 +0000 2012 , comes twitter api. i know there libraries such timex didn't inspect yet. there easy working solution built in elixir? there's no built-in solution in elixir or erlang parsing datetime values of format: sat aug 04 11:48:27 +0000 2012 you can write parser yourself, it's neither going short or simple. you'll have split string, values of both date , time parameters, convert month strings month integers, parse timezone, represent complete value in elixir/erlang datetime formats , cast ecto.datetime . see following links: elixir tips - date parsing erlang - how can parse rfc1123 dates erlang term? convert timestamp datetime in erlang using timex best option here. it's written library allows stay away chaos of inner worki...

SQL Server - Convert Days as Column, Hour as row -

i'm looking way convert rows display datetime data's day column , hour first row in 1 month. example data in month: time | value -------------------------------- 2016-10-01 00:00:00 | 23 2016-10-01 00:30:00 | 35 ..... | ..... 2016-10-31 23:30:00 | 52 the result want is time | 1 | .... | 31 | <-- day 1 - 31 --------------------------------------- 00:00:00 | 23 | .... | .... | 00:30:00 | 35 | .... | .... | ... | .... | .... | .... | 23:30:00 | .... | .... | 52 | how can build result? you can use conditional aggregate this select cast([time] time), max(case when day([time]) = 1 value end) [1] max(case when day([time]) = 2 value end) [2] max(case when day([time]) = 3 value end) [3] ..... max(case when day([time]) = 31 value end) [31] yourtable month([time]) = 10 -- pass required month group cast([time] time)

c - GDB single stepping assembly and displaying the next instruction which will be executed. -

this question has answer here: show current assembly instruction in gdb 6 answers using gdb debbuger command can execute single step , display next instruction executed? i'm familiar windbg operation pretty straight forward. so example have following function , step code via si want display next instruction executed without having full disassembly via disassemble. how can accomplish this? dump of assembler code function iseven: 0x0000000100000f20 <+0>: push %rbp 0x0000000100000f21 <+1>: mov %rsp,%rbp 0x0000000100000f24 <+4>: mov $0x2,%eax 0x0000000100000f29 <+9>: mov %edi,-0x4(%rbp) => 0x0000000100000f2c <+12>: mov -0x4(%rbp),%edi 0x0000000100000f2f <+15>: mov %eax,-0xc(%rbp) 0x0000000100000f32 <+18>: mov %edi,%eax 0x0000000100000f34 <+20>: cltd 0x0000...

Android Studio - java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener -

i created new activity in android studio app , have button performs action when click. not sure what's causing error happens when run activity. if remove onclick code, activity runs. help. i'm getting error: e/androidruntime: fatal exception: main process: com.masesk.kalkulator, pid: 4102 java.lang.runtimeexception: unable start activity componentinfo{com.masesk.kalkulator/com.masesk.kalkulator.main2activity}: java.lang.nullpointerexception: attempt invoke virtual method 'void android.widget.button.setonclicklistener(android.view.view$onclicklistener)' on null object reference @ android.app.activitythread.performlaunchactivity(activitythread.java:2416) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476) @ android.app.activitythread.-wrap11(activitythread.java) @ android.app.activitythread$h.handlemessage(activitythread...

JavaScript - What is the better way to skip an input when necessary for a code editor? -

i programming web app online code editor. 1 of basic functions when users input, say, left parenthesis symbol "(" , editor automatically add right 1 ")" you. so immediate idea create object that, defined follows: var pairchardata = { "{": "}", "(": ")", "\"":"\"", "'":"'" }; that's not end. want editor smarter should skip input when necessary. example, when input in editor right parenthesis symbol after added left 1 (at time, right parenthesis existed!), editor expected move cursor without showing 1 more duplicated one. so want check if next user-input character 1 expected. created map follows: var pairchardatareverse = { "}": "{", ")": "(", "\"":"\"", "'":"'" }; this is, know, reverse version of first map. idea keep ...

java - How to create a script to run the jar (while installing SBT)? -

i installing sbt on mac. following instructions mentioned (cryptically) on the website . @ stage 'installing sbt manually' . under 'unix', reads: put sbt-launch.jar in ~/bin. create script run jar, creating ~/bin/sbt these contents: #!/bin/bash sbt_opts="-xms512m -xmx1536m -xss1m -xx:+cmsclassunloadingenabled -xx:maxpermsize=256m" java $sbt_opts -jar `dirname $0`/sbt-launch.jar "$@" make script executable: $ chmod u+x ~/bin/sbt i have put sbt-launch.jar in correct folder. not understand rest means. how can create script: in terminal? code make script executable have execute once in terminal? (and after finishing installation, how able open sbt?) the easiest way install sbt on macos without terminal interaction homebrew . it's popular package manager , useful in future. click link , follow instruction install (it's 1 command paste terminal). run brew install sbt that's it. launch sbt run sbt comm...

Simple code needs to convert into loop from recursive function -

can convert recursion iteration? begin seq(n) if (n equals 1) return 3 elseif (n equals 2) return 2 else return seq(n – 2) + seq(n – 1) endif end these fibonaccis starting 3,2, going 5, 7 etc. set if passed n, if n 1 or 2 make special case, , otherwise like: a=3 b=2 (i leaving figure out indices) {temp=b; b=b+a;a=temp} return b i not want more since seems homework problem , answers not supposed of work.

javascript - Trying to figure out auth0 custom login screen callback url -

i've been trying follow this guide custom login screen work angular app locally. part i'm struggling on login callback never gets called. my original login url http://localhost:9000/#/login angular.module('myapp').service('authservice', function ($location, angularauth0) { function login(username, password, callback) { console.log('in login service'); angularauth0.login({ connection: 'username-password-authentication', responsetype: 'token', email: username, password: password }, function(err) { console.log('we never here'); }); } return { login: login }; }); angular.module('myapp').controller('loginctrl', function ($scope, $location, authservice) { $scope.login = function() { ... authservice.login($scope.user.email, $scope.user.password) when login, redirected http://localhost:9000/#/access_token<myacces...

AppleScript code to edit my plist -

using applescript, how can edit key phonenumber new value , delete key useractive ? i have read apple's documentation, did not success. help. <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>person</key> <dict> <key>adult</key> <dict> <key>names</key> <dict> <key>myname</key> <dict> <key>adress</key> <dict> <key>profissional</key> <dict> <key>celnumber</key> <integer>4</integer> <key>phone...

angularjs - Angular2 app as an oauth Client -

we have oauth server setup our client apps on mobile , web consume rest apis through oauth2. since angular2 relatively new wanted know best , optimal way of implementing oauth2 client in our angular2 app. aware of canactivate guard on route level want know if writing custom code preferred way or there reliable library or module can handle access tokens, revoking access client end etc.

php - Time of day display -

i'm trying time of day script had long time ago working again, want add ajax scripting well. i'm sure i'm missing obvious or not completing fully. think missing more of code not sure were. here have: date.js <script type="text/javascript"> $(document).ready(function() { var = new date(); var hours = now.gethours(); var msg; if (hours < 07) msg = "good morning"; else if (hours < 12) msg = "good afternoon"; else if (hours < 18) msg = "good evening"; $('#time p').text(msg); }); }); </script> could add <?php the_date(); echo "<br />"; ?> in location want display text , getting working again. if not , add output display text @ times? said i'm sure simple.

c++ - Error using std::cout in visual cpp console application -

i using visual studio 2013 build c++ console application.this code gives error. need write console every function in application. // rat.cpp : defines entry point console application. // #include "stdafx.h" int _tmain(int argc, _tchar* argv[]) { std::cout << "process started"; return 0; } it gives following error, error:namespace "std" has no member "cout" i dont understand why basic "cout" gives such error :( please me totally confused.... you need place #include <iostream> header.

python - WebDriverException: Message: 'phantomjs' executable may have wrong permissions -

running selenium locally on flask. im using phantomjs driver. had path error: selenium.common.exceptions.webdriverexception: message: 'phantomjs' executable needs in path. but after finding out stackoverflow question, learned have pass environment path parameter phantomjs. path have below path phantomjs folder in virtual environment folder. driver = webdriver.phantomjs(executable_path='/users/myacc/documents/mywebapp/venv/lib/python3.5/site-packages/selenium/webdriver/phantomjs') however, new error-code now: selenium.common.exceptions.webdriverexception: message: 'phantomjs' executable may have wrong permissions. here's when check file permissions of path. total 40 drwxr-xr-x 7 user staff 238 nov 6 00:07 . drwxr-xr-x 17 user staff 578 nov 6 00:03 .. -rw-r--r--@ 1 user staff 6148 nov 6 00:07 .ds_store -rw-r--r-- 1 user staff 787 oct 31 12:27 __init__.py drwxr-xr-x 5 user staff 170 oct 31 12:27 __pycache__ -rw-r--r-- 1 user staff 2587 ...

dequeueBuffer: can't dequeue multiple buffers without setting the buffer - android -

when want run app on smartphones have 4.4.2 or 4.4.4 android version got error : /bufferqueue: [com.huawei.android.launcher/com.huawei.android.launcher.launcher] dequeuebuffer: can't dequeue multiple buffers without setting buffer count my gradle : apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion '24.0.0' defaultconfig { applicationid "*.*.*" minsdkversion 16 targetsdkversion 23 versioncode 1 versionname "1.0" jackoptions { enabled true } // enabling multidex support. multidexenabled true } buildtypes { release { debuggable false minifyenabled false shrinkresources false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } compileoptions { sourcecompatibility java...

oracle - PL SQL xmlelement: How to get data in xml from mutually exclusive condition on same tables -

i fetching data database using xml . here tables: settings table: class code name 'm1' 1 food1 'm1' 2 food2 'p1' 1 payincash 'p2' 2 payonline customer table: customer_id food_name payment_method cus123 1 1 cus123 2 2 as can see, have used internal codes map detail i want write query give following output: query output: customer_id food_name payment_method cus123 food1 payincash cus123 food2 payonline i want retrieve data in xml format,that's why using xmlelement. select xmlelement("customer_records", xmlagg( xmlelement("record", xmlelement("cus_id", customer_id), xmlelement("food", food_name), xmlelement("payment", payment_method) ...

java - Incompatible type error in Android Studio -

Image
an error shows when build gradle second time after opening project. @ first time, gradle build not show errors. can help? check import statement. sure imported java.util.list , not kind of java.awt.list or else. also, check listview import.

angularjs - Using Angular $resource, Fetch data on button click not working -

i using angularjs ngresource fetch list of data database on button click. when click button nothing happens. doing wrong. app.js 'use strict'; var app = angular.module('app',['ngresource']); graph_service.js 'use strict'; app.factory('graph', ['$resource', function ($resource) { return $resource( 'http://localhost:8080/spsystem/stats' ); }]); graph_controller.js 'use strict'; app.controller('graphcontroller', ['$scope', 'graph', function($scope, graph) { var self = this; self.graph= new graph(); self.graphs=[]; self.fetchallstats = function(){ self.graphs = graph.query(); } }]); minimal html <body ng-app="app" class="ng-cloak"> <div class="generic-container" ng-controller="graphcontroller ctrl"> <div class="panel panel-def...

Cannot Get DLookup Function to work in Access 2013 -

i trying dlookup function work in access 2013, cannot work, heres have far :- i have query called qry_vehicleoverview in query there 2 fields called vehiclenumber , datelastexam i have form, there number of fields, 2 of them called vehicle1 , datelastexamv1 , in datelastexam1 ! trying reference relevant exam based on vehicle1 qry_vehicleoverview field, when vehicle number added vehicle1 displays correct exam in datelastexam1 first of create combo box in form, called vehicle1 , referenced vehiclenumber qry_vehicleoverview then created text box in form, , called lastexamvehicle1 , in control source of field added dlookup function :- =dlookup("[datelastexam]","qry_vehicleoverview","[vehiclenumber]=""" & [vehicle1].[text] & """") then chose after update in event tab , selected code builder in here added :- private sub lastexamvehicle1_afterupdate() me.lastexamvehicle1.requery end sub b...

osx - Run c-code with cmake -

i new programming , have several c-files want run terminal in mac. have installed cmake homebrew , seems installed correctly (when type "brew install cmake", message "warning: cmake-3.6.3 installed"). my problem is, don't know type next compile/run file. i'm sorry if seems basic, don't understand answers found on google. have changed directory folder containing files "cd /users/..." , have cmakelist.txt file friend , put in same folder. have tried typing "cmake ." , creates lot of new folders, doesn't print anything. have "printf"-command in main.c. can tell me, should type make code print terminal? cmake doesn't run program. cmake generates makefile. makefile can interpreted "make" calling "make" in same directory (you can specify other names or paths, not needed here). "make" call compiler, linker , maybe other stuff build program. @ end , no errors, have executable...

powershell - Unable to schedule related build in Jenkins -

i trying schedule deployment of builds through jenkins. deployment covers staging , promotion of build had staged build unable promote it. job parameterized taking default values of parameters while scheduling. i have 2 jobs viz jenkins master , jenkins slave. staging scheduled in jenkins master, promotion triggering jenkins master again slave , overriding 1 of parameter of job, i.e. action=promote (default value of action stage ). somehow action not overriden , staging performed again. do 1 can suggest better way?

sql - Complexity in querying for data of two tables with a 'many to many relationship' creates time delay -

i have 'many many relationship' between 2 tables in database. 1 called "tools" other "groups". problem when want, example, tool names associated collection of groups, , return user in order present in list or something, action takes couple of seconds, , creates bad user experience. ideas of how can reduce time takes data fetched? my linq: var tools = new hashset<string>(); //the groups user associated foreach (var usergroup in usergroups) { //all groups in database foreach (var group in context.groups) { if(group.groupname == usergroup) group.tools.foreach(t=>{ tools.add(t.toolname); }); } } return tools;

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot...

javascript - How to set a sequential integer step in AmCharts' value axis? -

i want set sequential integer step, i.e. 0,1,2,3,4,....... , in my charts valueaxis . how can accomplish this? per documentation, step read-only value, can't set influence value axis step. have couple of options force own step increment: 1) set valueaxis' autogridcount false , set gridcount large enough value minimum/maximum desired step. value of 20 works in chart's case. demo 2) disable labels , use guides draw each tick on valueaxis. demo

grails - how to override gorm delete method for testing? -

i writing simple integration test intend simulate delete failure. the controller pulls record database , deletes shown below. def deleteitem(id){ def item = item.get(id) item.delete() } now, want simulate delete failure following code void testdeleteitem_faildeleteflushsavefail(){ item.metaclass.delete = { map params -> throw new validationexception("failed!!") } def model = controller.deleteitem(mp.id) assertequals controller.flash.message, "sorry error occured when deleting!!" groovysystem.metaclassregistry.removemetaclass(item.class) } but test fails because method not replaced. i.e exception not thrown on delete. guessing problem in metaclass formulation. how can make exception thrown when delete called? appreciate help! thanks! this because should use item.metaclass.delete = { throw new validationexception("failed!!") } rather item.metaclass.delete = ...

apache spark - scala.MatchError on Dataframe Mapping to RDD -

i running scala 2.11.8 , spark 2.0 notestokenized.head(1).foreach(println) notestokenized.printschema() println(notestokenized) val lda_countvector = notestokenized.rdd.map { case row(id: long, features: vector) => (id, features) lda_countvector.take(5).foreach(println) the output [10077,(47613,[0,1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,31,32,33,34,35,36,37,38,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,65,66,67,68,69,70,72,73,74,75,76,78,79,80,81,84,85,86,87,88,89,90,91,92,93,94,95,96,98,99,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,122,123,124,125,126,127,128,129,130,131,134,135,136,137,138,139,141,142,143,144,145,146,147,148,149,151,152,153,154,155,156,157,158,160,161,162,164,165,166,167,169,170,171,172,173,174,175,176,177,178,179,180,182,183,184,187,188,189,190,193,194,195,196,197,198,200,201,202,203,204,206,207,209,210,211,212,213,215,216,217,218,219,222,223,224,225,2...