Posts

Showing posts from June, 2013

angularjs - 404 Page not found while handling GET/POST request -

i'm working on tracker application front end angular js , using asp.net web api get/post requests handling. faced lot of issues related cors , after lot of googling... solved issue , app working in localhost... when deployed iis in server...it again raised cors issue , have solved too.. i'm facing 404 page not found get/post requests.. request url: http://xxx.xx.xx.xx:55555/api/cr/ request method:get status code:404 not found remote address:15.85.199.199:8088 response headers access-control-allow-origin:* connection:keep-alive content-length:1245 content-type:text/html date:tue, 08 nov 2016 07:44:23 gmt proxy-connection:keep-alive server:microsoft-iis/7.5 request headers view source accept:application/json, text/plain, / accept-encoding:gzip, deflate, sdch accept-language:en-us,en;q=0.8 cache-control:max-age=0 host:199.228.105.24:55555 origin: http://evil.com/ proxy-connection:keep-alive user-agent:mozilla/5.0 (windows nt 6.3; win64; x64) applewebkit/537.36 (khtml,

override core rules in yii2 -

i wanted override core rule number in yii2 convert persian numbers english numbers, , validate them? these code uses converting persian numbers english numbers in php function convert($string) { $persian = array('Û°', 'Û±', 'Û²', 'Û³', 'Û´', 'Ûµ', 'Û¶', 'Û·', 'Û¸', 'Û¹'); $num = range(0, 9); return str_replace($persian, $num, $string); } how can apply these codes doing convert before validation?i don't want use beforevalidate in model wrote componet don't know function , should change? add filter rule in model. public function rules() { return [ ['pers_number', 'filter', 'filter' => function ($value) { return str_replace( ['Û°', 'Û±', 'Û²', 'Û³', 'Û´', 'Ûµ', 'Û¶', 'Û·', 'Û¸', 'Û¹'], range(0, 9), $value

Scala match both String and Array -

i trying call method foldleft on string/array object. like: def dosth(obj: any): int = { obj match { case t: traversableonce[any] => t.foldleft(0)((rs: int, i: any) => ...) case other => ... } } but when call dosth("abc") , matches case other . want case t: traversableonce[any] . is there anyway this? string not sub type of traversableonce. that's why not match traversableonce. although string can implicitly convert stringops sub type of traversableonce. check predef.augmentstring you can this. in case scala compiler implicitly convert string stringops . print out class scala.collection.immutable.stringops if pass in "hello" def dosth(obj: traversableonce[any]): int = { println(obj.getclass()) obj.foldleft(0)((rs: int, i: any) => ...) } and in following code. print out class java.lang.string if pass in "hello" . means there no implicit conversion. def dosth(obj: any): int = { obj match

javascript - Jasmine trigger Button Event -

i have following click handler wrapped in class var testui = function (chatclient, document, elements) { testui.prototype = { applylistenerstoelements: function () { var self = this; this.elements.mybutton.click(function () { self.myclient.postdata(data).then(function (response) { //all's if(response) { ....do } }, function (err) { console.log("error " + err); }); }); } } how write jasmine test simulate/perform actual click event if clicked on in browser ? how mock objects , events ? have provide html snippet in mock or can use html that's in actual file, perhaps using jasmine.getfixtures() just come across while ago seems answer question. https://luizfar.wordpress.com/2011/01/10/testing-events-on-jquery-objects-with-jasmine/ and can read in html external file using jasmi

webpage - Chrome loading pages very slow -

Image
after use chrome while, find pretty slow when loading url pages. maybe stuck somewhere when displaying pages. i not know why stuck. can see in figure, takes more 5 seconds load google.com page. when use ie browser, displays quickly, less 1 second. can me? each time have uninstall chrome , install again avoid issue. issue appears time later. using chrome version 54.0.2840.71 m (64-bit) on windows 7.

How to set http proxy for Docker registry mirror function -

i can make docker (1.12.3) daemon work corporate firewall set http proxy in /etc/systemd/system/docker.service.d/http-proxy.conf (as recommended in official document) on centos 7.2 read document of https://docs.docker.com/registry/ , https://github.com/docker/distribution . don't find how make docker registry (mirror) work corporate firewall.

Unable to build android app using ionic -

i novice in mobile app development , learning create simple mobile app using ionic , cordova. when build android app using following command ionic build android i encountered following error message: failure: build failed exception. build failed total time: 11.5 secs * where: build file 'd:\ionic\confusion\platforms\android\build.gradle' line: 20 * went wrong: problem occurred evaluating root project 'android'. > java.lang.unsupportedclassversionerror: com/android/build/gradle/appplugin : unsupported major.minor version 52.0 * try: run --stacktrace option stack trace. run --info or --debug option more log output. can please?

c# - Image not visible while using dynamic image source - MVC5 -

i trying create image slideshow using mvc5. here model class: public class imageslider { public string source { get; set; } public string imagename { get; set; } public string title { get; set; } } for model, i'd created controller , action within: public actionresult _imageslider() { return view(new list<imageslider> { new imageslider { source = "~/_slider/images/google.jpg" }, new imageslider { source = "~/_slider/images/googleplus.jpg" }, new imageslider { source = "~/_slider/images/facebook.jpg" } }); } and here partial view: <div class="cycle-slideshow" data-cycle-fx="scrollhorz" data-cycle-pause-on-hover="true"> @foreach (var item in model) { <img src="@item.source" /> } </div> now problem when create image tag above, not see image while can see in page source these elements have beeen created. if create the

apache kafka - KafkaOffsetMonitor: Just Show Loading -

Image
we going monitor kafka performance kafkaoffsetmonitor , nice tool. according install instruction, launch monitor app command below: java -cp ./kafkaoffsetmonitor-assembly-0.2.0.jar \ com.quantifind.kafka.offsetapp.offsetgetterweb \ --zk ip:port,ip:port \ --port 8089 \ --refresh 10.seconds \ --retain 2.days but nothing except loading... , shown below: according debug information, sends get request, such ip:8089/group ,but pending here. btw, client holds kafkaoffsermonitor app can telnet zookeeper cluster. any effort appreciated.

javascript - Filter results from API with angularjs -

i receiving data api in angular , trying filter result hotels min_price less example 50$! $http.get($rootscope.baseurl + 'api/hotels/', { params: { page_size: $scope.page_size, page: $scope.page, goingto: goingto, ordering: $scope.sortby, star: $scope.filter.star, min_price: ???? }}).then( function(data, status, headers, config) { $scope.hotels = data.data.results; $scope.count = data.data.count; $scope.loading = false; pageservice.setcontentready(); }, function(data, status, headers, config) { $scope.loading = false; pageservice.contentstatus = 'ready'; } ); how show hotels under 50$ ? find below updated code $http.get($rootscope.baseurl + 'api/hotels/', { params: { page_size: $scope.page_size, page: $scope.page, goingto:

python - Data type for numpy.random -

why following numpy.random command not return array data type of 'int' understand should happen documentation. import numpy b = numpy.random.randint(1,100,10,dtype='int') type(b[1]) class 'numpy.int64' i can't change type using .astype() either. numpy uses it's own int types, since python (3) int can of arbitrary size. in other words, can't have array of python ints, best can object dtype. observe: in [6]: x = np.array([1,2,3],dtype=np.dtype('o')) in [7]: x[0] out[7]: 1 in [8]: type(x[0]) out[8]: int in [9]: x2 = np.array([1,2,3],dtype=int) in [10]: x2 out[10]: array([1, 2, 3]) in [11]: x2[0] out[11]: 1 in [12]: type(x2[0]) out[12]: numpy.int64

asp.net - C#.NET : How to set arabic or other languages' characters as access keys for a textbox control? -

till now, using software in english language only, being converted multi-languages, access keys being dead while computer language set other english, want use shortcut access key alt + f in arabic? how this? thanks in advance. from microsoft guidelines: keyboard layouts change according culture/locale. characters not exist in keyboard layouts. when assigning shortcut-key combinations, make sure can reproduce them using international keyboards, if plan use shortcut-key combinations windows 2000 mui (multilanguage user interface). because each culture/locale may use different keyboard, consider using numbers , function keys (f4, f5, , on) instead of letters in shortcut-key combinations. although not need localize number , function-key combinations, not intuitive user letter combinations. shortcut keys may not work each keyboard layout in particular culture/locale. example, cultures/locales use more 1 keyboard, such eastern europe ,

guice - the value of binding annotations -

the typical example of using binding annotation :- public class realbillingservice implements billingservice { @inject public realbillingservice(@paypal creditcardprocessor processor, transactionlog transactionlog) { ... } i'd understand value of annotation, 'cause can't create constructor binding public class realbillingservice implements billingservice { @inject public realbillingservice(@bankabc creditcardprocessor processor, transactionlog transactionlog) { ... } it looks superfluous in defining example, must missing something. i public class bankbillingservice implements billingservice { @inject public bankbillingservice(@bank creditcardprocessor processor, transactionlog transactionlog) { ... } but i'd still have bind both (or more) classes bind(creditcardprocessor.class) .annotatedwith(paypal.class) .to(paypalcreditcardprocessor.class); bind(creditcardprocessor.cl

angularjs - Creating fields in CRUD model MEAN.js -

im starting mean.js framework , i´m trying create first app. im creating app crud module generated yeoman (yo meanjs:crud-module). the app simple form 2 fields. "name" , "image". name title of image, , image url of image. my problem can´t insert in mongo collection "photos" both fields form. field "name" generated default crud module generator inserted correctly in collection. im doing wrong? photo.server.model.js 'use strict'; /** * module dependencies. */ var mongoose = require('mongoose'), schema = mongoose.schema; /** * photo schema */ var photoschema = new schema({ name: { type: string, default: '', required: 'introduce el nombre de la imagen', trim: true }, image: { type: string, default: '', required: 'introduce la url de la imagen', trim: true }, created: { type: date, default: date.now },

HTML doc for scalable viewing and auto resizing -

i trying email invite out basic html5, no js , simple me. i got following work degree. have 3 jpgs in top row , 2 in next text. resizes until gets small. ipad example puts last jpg in top row in next. etc. i reduced percentages of width add less 100% total per row , helps point. when reduce maybe phone screen size overflow jump. <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title></title> <meta name="viewport" content="initial-scale=1"> <style type="text/css"> p { color: #000000 } </style> </head> <body lang="en-us" text="#000000" dir="ltr" style="background: transparent"> <span class="sd-abs-pos" style="position: relative"> <img src="data

php - How to add and update images or image url in Volusion using Volusion API -

actually have store importing products store product data insert , update image or image url not insert , update. this xml code name datapro.txt. <products_joined> <productcode>3710_012t</productcode> <vendor_partno>eah5450silent/di/1gd3(lp)</vendor_partno> <productname>test product ta</productname> <hideproduct>n</hideproduct> <stockstatus>20</stockstatus> <lastmodified>1/5/2016 10:25:00 am</lastmodified> <lastmodby>2</lastmodby> <productweight>0.9</productweight> <productprice>100</productprice> <productmanufacturer>asus tek</productmanufacturer> <vendor_price>32.69</vendor_price> <numproductssharingstock>0</numproductssharingstock> <categoryids>107</categoryids> <producturl>http://tebkq.mvlce.servertrust.com/productdetails.asp?productcode=3710_012t</producturl>

node.js - Get request.params via an html form? -

this question title edited. original title "how can submit string in form , have applied request parameter in url?" . think of simple server string received route parameter, e.g. localhost:3000/hello serves page containing 'hello'. this implemented, here simple express server doing that: var express = require("express"); var app = express(); app.get("/:string", function(req, res) { res.send(req.params.string); }); app.listen(3000); is possible supply string via form? isn't hidden parameters start with...? <form action="http://www.example.com" method="get"> <input type="hidden" name="a" value="1" /> <input type="hidden" name="b" value="2" /> <input type="hidden" name="c" value="3" /> <input type="submit" /> </form> i wouldn't count on browser re

multer - Send email with file using Nodemailer and Express -

i sending request mail using html form , nodemailer need join file email. added input type file html form. necessary upload file (using multer) before sending nodemailer ? many thanks. i used multer expres , nodemailer attachements. works fine.

docker service create image command like `docker run` -

does use docker service create command docker run -it ubuntu bash ? e.g: docker service create --name test redis bash . i want run temp container debugging on production environment in swarm mode same network. this result: user@ubuntu ~/$ docker service ps test id name image node desired state current state error bmig9qd9tihw7q1kff2bn42ab test.1 redis ubuntu ready ready 3 seconds ago 9t4za9r4gb03az3af13akpklv \_ test.1 redis ubuntu shutdown complete 4 seconds ago 1php2be7ilp7psulwp31b3ib4 \_ test.1 redis ubuntu shutdown complete 10 seconds ago drwyjdggd13n1emb66oqchmuv \_ test.1 redis ubuntu shutdown complete 15 seconds ago b1zb5ja058ni0b4c0etcnsltk \_ test.1 redis ubuntu shutdown complete 21 seconds ago when create service startup bash imediately stop because in detached mode. can have same behavior if run docker run -d ubuntu bash

drupal - How do you create (via code) your own action bar -

Image
i have created own custom module display data (as table) , want add nice action bar it. i looking on examples , did not find (like on screen below). how do (programatically)? thanks!

Coverflow android for 3 view at a time -

Image
i have show image carousel in android - in library or other libraries,what have found adjacent view visible partially , rest part covered behind screen in case part of adjacent view covered center view , partially visible left/right part. using featurecoverflow partially created kind of view apart left , right view showing stack of views - , sometime gives out of memory issue after scrolling. i have tried featurecoverflow , fancycoverflow , and few others nothing worked me. carousellayoutmanagerlibrary has done work me.

java - Establishing connection to HTTPS using client certificates -

i want upload file https-server using java. server not open url hence need client certificates establish connection. having .pem , .jks , .pkcs12 client certificate files. can 1 suggest me how use certificate files in application establish communication ? need use 3 certificate files ? the .jks file java keystore. should contain correct client certificates (and maybe intermediate certificates certificate chain). i assume going write client uploads file https server? should use .jks file client certificate (let's apache) httpclient . you need create sslcontext , load keystore sslcontext sslcontext = sslcontexts.custom().loadtrustmaterial(new file("keystore", "yourpassword".tochararray(), new trustselfsignedstrategy()).build(); then have put sslcontext in sslconnectionsocketfactory sslconnectionsocketfactory sslsf = new sslconnectionsocketfactory(sslcontext, new string[] { "tlsv1" }, null, sslconnectionsocketfactory.getdefau

javascript - window.open on a-tag for new tab -

i using code open new tab: <a href="javascript:window.open('https://example.com','_blank')">linktext</a> the new page loaded within new tab @ source page shown [object] instead of link. wrong? i not want use <a href="https://example.com" target="_blank")">linktext</a> because generate list of links , target page called differently each link. flexible way me use give syntax. edit: generated linklist: <a href="javascript:window.open('https://example.com','_blank')">linktext 1</a> <a href="javascript:jsfunc1(param1)">linktext 2</a> <a href="javascript:jsfunc2(param2,param3)">linktext 3</a> the href attribute generated. table. the point of javascript: scheme url generate replacement page javascript . isn't designed run javascript in response client while leaving page alone — event handlers for. the n

Python: How to sort a list by given value in inner dictionary? -

i have list, looks this: c = [ [129211, [{'cid': 142211, 'date': 1478550075, 'likes': {'count': 40}] [128732, [{'cid': 142061, 'date': 1478550100, 'likes': {'count': 17}] ... ] how copy of list sorted values of 'count' in 'likes' (in case it's 40 , 17)? simply use appropriate sort key. c = [ [129211, [{'cid': 142211, 'date': 1478550075, 'likes': {'count': 40}}]], [128732, [{'cid': 142061, 'date': 1478550100, 'likes': {'count': 17}}]] ] s = sorted(c, key=lambda i: i[1][0]['likes']['count']) note current list c not structured - i've repaired incorrect syntax. result: >>> import pprint >>> pprint.pprint(s) [[128732, [{'cid': 142061, 'date': 1478550100, 'likes': {'count': 17}}]], [129211, [{'cid': 142211

protocols - Are there alternatives to SIP Trunking? -

Image
i'm not sure if stackoverflow question but, to understanding sip trunking voip protocol allows person call through phoneline , datacenter convert internet call. my question is, protocol? there other protocols can used voip? there exists technology known pri. both pri (primary rate interface)and sip(session initiating protocol) used connect business public pstn networks. pri , sip both needs physical connection pstn network. problem more conventional in such way uses circuit switched model , support voice messages. sip uses existing data channel , uses packet switched model communication, can send voice , fax messages through sip. in business point of view, sip more scalable , profitable compared pri service(even though pri offers more quality voice service). traditionally fixed line vs sip configuration

Excel 2013 VBA: Changed behaviour of UBound when array is empty -

after hours of testing, found out ubound behaves differently in excel 2013 , excel 2010 when array empty: in excel 2010, ubound(emptyarray) results in 0, whereas in excel 2013 "subscript out of range" error (which expect). can confirm change in behaviour? thank you, best regards, alexander i can confirm ubound raises runtime error 9 "subscript out of range" on empty array in excel versions 95 2016. if doesn't you, it's either not ubound function you're calling (is blue in source code?) or array not empty. there slim chance office vba bug introduced @ point in v2010 , promptly fixed, not aware of it.

ios - Appium error Xcode couldn't find a provisioning profile matching 'com.facebook.WebDriverAgentRunner' -

Image
i have problem executing automation on real ios device system configuration: appium 1.6.0 device iphone 5c (ios 10.1) xcode 8.2 the exception is: [xcode] testing failed: no profiles 'com.facebook.webdriveragentrunner' found: xcode couldn't find provisioning profile matching 'com.facebook.webdriveragentrunner'. code signing required product type 'ui testing bundle' in sdk 'ios 10.1' ** test failed ** following build commands failed: check dependencies (1 failure) [xcuitest] xcodebuild exited code '65' , signal 'null' [xcuitest] error: xcodebuild failed code 65 @ subprocess.<anonymous> (lib/webdriveragent.js:294:25) @ emittwo (events.js:106:13) @ subprocess.emit (events.js:191:7) @ childprocess.<anonymous> (lib/teen_process.js:191:14) @ emittwo (events.js:106:13) @ childprocess.emit (events.js:191:7) @ process.childprocess._handle.onexit (internal/child_process.js:215:12)

javascript - TypeError: Chartist.plugins.legend is not a function -

i'm have started use meteor build tool chartist represent data. i have java script legend template (source internet) template.js function drawbarchart() { new chartist.bar('.legendchart1', { labels: ['first quarter of year', 'second quarter of year', 'third quarter of year', 'fourth quarter of year'], series: [ { "name": "money a", "data": [60000, 40000, 80000, 70000] }, { "name": "money b", "data": [40000, 30000, 70000, 65000] } ] }, { plugins: [ chartist.plugins.legend() ] }); }; template.legendtemplate.rendered = function(){ drawbarchart(); } html <template name="legendtemplate"> <div class="legendchart1"> </div> </template> and corresponding import statement as import {legend} 'chartist-plugin-legen

reactjs - connect react sfc component to redux and pass actions to it -

//test.js let test=() =>{ const handleclick=()=>{ console.log(props); this.props.addtodos('toto');// fail undefined props.addtodos('toto'); // fail props undefined } return ( <div> <button type="submit" onclick={handleclick} classname="btn btn-primary btn-md">submit</button> </div> ) } const mapdispatchtoprops = (dispatch) => { return { addtodos:addtodo } } test = connect( null, mapdispatchtoprops )(test) export default test; //actions.js import { createaction } 'redux-actions'; const add_todo='add_todo'; export const addtodo = createaction(add_todo); i'm trying connect sfc component redux , pass actions access them it, not work. , props undefined. how can achieve ?

java - (Hadoop) mkdir: Call From NameNode/192.168.21.129 to NameNode:10001 failed on connection -

when try: hadoop fs -mkdir hdfs://hname:10001/data/testfolder i get: mkdir: call hname/192.168.21.129 hname:10001 failed on connection except ion: java.net.connectexception: connection refused; more details see: http://wiki.apache.org/hadoop/connectionrefused note that: -when jps see services should on name node, , on data nodes see services should there. -i can ssh node , other node no password. -i'm running hadoop 2.7.3 on 1 name node , 3 data nodes also when try: sudo netstat -ntap | grep 9000 i get: tcp 0 0 192.168.21.129:9000 0.0.0.0:* listen 2104/java tcp 0 0 192.168.21.129:9000 192.168.21.133:36116 established 2104/java tcp 0 0 192.168.21.129:55052 192.168.21.129:9000 time_wait - tcp 0 0 192.168.21.129:9000 192.168.21.132:36236 established 2104/java tcp 0 0 192.168.21.129:9000 192.168.21.130:60798 establi

go - CORS on golang server & javascript fetch frontend -

i have golang http server code like: http.handlefunc("/login", func(w http.responsewriter, r *http.request) { log.println("new incoming request") // authenticate if u, p, ok := r.basicauth(); ok { log.println("success") return } log.println("failed") i call http endpoint js frontend, react app deployed on port 3000, using code: fetch('http://localhost:8080/login', { method: 'post', headers: { 'authorization': 'basic ' + btoa(authheader), 'content-type': 'application/x-www-form-urlencoded', 'access-control-allow-origin': '*' }, body: 'a=1&b=2' }) .then(function (response) { console.log("authentication success") }) .catch(function (err) {

android OpengL automation using expresso -

i trying perform automation testing on android application using expresso. uses opengl surface containing image changes change in sliderbar. when use sliderbar, throwing exception: e/libegl(4380):call opengl es api no context i new opengl , automation.

html - How to do mutiple css class in one line javascript code -

i have css class names - .exp-1 , .exp-2, .exp-3 , exp-4 ... there simple way write these in onlike line ,i m beginner javascript document.getelementsbyclassname("exp-1")[0]; document.getelementsbyclassname("exp-2")[0]; document.getelementsbyclassname("exp-3")[0]; document.getelementsbyclassname("exp-4")[0]; to document.getelementsbyclassname("exp-1,exp-2,exp-3, exp-4")[0]; you can use queryselector , use css selectors. returns first element of selected elements. if want return can use queryselectorall document.queryselector(".exp-1,.exp-2,.exp-3,.exp-4");

PHP: OOP connection to database use multiple -

i use code connect database class db { private $connect; public function connect(){ if(!$this->connect){ include "config.php"; echo "connect"; $this->connect = mysqli_connect($config['host'],$config['user'],$config['pass']); if($this->connect){ $select = mysqli_select_db($this->connect,$config['name']); if(!$select){ echo "not found database !"; exit(); } } else { echo "not connect database !"; exit(); } } return $this->connect; } public function query($query) { $result = $this->connect()->query($query); return $result; } } and use code connect , after select database $db = new db(); $connect = $db->connect(); $db = new db(); $way

javascript - AngularJS - Displaying multiple PNG images from buffer received from $http call -

i getting stream of information $http api call. , use extract information follows in angular js, angularjs controller: thumbnailsfactory.getthumbnails().then( function(res) { var fourbytes = 4; var twobytes = 2; var offsetval = 0; var dataview = new dataview(res, offsetval); // 4 bytes signature var sign = dataview.getint32(offsetval); offsetval += fourbytes; // 2 bytes unsupportedversionexception() - must 1 var version1 = dataview.getint16(offsetval); offsetval += twobytes; // 2 bytes thumbnailmultistream - must 1 var thumbnailstream = dataview.getint16(offsetval); offsetval += twobytes; // 2 bytes unsupportedversionexception() - must 1 var version2 = dataview.getint16(offsetval); offsetval += twobytes; // total number of images var cnt = dataview.getint32(offsetval); offsetval += fourbytes; // skip 4 bytes past offset vector position. offsetval += fourbytes; // read ids

php - Connecting android to a local server using XAMPP -

i'm trying fetch data local server android device, using free online hosting service worked fine before encountered non-related technical issues, it's not problem lies in code itself(just thought). anyway, when migrated local server using xampp, no response on app of ever, accessed php file mobile's browser , it's giving right results, app gives complete silence. searching through so, questions mentioned putting right ip address in file's url. i'm using volley , i've inserted same url with accessed file in browser, server doesn't seem respond @ all. here's php code i'm using: <?php include 'dbconnect.php'; $searchterm='d'; $query = $conn->prepare('select term,id tag term :searchterm'); $query->execute(array(':searchterm'=>$searchterm.'%')); $result=$query->fetchall(pdo::fetch_assoc); echo json_encode(array('result'=>$result)); ?> i'm using volley library contac

javascript - Accessing a form in an Angular-UI uib-tab -

if have form in uib-tab , how access (eg) validate form? here's plunker: http://plnkr.co/edit/8htccl5hamjwuchetnlq?p=preview when try access $scope.forminside it's undefined (the form inside uib-tab). if same $scope.formoutside access form validation etc. the uib-tabset has own scope, forminside on scope of uib-tabset . if use controller-as notation, find correct scope (the 1 of controller): <uib-tab index="0" heading="tab 1"> <form name="vm.forminside"> </form> </uib-tab> see this edited plunker .

r - Understanding list behaviour -

i feel have understanding of data.frames , how work, aspects of lists confusing me. here reproducible data start: list_a <- structure(list(`one` = structure(list( words = c("a", "b","c", "d", "e", "f")), .names = "words", class = "data.frame", row.names = c(na,-6l)), `two` = structure(list(words = c("a","s","t","z")), .names = "words", class = "data.frame", row.names = c(na, -4l))), .names = c("one", "two")) this gives us: list_a $one words 1 2 b 3 c 4 d 5 e 6 f $two words 1 2 s 3 t 4 z now want loop through list return of results in data.frames. list <- list() for(i in list_a){list <- append(list, list_a$i$words)} this produces no results in list. neither does: for(i in list_a){list <- append(list, list_a[[i]]$words)} error in list_a[

Use vm.$on to listen to event emitted from child in vue.js 2.0 -

i've been through vue.js events section on events seems give examples of how listen events using vm.$on handler within html. between , new changes 2.0 i'm unsure how transmit event child -> parent. i need transmit event because after parent receiving want broadcast child. i'm using single page components, setup: // parent export default { mounted: function () { this.$on('myevent', function (msg) { console.log('caught in parent', msg) }); }, components: { 'child': child, }, } // child this.$emit('myevent', true) how can receive event on parent vm please? note, don't want use $on in html. want event receiving logic in vm should be. thanks, vues documentation on $emit not comprehensive, however, there few ways this. firstly have $emit on vue model want send message if want use this.$on() , if sending component can emit direct parent using: this.$parent.$emit('myevent',true); howe

java - Android Volley Request not sending POST data to server/database -

i developing android app have been trying incorporate social media login, trying add details retrieved via social media login (name & email) , add database of users on our server via volley request. far have managed users details succesfully , add shared preferences using 'session' class created, calling method send data server not work. facebookloginbutton.registercallback(callbackmanager, new facebookcallback<loginresult>() { string fbid = null; string fbname = null; string fbemail = null; @override public void onsuccess(loginresult loginresult) { graphrequest request = graphrequest.newmerequest( loginresult.getaccesstoken(), new graphrequest.graphjsonobjectcallback() { @override public void oncompleted( jsonobject object, graphresponse response) {

javascript - In angular service call not getting value at first time issue? -

Image
here demo link here attached sample program service call. in facing problem first time not getting value properly. 1st time invocation: 2nd or more invocation: may know problem? , me fix. , why count executed first , datalength executed second? $http.get calling async default. have use promise make sync. use updated code refer plunker : var app = angular.module('myapp', []); app.controller('myctrl', ['$scope', '$location', '$filter', 'sampleservice', '$http', function ($scope, $location, $filter, sampleservice, $http) { $scope.getcount = function () { sampleservice.getfile().then(function (data) { var dt = data.prtgetslotsbysessionresult; var count = $filter('filter')(dt, { "n": null }); alert(json.stringify(count.length)); }); } }]); app.factory('sampleservice', ['$http', '$filter', '$q'

android - How to save only RealmObject but not referenced object -

in app has following realmobjects: product - act master data , should never modified. cart - shopping cart allow people pick stuff buy. content selection type. selection - represent product user selected alongside preferences such color, size, etc. use case user select product , add cart. product wrapped inside selection , stored inside cart. pick product a, b, , c. now save realm. document tells me use realmlist add relationship. makes cart -> list; selection -> product. then if use copytorealm , i'll primarykey exception on product . since want save only cart , selection , how make selection link product(for reading up) not saving it. if use copytorealmorupdate , risk accidentally updating product? you can create realmobject explicitly inside realm start, , set object link managed object inside managed object. realm.executetransaction((realm) -> { // assuming primary key selection selection = realm.where(selection.class).equalto(se

scalability - Can Apache Jena be horizontally scaled? -

we looking @ using apache jena (with fuseki , maybe sparqler) knowledge management project. can jena - or triple storage engine - run on multiple servers let horizontally scale? if can, please provide link installation guide in answer (academic papers seem plentiful in domain, while practical guides seem scarce). fuseki+tdb doesn't (nov 2016) provide horizontal scale update. there have been reports of systems have built horizontally scaling solution. coordinating updates staging server , being publishing (read-only) external clients. (if want details , discussion, jena user mailing list more reach such users)

json - How to convert js to Ko.js -

i have ajax query populate dropdownlist .the list shows names of users fetched json string. $.ajax({ url: "/home/getelement", type: "get", success: function (data) { collection = data;//global variable var option = new option("--select item--"); $('#dropdown').append(option); (var = 0; < data.length; i++) { var option = new option(data[i].name); $('#dropdown').append(option); } } }); how can convert ko.js this knock out documentation on select elements: http://knockoutjs.com/documentation/options-binding.html

javascript - MVC builds html page but does not show it -

i have problem concerning asp.net mvc. i have index.cshtml page following javascript $('#employeetable tbody').on('dblclick', 'tr', function() { var mitarbeiterid = table.row(this).data().id; $.post('@url.action("indexcompletion")', { id: mitarbeiterid }); }); this gets me id of employee , calls actionresult in controller [httppost] public actionresult indexcompletion(int id) { mitarbeiter ma = new leistungserfassungservice.leistungserfassungservice().getmitarbeiterbyid(id); return view("indexcompletion", new indexcompletionviewmodel{mitarbeiter = ma}); } now hoped show me following page: @model leistungserfassung.models.indexcompletionviewmodel @{ viewbag.title = "completion"; layout = "~/views/shared/_layout.cshtml"; } <div class="content"> <h2>completion

java - How to build a query which matches one of the phrases in Spring Elasticsearch repository -

i know if , how possible create query matches 1 of keyword phrases , not contain of stop word phrases. example: list<string> keywords = arrays.aslist("one keyword", "another one"); list<string> stopwords = arrays.aslist("dismiss this"); page<result> results = elrepository.findbykeywordsandstepwords( keywords, stopwords, new pagerequest(0, 12)); this should match documents containing 1 of exact phrases ("one keyword" or "another one") , no stop word phrases ("dismiss this"). note if document contains terms contained in phrases (eg. "another"), should not return given document result. after long research, way achieve goal. hope someone: boolquerybuilder keywordbuilder = boolquery(); keywords.foreach(k -> keywordbuilder.should(matchphrasequery("text", k))); boolquerybuilder stopwordbuilder = boolquery(); stopwords.foreach(s -> stopwor

c++ - How to wrap calls with try/catch block? -

suppose, have different functions, can throw exceptions: const foo& func_foo(...); // can throw exceptions const bar& func_bar(...); // can throw exceptions const foobar& func_foobar(...); // can throw exceptions i have different places in code, can use such functions in following way: some_func(/*applying of func_foo or func_bar or func_foobar*/(...)) actually, using result of functions in many places within different functions. what best way wrap calling of func_foo/func_bar_func_foobar functions try/catch block without global rewriting of other pieces of code? ideally want use (for example call func_foo) some_func(try_catch_block(func_foo(...))); catch handler propagate exception different types catch (const exceptionfoo& e) { throw someexception1("some message e"); } catch (const exceptionbar& e) { throw someexception2("some message e"); } i must admit find combining lambdas , macros quite fun. #defin

c# - Telerik DataAccess (OpenAccess) nullable foreign key performance -

we looking people use telerik dataaccess orm. recently, encountered big performance issue nullable foreign key. when assign value nullable int foreign key property (without savechanges) - telerik makes several calls database , strange work. used dottrace , found there lot of sql datareader calls , strange string/datetime/enum/... converters. issue appears when set value property, working ok. a little bit our environment. tried create empty console app. same strange code invoked, faster in local environment - ~60ms small entity , local db. big entity ~ 1.5 sec, but in our production server uses azure sql db - 10 50 second . remark: tried load , set object directly, without using foreign key, not help. public class entity { public int? parentid { get; set; } // wee see issue when set value parentid or parent property. savechanges not called. public parent parent { get; set; } } here can find dottrace call stack. finally, solved issue. want warn uses isman

Searching Lists of Custom Employee Objects each based on first name and last name in Java -

after doing lots of research on stackoverflow, found solution searching based on 1 attribute using overriding equals() method. my question is: have list of employee objects containing first name, last name , employee ids. arraylist.stream().filter() work java 8. need solution can work java 7. suppose, there 10 employee objects first , last names as: jam jon1 [note: first name : jam , last name : jon1] jam jon2 jam jon3 jam jon4 jam jon5 pam jin pam jin pam jin pam jin pam jin now, have 1 input i.e. jam. i want list of employee objects containing jam first name. now, have input i.e. jin. i want list of employee objects containing jin last name. i have 500 employee objects in arraylist. employee class: public class employee{ string firstname; string lastname; employee(string firstname, string lastname){ this.firstname = firstname; this.lastname = lastname; } } employee emp1 = new employee("jam","

protractor - Getting Browser died out error on clicking a Submit button on chrome driver -

am working on angular js application. have search page in select search condition , click on search. after clicking search getting below error. script working when ng-click being used button. changed form submit , getting error after change ....[14:19:45] w/element - more 1 element found locator by(css selector, [ng-click="vm.clear()"]) - first result used .f[14:19:50] e/launcher - error communicating remote browser. may have died. build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03' system info: host: '1k84lc2', ip: '10.92.244.181', os.name: 'windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_112' driver info: driver.version: remotewebdriver capabilities [{applicationcacheenabled=false, rotatable=false, mobileemulationenabled=false, networkconnectionenabled=false, chrome={chromedriverversion=2.24.417431 (9aea000394714d2fbb20 850021f6204f2256b9cf), userd

python - Perfect Binary Tree with correct data -

i having problem trying fill data perfect binary tree known number of nodes correct data. basically, have implementation creates this: 7 5 6 1 2 3 4 however, looking create tree this: 7 3 6 1 2 4 5 my current implementation inserting nodes of tree follows. def _add_node(self, val, ref = none): # reference root of tree ref = self.root if ref none else ref if ref.right none: ref.right = node(val, ref) return elif ref.left none: ref.left = node(val, ref) return else: parent = (val - 1) / 2 if parent % 2 == 0: self._add_node(val, ref.left) else: self._add_node(val, ref.right) given x nodes create tree using range(x) , calling add_node(i) each iteration. works fine except order incorrect. for life of me cannot figure out easy way set values represent bottom layout rather top. can me out? this seems issue order entering data in. how

Define vector to use for colorbar in MATLAB -

Image
i plotting bar + scatter plot scatter points colored according separate variable. problem having colorbar using wrong values @ moment. if plot scatter plot , add colorbar , range of colorbar correct. i using matlab 2016a. please find working example of code below: figure subplot(2,1,1) = 1; b = 2; r = (b-a).*rand(1,7) + a; y = r; rr = (b-a).*rand(1,7) + a; z = rr; x = [1:7]; zz = rand(1,7) yyaxis left hold on = 1:7 h=bar(i,y(i), 'facecolor',[1 1 1], 'linewidth',3); yb(i) = cat(1, h.ydata); xb(i) = bsxfun(@plus, h(1).xdata, [h.xoffset]'); if zz(i) < 0.0300000 set(h,'edgecolor','k'); elseif zz(i) < 0.050000000 set(h,'edgecolor','b'); elseif zz(i) < 0.070000000 set(h,'edgecolor','g'); else set(h,'edgecolor','r'); end end ylabel('hm', 'fontsize', 12, 'fontweight', 'bold') i1=1:7 t = tex