Posts

Showing posts from April, 2010

office365 restapi - Outlook REST API: How to page through $search results, when searching for messages -

i have troubles paging through message search results rest api. have request looking this: outlook.office.com/api/v2.0/me/messages/?$search="deni" the request returns proper result , includes 'next page' looking this: "@odata.nextlink": " https://outlook.office.com/api/v2.0/me/messages/?%24search=%22deni%22&%24top=10&%24skiptoken=at01njmzywq3os02mmjjltq5zdetodg4zc0zytgwndlhoty3nzkmcz0xma%3d%3d " i guess link url encoded url decode this: outlook.office.com/api/v2.0/me/messages/?$search="deni"&$top=10&$skiptoken=at01njmzywq3os02mmjjltq5zdetodg4zc0zytgwndlhoty3nzkmcz0xma== however, when try make request next link i'm getting 405 method not allowed following error: "the odata request not supported." i've tried in sandbox (oauthplay.azurewebsites.net) - same result. doing wrong. right way page through search results? i know there limit of 250 messages searched, not case here. have 10 , tr

c# - Should local variables be used in lambda statements when passed as delegates? -

if have method takes argument of type action , example: public void foo(action bar) { bar?.invoke(); } and wish pass lambda uses local variable, e.g.: private void someevent(object sender, someeventargs e) { foo(() => { e.cancel = true; }); } will lambda execute expected respect use of local variable, in case, e ? mean is, when foo() called , in turn attempts call lambda, know e ? or e out of scope , should following instead? private void someevent(object sender, someeventargs e) { foo((someeventargs a) => { a.cancel = true; }, e); } public void foo(action<someventargs> bar, someeventargs e) { bar?.invoke(e); } yes, should work expected. called "variable capture", , explained here . in example, e variable captured, won't go out of scope.

java - JITWatch assembly code generation -

i trying use jitwatch see how assembler code corresponds original java source code. however, jitwatch not seem see assembly code , prints following message: assembly not found. -xx:+printassembly option used? i using oracle's jre 1.8.0_121 on windows 10 home. i've added dissembly dll's jre. dll's downloaded fcml project . can confirm assembly generated when run program java -xx:+unlockdiagnosticvmoptions -xx:+printassembly test.test options. i've configured jitwatch paths *.java , *.class files visible it. jitwatch analysis run java program java -xx:+unlockdiagnosticvmoptions -xx:+traceclassloading -xx:+logcompilation -xx:+printassembly test.test , open generated .log file jitwatch. can see java code , bytecode, not assembly. suspect problem caused fact assembly printed standard output (to console) , not log file. there option missing? it bug occured when jitwatch used fcml dissassembler. prompt reaction program developer fixed now.

javascript - How to call link function method from html ng-click? -

i have following code in directive: testmodule.directive('testone',function(){ return{ replace: true, controller: 'testctrl', link: function(scope, element, attrs){ element.on('click', function(e) { //my own code there }); } } } i wanted call above click function on ng-click below event in html(ng-click="mytest()"). how can call or write can execute function requirements in above directive's element click function per requirements. html: <div test-one ng-repeat="items in testjson"> <div class="title">{{items.name}}</div> <div class="context-menu"> <ul> <li ng-click="mytest()">testfunction</li> </ul> </div> </div> thanks in advance. first make first letter of directive simple directive('testone',function(){ to directive('testone',function(){ then creat

How to change the coloring of the mode shapes in Abaqus -

Image
how can change coloring in abaqus comparable ones got matlab. appreciated. here example of custom color table abaqus cae. save in .py file , "run script" while in contour plot module. session.spectrum(name="custom",colors=(\ '#000004','#010107','#02020c','#030312','#050417','#07051d','#0a0722',\ '#0d0828','#100a2e','#130b34','#170b3b','#1b0c41','#1f0c47','#230c4d',\ '#270b52','#2c0b57','#300a5c','#350a60','#390963','#3e0965','#420a68',\ '#460b69','#4a0c6b','#4e0d6c','#530e6d','#57106d','#5b116e','#5f136e',\ '#63146e','#67166e','#6b176e','#6f196e','#731a6e','#771c6d','#7b1d6d',\ '#7f1f6c','#83206b','#87216a','#8b2369','#8f2468','#9

objective c - iOS: Why is the ViewController called when the app runs in background mode after terminated? -

i made application monitors updated location in background after terminated moves. in order implement app, made location manager class including <corelocation/corelocation.h> , cllocationmanagerdelegate , enabled 'location updates' , 'background fetch' modes in capabilities. , in order checking out, added node.js module connected remote server, , application send message remote server when new location updated in background (after terminated, not remained in suspended apps queue). , location manager declared , called in viewdidload of viewcontroller. the question why viewcontroller called when app runs in background mode after terminated above flow? thought location manager called because contains cllocationmanagerdelegate , wrong. background task started viewdidload method. dose know why happened? want know functions called beginning in background mode after terminated. edit: here codes updating current location in background after terminated. add

Split by comma and how to exclude comma from quotes in split ... Python -

python 2.7 code cstr = '"aaaa","bbbb","ccc,ddd"' newstr = cstr.split(',') print newstr # result : ['"aaaa"','"bbbb"','"ccc','ddd"' ] but, want result. result = ['"aaa"','"bbb"','"ccc,ddd"'] help.. the solution using re.split() function: import re cstr = '"aaaa","bbbb","ccc,ddd"' newstr = re.split(r',(?=")', cstr) print newstr the output: ['"aaaa"', '"bbbb"', '"ccc,ddd"'] ,(?=") - lookahead positive assertion, ensures delimiter , followed double quote "

elasticsearch - Logstash filter - half json line parse -

i'm using 'filebeat' shipper client send redis, read redis logstash , send es. i'm trying parse following example line: 09:24:01.969 watchdog - info - 100.140.2 passed: mobile:mobile[].popover["mc1814"].select(2,) :706<<<<<<<<<<<<<<<<<<< {"actionduration":613} in end want have field names: "actionduration" value: 613. as can see it's partially json. - i've tried use grok filter, add_field , match , i've tried change few configurations in filebeat , logstash. i'm using basic configurations: filebeat.conf: filebeat.prospectors: input_type: log paths: /sketch/workspace/sanity-dev-kennel/out/*.log fields: type: watchdog build_id: 82161 if there's possibility in filebeat side prefer, it's in logstash side. thanks lot, moshe this sort of partial-formatting best handled on logsta

jvm - jmap -permstat takes long time and hangs -

we started seeing 'java.lang.outofmemoryerror: permgen space'. in order findout held in perm space, tried running '/usr/j2sdk1.6.0_13/bin/jmap -permstat 20476 -j-mx1280m > /tmp/permstats20476.txt &' this command taking long time ..... in between gave below exception: finding class loader instances ..252829 intern strings occupying 30781792 bytes. finding object size using printezis bits , skipping over... finding object size using printezis bits , skipping over... finding object size using printezis bits , skipping over... finding object size using printezis bits , skipping over... done. computing per loader stat ..done. please wait.. computing liveness...................exception in thread "thread-1" java.lang.outofmemoryerror: gc overhead limit exceeded @ sun.jvm.hotspot.debugger.linux.linuxdebuggerlocal.readbytesfromprocess0(native method) @ sun.jvm.hotspot.debugger.linux.linuxdebuggerlocal.access$1000(linuxdebuggerlocal.j

android - sinch video chat not showing local view or remote view -

i have integrated sinch video chat in application based of sinch video push sample the local view , remote view show black screen , not show , generate crash in background 03-28 12:02:59.371 16607-19169/com.forsale.forsale e/logging: videocapturerandroid: java.lang.runtimeexception: fail connect camera service @ android.hardware.camera.<init>(camera.java:568) @ android.hardware.camera.open(camera.java:405) @ org.webrtc.sinch.videocapturerandroid.startcaptureoncamerathread(videocapturerandroid.java:450) @ org.webrtc.sinch.videocapturerandroid.access$1100(videocapturerandroid.java:47) @ org.webrtc.sinch.videocapturerandroid$7.run(videocapturerandroid.java:460)

reactjs - Add button Dropzone -

i have 2 components list , form. onthes components, i'm using dropzone disabled click, drag , drop possible but, on form component, add button, wich enable add dcument in browsing. in form component, call component dropzone <uploadzone onupload={this.props.oncreatedocument} onsuccessupload={this.uploadedfile} lastfileupload={this.props.lastuploadfile} /> i've added button : <raisedbutton label="add" primary={true} onclick={this.browsedz}/> browsedz = () => { } i don't know how call dropzone on button add document thank yours answers you wouldn't use dropzone part, implement yourself. use trick put button in <label htmlfor={id}> , have file input same id. you'll have 2 ways of receiving files, store latest selection user in 1 state key.

python - Calculate matrix column mean -

i've got matrix: [[[ 0.49757494 0.50242506] [ 0.50340754 0.49659246] [ 0.50785456 0.49214544] ..., [ 0.50817149 0.49182851] [ 0.50658656 0.49341344] [ 0.49419885 0.50580115]] [[ 0.117 0.883 ] [ 0.604 0.396 ] [ 1. 0. ] ..., [ 0.98559675 0.01440325] [ 0.948 0.052 ] [ 0.012 0.988 ]] [[ 0.21099179 0.78900821] [ 0.75212493 0.24787507] [ 0.96653919 0.03346081] ..., [ 0.97485074 0.02514926] [ 0.95051503 0.04948497] [ 0.05409603 0.94590397]]] if weights w1,w2,w3, how can calculate mean of first column , second column each matrix (3 2) ? can like: [[[(x1 y1] ..., [x2 y2] [[x3 y3] ..., thanks in advance. edit: input shape (3, 37375, 2), , have instead of (3,2), (1,2). mean each column, example: (0.497*w1 +

ios - Controlling SKStoreReviewController Display Frequency -

i've added following appdelegate , imported storekit. review modal pops on launch expected. question is, person in charge of frequency gets called or apple? docs still pretty light read elsewhere apple limiting 3 times year per user, can trust them add appropriate amount of time in between when displayed (ideally couple of months)? in development popping every time launch app, hate users have dismiss 3 times in many launches not asked again 12 months. now 10.3 out i'm interested in how others have tackled this. cheers. if #available(ios 10.3, *) { print("show review controller") skstorereviewcontroller.requestreview() } else { print("cannot show review controller") // fallback on earlier versions } i've added count that's stored in userdefaults . it's incremented every time action occurs, , when count % 10 == 0 call skstorereviewcontroller.requestreview() (the average user inc

maven - Is there a way to edit parent relativePath with mvn -

is there command or mechanism can edit child pom.xml files parent relativepath tag gets edited or inserted child modules? basically have aggregate pom.xml , , separate parent pom.xml . aggregator collects set of independent git submodules, independently released, not setup know aggregator nor relative location of parent, , want way automatically apply needed edits such do. aggregator/ - pom.xml - @parent/ - pom.xml - @module1/ - pom.xml the modules reference released versions of parent, want switch on -snapshot ( versions:update-child-modules handles great), , point modules @ relativepath of parent. currently hand edit files insert <relativepath>../parent</relativepath> in each parent section. the aggregator optional projects, since it's coming long after fact, can't commit hand edit changes module pom.xmls. why want dynamic mechanism people want use aggregator. it may have resort xml parser, since i'm half way th

wso2esb - WSO2 ESB Show response in Tryit console -

Image
hi using wso2 esb have created proxy named "query" work data salesforce , insert mssql database table, want show response in right response area <?xml version="1.0" encoding="utf-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="query" startonload="true" statistics="disable" trace="disable" transports="http,https"> <target> <insequence> <salesforce.init> <username>$user$</username> <password>$password$$token$</password> <loginurl>https://login.salesforce.com/services/soap/u/27.0</loginurl> </salesforce.init> <salesforce.queryall> <batchsize>200</batchsize> <querystring>select id,name,account.name,assistantname,assistantphone,birthdate,createdby.name,department

mysql - Encoding data to blob file -

i'm working blob files in mysql database, , there new data i'd encode these blob files. problem is, new data, has put in @ specific places in blob file. structure of blob files are: old blob : 4 byte id 2 byte ref , 4 byte id 2 byte ref , 4 byte id 2 byte ref , ... now have new integer number i'd encode file called link, 2 byte long. want new blob file like: new blob : 4 byte id 2 byte ref 2 byte link , 4 byt id 2 byte ref 2 byte link , ... how can done? i'm working pymysql in python correspond mysql database, i'm open fix this.

android - Collapsing card view when Recycler View scroll down -

how can put card below toolbar , collapse until disappear when scroll down , re open when scroll up i using xamarin.android design libary here axml code: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/coordinatorlayoutmainlayoutpublicationslayout" android:fitssystemwindows="true"> <android.support.design.widget.appbarlayout android:id="@+id/main.appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:fitssystemwindows="true"> <android.support.design.widget.collapsingtoolbarlayout android

r - How to capture response header of a plumber endpoint? -

is there way capture response headers of plumber based api response programmatically? here's have: library(plumber) library(futile.logger) # creating new router router <- plumber::plumber$new() # instancing filter logging request details logfilter <- expression(function(req) { # creating log entry req_data <- paste0(date(), "from ", req$remote_addr #and on) # appending log entry logger flog.info(msg = req_data, name = "mylogger") # passing request next handler forward() }) # logfilter attached router router$addfilter(name="logger", expr=logfilter) # defining function, used endpoint fun_1 <- expression(function(...) {...}) # creating endpoint @ router fun_1 router$addendpoint(verbs=c("post"), path="/fun_1", expr = fun_1) # plumbing api @ port 8000 router$run(port=8000) and i'm looking way capture , log contents , hea

python - Installing tensorflow on windows -

i'm trying install tensorflow on windows. have python3 (3.5.2) , pip3 (9.0.1): pip3 install --upgrade tensorflow collecting tensorflow not find version satisfies requirement tensorflow (from versions: ) no matching distribution found tensorflow found issue here well: tensorflow not found in pip none of solutions worked me. ideas? try following @ python command prompt: import platform platform.architecture()[0] it should display '64bit' having x86 version of python isn't enough. had same problem. thought had 64 bit installation turned out 32 bit. btw. work fine conda python 3.6 distribution. , indeed use distro gohlke page indicated guillaume jacquenot.

javascript - Menu mobile not work in internet explorer -

i have problem menu mobile in internet explorer not work - still have menu desktop viev. in chrome, firefox, opera good. mistake , can fix it? function myfunction() { var x = document.getelementbyid("mytopnav"); if (x.classname === "topnav") { x.classname += " responsive"; } else { x.classname = "topnav"; } } @media screen , (max-width:579px) { ul.topnav li {display: none;} ul.topnav li.icon { display: inline-block;} } @media screen , (max-width:579px) { ul.topnav.responsive {position: relative;} ul.topnav.responsive li.icon { position: absolute; right: 0; top: 40px; } } ul.topnav.responsive li { float: none; display: inline; } <nav id="menu"> <ul class="topnav" id="mytopnav"> <li><a class="active" data-scroll-nav='1'>home</a></li> <li><

sql server - An expression of non-boolean type specified in a context where a condition is expected, near 'NAME'.' -

my code: string sqlselectquery = " select * [kts managment] staff name=" + convert.tostring(textbox1.text); sqlcommand cmd = new sqlcommand(sqlselectquery, con); sqldatareader dr = cmd.executereader(); i error: an expression of non-boolean type specified in context condition expected, near 'name' you should always use parametrized queries avoid sql injection - still #1 vulnerability in computing. thus, code should this: string connectionstring = "......"; // typically read config file string query = "select * [kts managment] staff name = @name"; using (sqlconnection con = new sqlconnection(connectionstring)) using (sqlcommand cmd = new sqlcommand(query, con) { cmd.parameters.add("@name", sqldbtype.varchar, 100).value = textbox1.text; con.open(); using (sqldatareader dr = cmd.executereader()) { // read values sql data reader.... } con.close(); } this approach avoid error ha

tags - Tagging and Training NER dataset -

i have data set , want tag named entity recognition. dataset in persian. want know how should tag expressions : *** آقای مهدی کاظمی = mr mehdi kazemi / mr smith. >>> (names titles) should tag person or first name , last name should tagged? (i mean should tag "mr") mr >> b_per || mr >> o mehdi >> i_per || mehdi >> b_per kazemi >> i_per || kazemi >> i_per *** بیمارستان نور = noor hospital >>> should tag name or name , hospital both named entity? *** eiffel tower / ministry of defense (i mean dod example) >>> in persian called : وزارت دفاع (vezarate defa) should tag defense ? or together? there many more examples schools, movies, cities, countries and.... since use entity class before named entity. i appreciate if can me tagging dataset. i'll give examples conll 2003 training data: "mr." not tagged part of person, titles ignored. "columbia presbyte

php - make httppost in android properly -

i'm trying make android app communicates php file/database. don't working, i'm new @ kind of android programming. got tutorial: new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog,int id) { name = userinput.gettext().tostring(); httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://www.test.com/register.php"); try { list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(1); namevaluepairs.add(new basicnamevaluepair("name", name)); httppost.setentity(new urlencodedformentity(namevaluepairs)); httpresponse response = httpclient.execute(httppost); } catch (clientprotocolexception e) { // todo auto-generated catch block } catch (ioexception e) { // todo auto-generated catch block } } php code: // including database connection $name= $_post['name']; $register= "insert users (name, level) values("

Hibernate Criteria query for inheritance type joined not working -

i have 3 classes following table per class strategy @entity @table(name="parentclass") @inheritance(strategy=inheritancetype.joined) public class parentobject { @id @generatedvalue(strategy=generationtype.identity) @access(javax.persistence.accesstype.property) protected int primary_key; @manytomany(fetch=fetchtype.lazy, cascade=cascadetype.all) @jointable(name="share_with_user", joincolumns={@joincolumn(name="primary_key")} , inversejoincolumns={@joincolumn(name="userseqid")}) @notfound(action=notfoundaction.ignore) private set<user> sharedwithuser; } @entity @table public class user { @id @generatedvalue(strategy=generationtype.identity) private int userseqid; -- other fields -- } @entity @indexed @table(name="childclass") @primarykeyjoincolumn(name="primary_key") public class childobject extends parentobject { -- other fields -- } now want retrieve childobject based on sharedwith

c# - Updating the checkbox state automatically does not reflect in the GUI -

i have setting window containing observable collection of roles , components. idea here when select role on left, automatically checks components associated role on right. main problem action performed correctly behind scenes not reflected on ui. my xaml set data template display check boxes in list: <listbox name="components" itemssource="{binding components, mode=twoway}" scrollviewer.cancontentscroll="false"> <listbox.itemtemplate> <datatemplate> <checkbox content="{binding name}" foreground="{dynamicresource mainforegroundcolor}" ischecked="{binding ischecked, mode=twoway}" margin="5 5 0 0" /> </datatemplate> </listbox.itemtemplate> my viewmodel code quite simple, create selectablecomponent class hold check box state , information, , role class: public class selectablecomponent { public string name { get;

c# - Shutting down a single log4net instance -

Image
i have multiple appenders in log4net configuration, 1 logging file, , other using stored procedure. i'm able see logging file, sql data show after click "stop site", see image below: so i've come conclusion may have 'shutdown' instance doing following: log4net.logmanager.getlogger("searchparamslogger").logger.repository.shutdown(); but in doing so, seems shut down other logger. how can shut down 1 logger? i have following logger blocks: <logger name="searchparamslogger"> <level value="debug" /> <appender-ref ref="logsearchparams" /> </logger> <logger name="filelogger"> <level value="debug" /> <appender-ref ref="logfile" /> </logger> i have following appenders in .config: <appender name="logsearchparams" type="log4net.appender.adonetappender"> <buffersize value="100" /> <

python - Check if expection is raised with pytest -

this question has answer here: how assert exception gets raised in pytest? 5 answers being quite new exception test handling wondering how check if assertion raised. a.py class someerror(exception): pass class someclass(object): def __init__(self): ... raise someerror ... test_a.py from a.a import someclass def test_some_exception_raised(): ? what assertion should there check if someerror raised? using pytest. in order write assertions raised exceptions, can use pytest.raises context manager this: a.py class someerror(exception): pass class someclass(object): def __init__(self): ... raise someerror("some errror message") ... test_a.py from .a import someclass, someerror import pytest def test_some_exception_raised(): pytest.raises(someerror) excinfo:

Kong 0.10.x - JWT authentication get token access -

on kong document: https://getkong.org/plugins/jwt/#create-a-jwt-credential after step, how can access token? it's like: eyjhbgcioijiuzi1niisinr5cci6ikpxvcj9.eyjpc3mioijhmzzjmza0owiznji0owezyzlmodg5mwnimti3mjqzyyisimv4cci6mtq0mjqzmda1ncwibmjmijoxndqyndi2ndu0lcjpyxqioje0ndi0mjy0ntr9.ahumfy35gflueejroxiaado7ae6gt_8vlwx7qffhqn4 my issue: user request kong server access_token kong server result access_token user use access_token verify authentication on hosts (ex: kong:8000/products), after verified successfully, kong server points upstream_url (ex: my.api.com/products) please clear that. thank much using values returned api you'll able create token yourself. in order that, can use existing implementation 1 in node.js https://github.com/jwtk/njwt

Different Php-Fpm containers with Apache -

my production server running docker classic structure db-container, server-container , php-fpm container. what split sources in order have different containers 3 main parts of project. work old way mydomain.com/index main site, mydomain.com/api , mydomain.com/adm other services. how have setup apache virtual host in order map requests this? mydomain.com -> fcgi://sitefpm:9000 mydomain.com/api -> fcgi://apifpm:9000 mydomain.com/cms -> fcgi://cmsfpm:9000 thanks

django - Python is there a way to read custom headers and send a response back -

ok new python whole. said don't know i'm looking ask question properly. know has possible though. want ask before digging in , finding out did wrong , have over. all in want know is, front end of stack want pass down custom http headers (which can ajax calls, currently). question how read said headers? how can pass server custom headers via python. you can access custom header in django view: request.meta.get("custom_header")

Using Makefile with Terraform and split project layout -

i have terraform project layout that's similar to stage └ makefile └ terraform.tfvars └ vpc └ services └ frontend-app └ backend-app └ vars.tf └ outputs.tf └ main.tf └ data-storage └ mysql └ redis where contents of makefile similar to .phony: plan apply destroy all: plan plan: terraform plan -var-file terraform.tfvars -out terraform.tfplan apply: terraform apply -var-file terraform.tfvars destroy: terraform plan -destroy -var-file terraform.tfvars -out terraform.tfplan terraform apply terraform.tfplan as far understand it, terraform run on templates in current directory. need cd stage/services/backend-app , run terraform apply there. however able manage whole stack makefile. have not seen clean way pass arguments make . my goal have targets such as make s3 plan # verify syntax make s3 apply # apply plan unless there's better way run terraform parent directory? there sim

python - How to check if request post has been successfully posted? -

i'm using python requests module handle requests on particular website i'm crawling. i'm new http requests, understand basics. here's situation. there's form want submit , using post method requests module: # create session session = requests.session() # page witch i'm going post url session.get(url) # create dictionary containing data post postdata = { 'param1': 'data1', 'param2': 'data2', } # post session.post(submiturl, data=postdata) is there ways check if data has been posted? .status_code method way check that? if pick result when post can check status code: result = session.post(submiturl, data=postdata) if result.status_code == requests.codes.ok: # went well...

How to share data between cordova apps using cordova-plugin-file? (Android, IOS) -

i have 2 apps both should write/read txt files. logical way doing using cordova-plugin-file . however, not find directly resource explaining explicitly. the news there url called shared directory cordova.file.shareddirectory need blackberry 10. (while need them android , ios ) for android: from docs of plugin ; if sd card mounted, or if large internal storage partition available (such on nexus devices,) persistent files stored in root of space. meant cordova apps see of files available on card. if sd card not available, previous versions store data under /data/data/, isolates apps each other, may still cause data shared between users. so, far understand, if there sd card, data can shared (which cannot assume users have sd card). otherwise data of apps isolated still can shared. question how? knowing path of app enough or there restrictions reach data of other app? for ios: i'm absolutely not sure url use share data between apps.

c# - Using a class' "index"? -

how write code add 2 vectors , b using x,y , z co-ordinates. below code shows i'm struck exactly. public vector(float _x, float _y, float _z) { float x, y, z; x = _x; y = _y; z = _z; vector _vector = new vector(x, y, z); } public static vector operator +(vector _a, vector _b) { return new vector(); //_a.x + _b.x , _a.y + _b.y, _a.z + _b.z } create properties incoming parameters. can use them anywhere in class: public class vector { public float x { get; set; } public float y { get; set; } public float z { get; set; } public vector(float _x, float _y, float _z) { x = _x; y = _y; z = _z; } public static vector operator +(vector _a, vector _b) { return new vector(_a.x + _b.x, _a.y + _b.y, _a.z + _b.z); } }

MatLab (presented data) -

Image
i have imported data matlab file contains these variables: x 1x25 double vector = 100 b = 62.3000 y 50x25 matrix i want present data on scatter plot. you can pass vector first input plot , matrix (with dimension matches size of first vector) second input , create plot each pairing of first vector , each row/column of second input. plot(x, y, 'o') this automatically color each row of y differently. if you'd entire plot same color, can specify color when creating plot plot(x, y, 'o', 'color', 'black') if, however, want use scatter , you'll need make sure 2 inputs have same size. can applying repmat x make same size y xx = repmat(x, size(y, 1), 1); scatter(xx(:), y(:))

multithreading - Java IO's implements on thread variable sharing -

this question has answer here: loop doesn't see changed value without print statement 1 answer i confused code snippet this: public class learntest { private static boolean tag = true; private static int = 0; public static void main(string[] args) { new thread(new runnable() { @override public void run() { while (tag) { //system.out.println("ok"); i++; } } }).start(); try { thread.sleep(1000); }catch (exception e) { e.printstacktrace(); } tag = false; system.out.println(i); } } in code, have new-thread , main-thread .the result code random value of i , new-thread not exit.because new-thread not new tag value. if change define of tag decorated volatile , print value of i , new-thread exit. because volatile kee

javascript - LDAP Query originating from client-side "onload" -

i have asked previous questions think got far pre-conceived notions ruled out other options. i'm going start over: i have tools developed , maintained in html , javascript. automate collection of user data. users filling in information , storing them in cookies 6 months. however, if can have them skip step of manually inputting information it'll small time savings. if i'm going using server-side i'll using microsoft web server 2012 iis 8.5. what know is: best approach in terms of language? is best approach client ajax call asp.net page writes user data json format? should try authenticated queries or non-authenticated queries? i'm lost. i need recommendations , guidance , how started/what need learn. update: clear, i'm looking solution external existing code. can access externally (e.g. ajax comes mind) , have spit (ad data point indicators): givenname, sn, displayname, telephonenumber, title. there multiple layers this. orde

java - Spring Boot load beans from context xml in library -

i have 2 applications: application child : it's spring app xml schema-based configuration. have applicationcontext.xml . application parent : spring boot app. uses application child library. is possible load beans defined in child xml, , put them parent context? yes possible. from javadoc : as mentioned above, @configuration classes may declared regular spring definitions within spring xml files. it possible import spring xml configuration files @configuration classes using @importresource annotation . bean definitions imported xml can injected using @autowired or @import. here example same javadoc mix beans loaded xml in beans defined in configuration class: @configuration @importresource("classpath:/com/acme/database-config.xml") public class appconfig { @inject datasource datasource; // xml @bean public mybean mybean() { // inject xml-defined datasource bean return new mybean(this.datasource);

How can I remove a footer element using Javascript -

i have html: <footer class="footer"> <div class="container-fluid wrapper"> ... </div> </footer> how remove whole footer markup using javascript (no jquery available)? i've tried: var elem = document.getelementsbyname("footer"); elem.remove(); ...and couple of other variations, can't delete. any ideas? thanks, mark yes, can this function removetagbytagname(tagname) { var ele = document.getelementsbytagname(tagname); return ele[0].parentnode.removechild(ele[0]); } function removetag(tag) { var ele = document.getelementsbytagname(tag); return ele[0].parentnode.removechild(ele[0]); } var btn = document.getelementbyid("delet"); btn.addeventlistener("click", function(){ removetagbytagname("footer"); }); <body> <button id="delet">delete footer!</button> <footer class="footer" name="fo

c# - IOException was unhandled -

this question has answer here: how find out process locking file using .net? 7 answers i'm working files on c#, cose supposed delete lines file mentioned here: var tmpfile = path.gettempfilename(); var linestokeep = file.readlines(path).where(l => l.startswith("removeme")==false); file.writealllines(tmpfile, linestokeep); file.delete(path); file.move(tmpfile,path); but i'm getting exception: ioexception unhandled when running code saying: the process can not access file because being used process in instruction: file.delete(path); how can check process using file, or there reason problem? use fileshare enumeration instruct os allow other processes (or other parts of own process) access same file concurrently. using (var stream = file.open(path, filemode.open, fileaccess.write, fileshare.read)) { }

javascript - Toggle code not working in IE11 -

here code class called toggle, toggles multiple components in site. html has data attribute on called data-expand-content, , css set when data-expand-content true, display: block or whatever content. , js toggles data attribute on click. works fine on browsers except ie11, please me figure out wrong? thanks! here's js class toggle { constructor(control, el) { const togglelink = document.queryselector('.primary-nav__toggle-link'); control = document.queryselector(control); el = document.queryselector(el); if(el) { control.addeventlistener('click', function(e) { if(el.dataset.expandcontent == "false") { el.dataset.expandcontent = "true" if(e.target == document.queryselector('.primary-nav__toggle-icon')) { document.queryselector('.primary-nav__toggle-icon').setattribute('src', '../asset

android - ExtendedCalendarView PerformClick OnCreate -

i using extendedcalendarview library. reason, need current date automatically click can called getscheduledetails(day); once app open. know can use performclick . not sure should put code. cal.setondayclicklistener(new ondayclicklistener() { @override public void ondayclicked(adapterview<?> adapter, view view, int position, long id, day day) { getscheduledetails(day); });

android - How to use different percent values for guidelines in ConstraintLayout? -

i use constraint layout in activity , set different percent values guidelines (app:layout_constraintguide_percent="0.5"). want put values different dimens files (dimens-lands, dimens-sw600dp etc.) problem can't find way how put percent value dimens.xml. there way how keep different percent values multiple screens in res/? how percents declared - float value: <android.support.constraint.guideline android:id="@+id/center_guideline" style="@style/layout.guideline" android:orientation="vertical" app:layout_constraintguide_percent="0.5" /> in end found out way how store value decimal point (float) in res/values. must stored way: <resources> <item format="float" name="guideline_right" type="dimen">0.84</item> </resources>

c# - replace string with double quotes -

i want replace, json file :"[" :[" the below runs without delivering expected.any clues?(i looked in similar questions, more confused) string contenty = contentx.replace(":"["",":[""); return contentx; you're returning contentx instead of contenty . contenty variable has new string.

php - XDebug not profiling POST -

how can configure xdebug profile all requests, post, get, ajax, , without query string parameters? the current configuration (below) creating profile (cachegrind.out) files requests , post requests don't have query string parameters. /etc/php5/apache2/conf.d/20-xdebug.ini zend_extension = /usr/lib/php5/20121212/xdebug.so xdebug.profiler_enable_trigger = 1 xdebug.profiler_enable = 0 xdebug.profiler_append = 0 conf.d/my.conf <directory "/var/www/html/sub"> # limit profiling files in directory rewriteengine on rewriterule (.*\.php) $1?xdebug_profile=1 [qsa,l] </directory> ubuntu 14.04.5 lts php version 5.5.9-1ubuntu4.21 xdebug version 2.5.1 the source of problem profile file post request being overwritten next request client side redirect. solution use different profiler output filename ref: https://bugs.xdebug.org/view.php?id=1445 xdebug.profiler_output_name=cachegrind.out.%s many xdebu

prestashop - Remove/hide category bar from custom page -

Image
i have registered new controller in order display new page. works fine able hide left column calling: public function init() { $this->page_name = 'my products'; $this->disableblocks(); parent::init(); } protected function disableblocks() { $this->display_column_left = false; } in controller. although still have bar present: how can hide current controller (only custom one)? of course prefered way using hooks or something, not override template in theme. there maybe other way define layout controller page. directly backend. go on modules -> position , form: "blocktopmenu". hook "displaytop", go edit , select page in not want appear

php - Laravel Homestead Hangs on SSH Auth Method -

i'm having issue laravel homestead on windows 7. when run vagrant it's hanging on: ssh auth method: private key not sure why is. i've tried number of solutions. here auth stuff homestead.yaml file: authorize: c:/users/kim.ward/.ssh/id_rsa.pub keys: - c:/users/kim.ward/.ssh/id_rsa i have tried: authorize: ~/.ssh/id_rsa.pub keys: - ~/.ssh/id_rsa i've attempted adding: config.ssh.private_key_path = "c:/users/kim.ward/.ssh/id_rsa" and: config.ssh.username = "vagrant" config.ssh.password = "vagrant" i can confirm virtualisation enabled , i'm using i5 6500. if check virtual box while box booting , can see in preview window login prompt. can double click instance in virtual box , it'll open , allow me login doesn't set process complete. i using virtual box version 5.1.18 , vagrant v1.9.1. have tried various other minor versions. any appreciated. i'm running out of ideas point. thanks,

javascript - How to select default options from multiple select boxes using select2 -

in code there 3 different select box. when selectbox clicked, others receive default value 1 select box active. <select class="form-control select2" style="width: 100%;" id="seleciona_combo"> <option value="a">select food</option> <option>aba</option> </select> <select disabled class="form-control select2" style="width: 100%;" id="seleciona_produto"> <option value="b">select drink</option> </select> <select class="form-control select2" style="width: 100%;" id="seleciona_adicionais"> <option value="c">select add</option> <option>oi</option> </select> javascript: $("#seleciona_combo").on("change", function(){ $("#seleciona_produto").select2().select2('val','b'); $("#selecion

amazon ec2 - Max connection pool size and autoscaling group -

in sequelize.js should configure max connection pool size (default 5). don't know how deal configuration work on autoscaling platform in aws. the aurora db cluster on r3.2xlarge allows 2000 max connections per read replica (you can running select @@max_connections;). the problem don't know should right configuration each server hosted on our ec2s. should right max connection pool size don't know how many servers launched autoscaling group? normally, db max_connections value should divided number of connection pools (one server), don't know how many server instantiated @ end. our concurrent users count estimated between 50000 , 75000 concurrent users @ our release date. did previous experience kind of situation? it has been 6 weeks since asked, since got involved in thought share experience. the answer various based on how application works , performs. plus characteristics of application under load instance type. 1) want pool size > expected

How to pass MSBuild arguments for mutliple projects in TFS Build definition -

Image
i trying pass different msbuild arguments 2 projects in tfs build definition. i building single solution 2 projects in it. able pass msbuild arguments without specifying projects , it's working. both projects building correctly. now, want pass msbuild arguments separately both projects because have different arguments value both project. not able that. if pass msbuild arguments below, common both project, it's working both project building correctly. /p:deployonbuild=true /p:packagetemprootdir=\release /p:deployiisapppath="default web site";defaultpackagefilename=api.zip /p:outputpath="$(build.binariesdirectory)\$(buildplatform)\$(buildconfiguration)" if pass msbuild arguments separate both projects, /t:project1 /p:deployonbuild=true /p:packagetemprootdir=\release /p:deployiisapppath="default web site"; defaultpackagefilename=api.zip /p:outputpath="$(build.binariesdirectory)\$(buildplatform)\$(buildconfigurat

Excel VBA - multi level sorting -

Image
how change code below sort in multi level way? @ present, code sorts table 1 column @ time, want sort multi level sort. below im trying achieve: here's code sorts table 1 column @ time: range("a4:l" & lastrow).sort key1:=range("a4:a" & lastrow), _ order1:=xlascending, header:=xlno range("a4:l" & lastrow).sort key1:=range("b4:b" & lastrow), _ order1:=xlascending, header:=xlno range("a4:l" & lastrow).sort key1:=range("c4:c" & lastrow), _ order1:=xlascending, header:=xlno range("a4:l" & lastrow).sort key1:=range("d4:d" & lastrow), _ order1:=xlascending, header:=xlno range("a4:l" & lastrow).sort key1:=range("e4:e" & lastrow), _ order1:=xlascending, header:=xlno how change above sort together? i recommend getting rid of recorded .sort method in favor of 'only need' vba sort code. however, there prob

node.js - Update react state after removing Mongoose record -

need little how update state after removing mongo database record mongoose. you should able see whats happening code below, working fine, issue 'remove action'. removing record database need refresh see changes. i rerun 'get characters' function in then of remove action, update state expected not sure how this. on page load: componentdidmount() { adminstore.listen(this.onchange); adminactions.getcharactercount(); adminactions.getcharacters('http://localhost:3000/api/characters'); } action - ajax request query url, send response store getcharacters(query) { requestpromise(query) .then((res) => { var opdata = json.parse(res); this.actions.getcharacterssuccess(opdata.characters); }).catch((err) => { console.log('error:', err); this.actions.getcharactersfail(err) }) } store - save response action ajax query in state 'characters' getcharacterssuc

javascript - How to change variable boolean value according to the existence of an asset in the folder? -

i know if there way change value of variable true or false if asset requested in function not in folder. for example: ctaurl = "url('initialframes/cta.png')"; nocta = "url('initialframes/nocta.png') no-repeat"; if (ctaurl) { needcta = true; cta.style.background = ctaurl; } else { cta.onerror = function () { document.getelementbyid(cta).src = nocta; cta.style.display = "none"; needcta = false; } } // cta.style.width = ctaw + "px" cta.style.height = ctah + "px" // switch(ctahorpos) { case "left": cta.style.left = "0px"; cta.style.right = "auto"; break; case "right": cta.style.left = "auto"; cta.style.right = "0px"; break; default: var ctadistw = (stagew-ctaw)/2 cta.style.lef

Create Image Search engine from multiple sources -

good morning! have project in mind , i'm doing research, know there's websites include google image search on own web app, , maybe other sources. what need the idea collect , display images copyright free used users in web app, various places , not google images only. problem the very few tutorials i've seen around have small problem, use google images , it's impossible serve copyright free images. when copyright free images mean images can used lucrative purposes without incurring in copyright legal problems. solution i'm bit lost here. i'd if point me @ somewhere can start, read give me idea how should approach project. thanks in advance

sql server - In sql, how to filter records in two joined tables -

i output invoices made of info in 2 separate data tables linked unique id #. need update service provided in group of invoices (service info contained in table_b) date period (date info contained in table_a). here's 2 tables joining table_a id------|name-----------------|date----------|total--------| 1-------|--abc company--------|--1/1/17------|--$50--------| 2-------|--john smith---------|--3/1/17------|--$240-------| 3-------|--mary jones---------|--2/1/16------|--$320-------| 1-------|--abc company--------|--8/1/16------|--$500-------| table_b table_id (= id table_a)----|-service-----------|unit price--|qty------| 1--------------------------|--service a--------|--$50.00----|--10-----| -- 2--------------------------|--service b--------|--$20.00----|--12-----| -- 3--------------------------|--service b--------|--$20.00----|--16-----| -- 1

php - How to randomize an array without duplicating an integer -

for example if have this: <?php $b = array(100); ($i = 1; $i <= 100; $i++) { $b[$i]=$i; } ?> how randomize numbers without duplicating them? your approach work if shuffle array: for ($i = 1; $i <= 100; $i++) { //$b = array(100); //why here? $b[$i] = $i; } shuffle($b); however it's simpler: $b = range(1, 100); shuffle($b);