Posts

Showing posts from September, 2013

php - Looks like javascript doesn't recognize new elements after ajax call -

i got element loads data in according block clicked. using ajax load entire phpfile inside index after variable sent it. for example: block 1 clicked, $block (containing string: block1) sent php script place $block in query retrieve correct data. after load result on index. this works should javascript functionalities broken. when add php script in index , don't retrieve using ajax add word manually (where $block be) javascript works fine. so seems when result loaded, javascript finished or doesn't recognize it. how can fix that? my code retrieve it: $('.handmouse').on('click', function(e){ var alias = $(this).attr("data-attribute"); var clicked = true; $.post("ajax/blokken.php", { dienstnaam : alias }, function(data) { $(".tabwrapper").html(data); }); $('.tabwrapper').slidetoggle(); if(clicked != true){ $('html, bod

r - add a column in data table using for loop -

i have data.table called md looks this group_1 group_2 b b b c c i use following code: groups <- c("group_1","group_2") (group in groups) { md[!get(group)=="a",get(group):="b"] md[,get(group):=factor(x = get(group),levels = c("a","b"),ordered = t)] } so want both columns in data.table if value every row not "a" replace value "b" , add ordered levels it. but error error in get(group): object 'group_1' not found any ideas ? another option using set for(group in groups){ set(md, = which(md[[group]] !='a'), j = group, value = 'b') set(md, = null, j = group, value = factor(md[[group]], levels = c('a', 'b'), ordered = true)) } md # group_1 group_2 #1: #2: b #3: b b #4: b b

c# - XML Validation: How to detect if an xsd was specified? -

i validate xml files against internal referenced xsd files using xmlreader following xmlreadersettings : settings.dtdprocessing = dtdprocessing.ignore; settings.validationtype = validationtype.schema; settings.validationflags |= system.xml.schema.xmlschemavalidationflags.reportvalidationwarnings; settings.validationflags |= system.xml.schema.xmlschemavalidationflags.processinlineschema; settings.validationflags |= system.xml.schema.xmlschemavalidationflags.processschemalocation; this works fine long there xsd file referenced. if not validation event handler print error message every element complaining missing schema information. know correct behavior not useful user. i detect if xsd given , if not, display 1 error message says "no scheme given". is there simple solution besides error message parsing or hacks that? use xmlreader if possible , not loading whole document beforehand check schema reference. if way, let me know. my current approach use custom xmlre

c# - Umbraco Web API - Cookie Authentication -

i'm using umbraco 7.5 owin startup class. despite shortcomings using cookie auth, i'm trying share cookie auth between both mvc , web api. i have in owin startup class: private static void configureauth(iappbuilder app) { app.setdefaultsigninasauthenticationtype(cookieauthenticationdefaults.authenticationtype); cookiesecureoption securecookieoption = cookiesecureoption.sameasrequest; #if debug securecookieoption = cookiesecureoption.never; #endif app.usecookieauthentication(new cookieauthenticationoptions { authenticationtype = cookieauthenticationdefaults.authenticationtype, authenticationmode = authenticationmode.active, loginpath = new pathstring("/account/login"), cookiesecure = securecookieoption, cookiemanager = new chunkingcookiemanager(), provider = new cookieauthenticationprovider() }, pipelinestage.authenticate); //configure b2c oauth middleware foreach (string p

ruby - Why does `where` give an "undefined method" error in Rails? -

i'm trying feedbacks specific attribute. using code: def index feedbacks = feedback.all if params[:tag] @average_customer_rating = feedbacks.where('buyer_feedback_date not null').rated(feedback::from_buyers).average(:buyer_rating) || 0 @products = product.includes(:images).tagged_with(params[:tag]).order('desc').limit(22) else @products = product.includes(:images).all @average_customer_rating = feedbacks.where('buyer_feedback_date not null').rated(feedback::from_buyers).average(:buyer_rating) || 0 end end and rails shows error: undefined method `where' []:array why can't use where here , how fix it? in rails 3.x, all returns array: feedbacks = feedback.all # <- array feedbacks.where(...) # <- fails to activerecord::relation , have use scoped : feedbacks = feedback.scoped # <- activerecord::relation feedbacks.where(...) # <- works see working scopes more examples. n

asp.net mvc - SSO IdentityServer3 Authentication and MVC -

i have mvc 4.5 project have multiple domains, example: https:// domain1 .com (secured ssl) http:// domain2 .com http:// domain3 .com only secure domain ( https://domain1.com ) used authorize users. after signing in, users should authenticated across other domains. what did achieve this: have installed identity server , made work perfectly. still wonder if possible achieve following scenario: the user logs in in (domain1.com) asp identity. a cookie created user , authenticated in authorizations server (domain1.com). now, when user comes domain2.com (the client app), gets redirected identityserver3's authorize endpoint, instead of being automatically authenticated. is there way can authorize user directly if had logged in asp identity? really appreciate help. iyad you can setup domain 2 , 3 implicit javascript client , see sample , doesn't sign users in automatically when navigate sites after they've signed in on domain 1, have implement ow

How to hide button according to user login in asp.net -

Image
i have sort of problem hide button after user login. below snap/image explains problem: check image in above image, see both user i.e "wajid" , "aamir" have visible of edit button. now want if "wajid" login edit button show wajid not "aamir". during login session is: session["username"] i tried this, not work: string sessionname=session["username"].tostring(); if (sessionname == firstname) { (int = 0; <dealpointscommentlist1.items.count; i++) { edit =(linkbutton)dealpointscommentlist1.items[i].findcontrol("editcommentlnkbtn"); edit.visible =true; } } else { (int = 0; < dealpointscommentlist1.items.count; i++) { edit =(linkbutton)dealpointscommentlist1.items[i].findcontrol("editcommentlnkbtn"); } edit.visible = false; } kindly reply me , provide sort of example. try code. st

jsf - Session bean timeout issues -

this question has answer here: javax.faces.application.viewexpiredexception: view not restored 10 answers how implement login filter in jsf? 1 answer so because jsf managed beans session scoped, whenever session expires due idleness(e.g. user leaving screen unattended) then, gives exception. jsf/jee based solution this?( no jsp or servlets please) edit:i dont want exceptions show user, , maybe have sort of redirect login page or "your session has expired" message..whatever feasible.

C#: Debug.Assert() in Release-Build-DLL seems to be activated by Debug-Build-Project -

i have dll lot of debug.assert() calls. have built dll release, assert not active (i checked small test programm). use dll in software project debug-build , reason asserts dll active again. debug definition of project reactivate asserts in dll? (visualstudio 2013) the documentation states: when c# compiler encounters #if directive, followed #endif directive, compile code between directives if specified symbol defined. considering should not see these asserts, because when compiling in release mode code should have been left out. you try decompile release assembly , see if code generated.

scala - Read data from Cassandra for processing in Flink -

i have process data streams kafka using flink streaming engine. analysis on data, need query tables in cassandra. best way this? have been looking examples in scala such cases. couldn't find any.how can data cassandra read in flink using scala programming language? read & write data cassandra using apache flink java api has question on same lines. has multiple approaches mentioned in answers. know best approach in case. also, of examples available in java. looking scala examples. i think should cover basics. https://ci.apache.org/projects/flink/flink-docs-release-1.2/dev/connectors/cassandra.html

Javascript - Display videoID using Youtube Data API -

Image
trying work through program have, unable view videoid search query. have following code @ moment: function makerequest() { var q = $('#query').val(); var request = gapi.client.youtube.search.list({ q: q, part: 'snippet', maxresults: 20 }); } request.execute(function(response) { $('#results').empty() var srchitems = response.result.items; $.each(srchitems, function(index, item){ vidtitle = item.snippet.title; vidthumburl = item.snippet.thumbnails.default.url; vidthumbimg = '<pre><img id="thumb" src="' + vidthumburl + '" alt="no image available." style="width:102px;height:64px"></pre>'; vidid = item.id.videoid; $('#results').append('<pre>' + vidtitle + vidthumbimg + vidid+ '</pre>'); }) }) looking @ last 2 substantial lines, thought code enough display videoi

regex - How can I split a string delimited with multiple characters? -

this question has answer here: split string space , character delimiter in oracle regexp_substr 5 answers i'm trying split string that's delimited "space-quote-space" ( ' ) between values. the regex run in oracle pl/sql select statement, but believe it's pretty regex allows the strings this: fina 233ff ' bla 33333333 ' fred ' o'gladson ' 99 left rd ' flinders mi ' 9999 ' 0499999999 ' here notes $9999.00 old thing sd2232dd (left) pls see john while can split string based on single quote easy enough - [^']+ ...it hits quote in middle of surname (o'gladson). make easier can add in single quote on start or end. can trim results afterward, if can split right. what's correct regex? i think need : ([:space:]''[:space:]) //single quote need escaped

how to call a php function when we open the page -

/*the function fetches data database */public function allclients() { try { $stmt = $this->conn->query("select * client"); $results = $stmt->fetchall(pdo::fetch_assoc); return $results; } } catch(pdoexception $e) { echo $e->getmessage(); } } this next page function called.i have used fetch button:'btn-signup' want display data in table without using button how do that. $client2 = new client2(); if (isset($_post['btn-signup'])) { try { $results=$client2->allclients(); foreach(array ($results) $row) { $id = $row['id']; $name = $row['name']; $email = $row['email']; echo $id."\t\t"; echo $name."\t\t"; echo $email; echo "\n\n"; } } catch(pdoexception $e) { echo $e->g

Trouble with setTimeout in javascript for MaxMSP -

i've looked @ quite few other questions can't seem fix issue settimeout so i've been working on , came this, reason settimeout not work, tips? function curves(val_name, mini, maxi, t_amount, steps) { //t_amount must in ms (x = 0; x < steps; x++) { var x_mod = scale(x, -6, 0, 0, steps); var value = settimeout(calculate_curve, (t_amount / steps), x_mod); switch (val_name) { case "vol_stretch1": var vol_stretch1 = this.patcher.getnamed("stretching").subpatcher(0).getnamed("vol_stretch1"); vol_stretch1 = value break; case "vol_stretch2": var vol_stretch2 = this.patcher.getnamed("stretching").subpatcher(0).getnamed("vol_stretch2"); vol_stretch2 = value break; case "vol_stretch3": var vol_stretch3 = this.patcher.getnamed(&

c# - Convert Linq expression "obj => obj.Prop" into "parent => parent.obj.Prop" -

i have existing expression of type expression<func<t, object>> ; contains values cust => cust.name . i have parent class field of type t . need method accepts above parameter , generates new expression takes parent class ( tmodel ) parameter. used expression parameter of mvc method. thus, cust => cust.name becomes parent => parent.customer.name . likewise, cust => cust.address.state becomes parent => parent.customer.address.state . here's initial version: //note: fielddefinition object contains first expression //described above, plus memberinfo object property/field //in question public expression<func<tmodel, object>> expressionfromfield<tmodel>(fielddefinition<t> field) tmodel: basemodel<t> { var param = expression.parameter(typeof(tmodel), "t"); //note in next line "nameof(selecteditem)". reference //to property in tmodel contains ins

kibana - Filebeat / Logstash initial ingestion + continued workload -

i new elk stack , trying make things bit easier, have few fuelphp instances have own app logs within them. trying aggregate logs elk can searched on , visualised. i have set filebeat process on server in question, , set separate server logstash , elasticsearch. seems working until starts harverster each application log file. have 6 projects have years worth of logs in format: /yyyy/mm/d.log i trying ingest of them start with, watching latest, keep hitting too many files open issues, due registry holding store, when files closed due inactivity, if make adjustment config , restart reopen again. here snippet of filebeat.yml: # list of prospectors fetch data. filebeat.prospectors: # each - prospector. options can set @ prospector level, # can use different prospectors various configurations. # below prospector specific configurations. # type of files. based on way file read decided. # different types cannot mixed in 1 prospector # # possible options are: # * log: reads ever

spring - @initbinder not getting invoked for few parameters -

i'm working on spring application , using @initbinder in controller form submission. working first 2 parameters remaining propertyeditors not getting invoked. initbinder @initbinder public void initbinder(webdatabinder binder) { simpledateformat sdf = new simpledateformat("dd/mm/yyyy"); sdf.setlenient(true); binder.registercustomeditor(date.class, new customdateeditor(sdf, true)); binder.registercustomeditor(systemrole.class, new systemroleeditor(systemroledao)); /* below editors not called */ binder.registercustomeditor(designation.class,new designationeditor(designationdao)); binder.registercustomeditor(domain.class, new domaineditor(domaindao)); binder.registercustomeditor(employeetype.class, new employeetypeeditor(employeetypedao)); binder.registercustomeditor(grade.class,new gradeeditor(gradedao)); binder.registercustomeditor(teamrole.class, new teamroleeditor(teamroledao))

java - Keycloak + Spring Security, through local login form -

good day, dear stackoverflow community (and too, jon skeet, may answer question , free me of burden, messiah). i trying integrate keycloak spring security layer. have achieved that, issue have yet solve following: when endpoint hit, requires user authenticated, site redirects keycloak login page. after login, user redirected page requested. im trying achieve is: do not want users redirecting app keycloak login page , , again, better yet, login through form on app , "proxy" captured details keycloak , login token back. if can shed light on above, whether possible or not, , if so, direction solution smashing. pom.xml: <dependency> <groupid>org.keycloak</groupid> <artifactid>keycloak-spring-boot-adapter</artifactid> <version>2.4.0.final</version> </dependency> <dependency> <groupid>org.keycloak</groupid> <artifactid>keycloak-tomcat8-adapter&l

Java Stripe API -

i'm trying bind token customer card. so, token has been created stripe.js . so, send code on backend service , i'm trying set customer's cards: card card = token.retrieve(id).getcard(); so, once i've got token card, i'm trying it: customer.retrieve(this.customer).getsources().create(card.getmetadata()) nevertheless, i'm getting compilation error: the method create(map) in type externalaccountcollection not applicable arguments (map) any ideas? you can find documentation adding card existing customer object here: https://stripe.com/docs/api/java#create_card . the correct code be: customer customer = customer.retrieve(this.customer); map<string, object> params = new hashmap<string, object>(); params.put("source", id); card card = customer.getsources().create(params);

Excel - VLOOKUP with 2 conditions? -

Image
wondering if can help. have 2 tables. first 1 has list of dates each vendor work against team leader name. displaying only: dates worked (a) .... vendor name (b) .... team leader (c) table has got 400 lines. the second table has list of donations each vendor did per day. vendors has got 5 or 6 items per day. table pretty similar first one, because team leader change 1 day another, 1 vendor may 2 or 3 different leaders every week (but 1 on day). table has got 10.000 lines. so columns of table are: dates worked (g) .... vendor name (j) .... team leader (k) but k column not populated. need formula goes on k column: if (g)=(a) , (j)=(b) return value (c) (k) can this? cheer, bruno you should able use array version of index:match formula: =index(a:c,match(g1&j1,a:a&b:b,0),3) note: formula must entered ctrl+shift+enter

java - Download a folder to internal storage and list the folder items in separate listview -

in application, want download folder , store internal storage,that folder contains sample.text, sample.jpg, sample.pdf , sample.mp4. want store each file type particular folder. example, .text files go text folder. my question was how download folder how list folder items in separate listview ( sample.text file go textlist,sample.pdf go pdflist etc.. ) please me!! its simple file extension use switch statement , store specific file in specific folder. string ext= getfileextension(string fileurl) { case ".jpg" : storefile("d:/images"); break; . . . . .//and on }

javascript - Convert numeric string to number in angular 2 -

i want compare angular 2 expressions. got array of data in numeric string database need convert number before give condition ngclass styling. how can convert type. idea? <td [ngclass]= "{'positive': gbh.last > 0, 'negative': gbh.last < 0}"> {{gbh.last}} </td> as far know, can not convert numeric string number inside angular expression. the best practice define method in controller solve expression using ' parseint ' function ispositive (x: string, y: number): boolean { return (parseint(x, 10) < y); }

multithreading - Jobs in powershell -

i using ps-session run console application on remote machine. not want pass control next statement until console application executed. how pass control on console application in powershell? multi-threading option? or need create jobs same? this command using: invoke-command -session $session -scriptblock {start-process $args[0] -argumentlist $args[1] -redirectstandardoutput $args[2] -redirectstandarderror $args[3]} -args $dir,$arguments,$stdoutlog,$stderrlog; here dir consoledirectory(d:\temp\consoleapp.exe) also, if use -wait command, console application executed control never returns powershell.

dependency injection - angular 2 pass variable from injectable to component -

i wrote http interceptor in order catch 5xx errors server. idea in app.component.html have component (bad-response) must displayed if there 5xx error. in interceptor can check whether there error. how can pass information "bad-response" component? i've tried create service, injected in component getting variable value , in interceptor setting it, no luck. app.component.html <top-nav></top-nav> <router-outlet></router-outlet> <bad-response></bad-response> //need pass info 5xx error here interceptor.ts @injectable() export class interceptedhttp extends http { constructor(backend: connectionbackend, defaultoptions: requestoptions) { super(backend, defaultoptions); } request(url: string | request, options?: requestoptionsargs): observable<response> { return super.request(url, options); } get(url: string, options?: requestoptionsargs): observable<response> { super.get(url, this.getrequestopt

autologin - Auto login Rocket.Chat with LDAP -

i integrating rocket.chat system share user account through ldap database. created shortcut go rocket.chat our system, when user click shortcut, our system open rocket.chat page url type: http://rocketchat.host:3000/?username={username}&password={password} username , password current account. we changed on compiled bundle of rocket.chat: // changed file: {bundle}\programs\web.browser\head.html <title>rocket.chat</title> <meta charset="utf-8" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="expires" content="-1" /> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="fragment" content="!" /> <meta name="distribution" content="global" /> <meta name="rating" content="general" /> <meta name="viewport" content="width=devic

hash - The same content file, the MD5 value is different -

as know,the md5 of 2 different files(even if contents same) different,just this: [langshiquan@cp01-rdqa-dev002.cp01.baidu.com md5test]$ ll total 16 drwxrwxr-x 7 langshiquan langshiquan 4096 mar 28 19:41 output drwxrwxr-x 3 langshiquan langshiquan 4096 mar 28 19:44 test -rw-rw-r-- 1 langshiquan langshiquan 100 mar 28 19:54 test.sh -rw-rw-r-- 1 langshiquan langshiquan 69 mar 28 19:48 test.sh~ [langshiquan@cp01-rdqa-dev002.cp01.baidu.com md5test]$ sh test.sh [langshiquan@cp01-rdqa-dev002.cp01.baidu.com md5test]$ md5sum output.tar 2b7f05590cd4c8665dd61bbf745bbeee output.tar [langshiquan@cp01-rdqa-dev002.cp01.baidu.com md5test]$ sh test.sh [langshiquan@cp01-rdqa-dev002.cp01.baidu.com md5test]$ ll total 18212 drwxrwxr-x 7 langshiquan langshiquan 4096 mar 28 19:41 output -rw-rw-r-- 1 langshiquan langshiquan 18606080 mar 28 19:54 output.tar drwxrwxr-x 3 langshiquan langshiquan 4096 mar 28 19:44 test -rw-rw-r-- 1 langshiquan langshiquan 100 mar 28 19:54 test.sh -r

c# - entity framework core visualize entity -

i getting started project using entity framework core. task visualization of entities in code first. i have created .net core project in vs2015 , created db context file inherit dbcontext. have installed entity framework power tool. when trying right click context file , view visualized model get: a constructor not found. cannot find appropriate constructor type. i have looked answer best found remove extensions. have disabled extensions still same error. are there else "free" possibility visualize entities code first approach in visual studio? able work entities on more visualized approach. or best way go have missed something? i tried use .net 4.5 , works generate visualization, want use net core.

filesystems - how to create a persistent text file on Android hard drive and not on SD card -

after reading 7 years of questions how unique device id , android device(and how 1 should rethink not that), think creating file on device(not on sd card , not wiped during uninstall or user wipe data) approche. but how save file , possible? i have code save app internal storage dir only public synchronized static string applicationid() { if (sid == null) { file file = new file(application.getinstance().getfilesdir(), application.getinstance().getstring(r.string.application_id_key)); try { if (!file.exists()) writeapplicationidfile(file); sid = readapplicationidfile(file); } catch (exception e) { throw new runtimeexception("writing applicationidfile failed",e); } } return sid; } private static string readapplicationidfile(file file) throws ioexception { randomaccessfile in = new randomaccessfile(file, "r"); byte[] bytes = new byte[(int) in.length()];

cordova - Ionic 2: backgroundMode is never enabled -

i trying make app work in background plugin backgroundmode. however, enable in code, it's never enabled. have imported it. code: declare var cordova:any; console.log("started") document.addeventlistener('deviceready', function () { console.log("ready") cordova.plugins.backgroundmode.enable(); if(cordova.plugins.backgroundmode.isenablisactive()==true){ console.log("it works!") }}, false); it prints out started , ready i have tried follow katzer's guide , solution , none of them worked me.

Pass unicode php variable to javascript -

i trying pass wordpress posts title , excerpts (which persian) javascript . here code in .php script file: function change(){ document.getelementbyid("link").innerhtml = '<a href="$links[2]">$titles[2]</a>'; document.getelementbyid("exer").innerhtml = '$excerpts[2]'; document.getelementbyid("img").innerhtml = '$imgs[2]'; } there no problem titles when add excerpts, makes error in javasripts . generated javascript tag in browser is: function change(){ document.getelementbyid("link").innerhtml = '<a href="http://sirsaleh.com/2016/09/21/semi-private-idea/">یک ایده &#8211; حریم نیمه‌خصوصی</a>'; document.getelementbyid("exer").innerhtml = '<p>چیزی که می‌خوام بگم با حریم نیمه‌خصوصی‌های تعریف شده در جاهای دیگه، اشتباه گرفته نشه. مطلبی که پیش روی شماست کاملا من‌درآوردی است.

javascript - vue js ajax call cannot read property 'push' of undefined -

i having problems vue.js when comes pushing data database webpage. using laravel 5.3 converts data jason. code posts server number of records fetched server response data in want display on webpage. here vue js code new vue({ el: "#projects", data: { count: 0, fetched_projects: [] } methods:{ checkproject: function(){ var fetch = this.count += 4; axios.post('/loadmore', {fetch: fetch }) .then(function(response) { this.fetched_projects.push(response.data); }) .catch(function(error){ console.log(error); }); } html <div class="row"> <div class="col-md-3"> <ul v-for="more_projects in fetched_projects"> <li>@{{ more_projects }}</li> </ul> </div> </div> l

javascript - Close materialize modal from center to bottom -

i'm working on application materialize. i'm trying open , close modal "linear transition". mean, open top center and, close center bottom. at moment succeed in first case (open top center) didn't find way close want. i tried reach goal through css, used class: .modal-slide-show { transform: none !important; } i have searched lot, didn't find way custom close of modal. here , can find fiddle in order check simple example edit i'm using materialize 0.97.7 if edit plugin file find code , change endingtop 14%. var methods = { init : function(options) { var defaults = { opacity: 0.5, induration: 350, outduration: 250, ready: undefined, complete: undefined, dismissible: true, startingtop: '4%', endingtop: '14%' }; this should apply change throughout website , modals should close bottom , open top , no worries method closed.

dataframe - How to calculate product of lags for an arbitrary number of lags in R (dplyr) -

this elementary problem, don't seem working right. need calculate simple product of element , number of lags in r data.frame of time series data. trying achieve in dplyr pipe. e.g.: require(dplyr) df <- data.frame(year = c(2010, 2011, 2012, 2013, 2014), x = c(1, 2, 3, 4, 5)) dffinal <- df %>% mutate(prodlag1 = prod(x, lag(x, 1), na.rm = t), prodlag2 = prod(x, lag(x, 1), lag(x, 2), na.rm = t), prodlag3 = prod(x, lag(x, 1), lag(x, 2), lag(x, 3), na.rm = t)) the result not thought. e.g. prodlag1 resulting dataframe should this: dffinal <- data.frame(year = c(2010, 2011, 2012, 2013, 2014), x = c(1, 2, 3, 4, 5), prodlag1 = c(na, 2, 6, 12, 20)) additionally, aiming @ lag = 10 , find more feasible way typing each individual lag in. reduce work this? one way of doing prodlag10... dffinal <- df %>% mutate(cumlog = cumsum(log(x)),

c# - Valid JSON string throws Unexpected character encountered error -

i'm trying connect angular2 client c# asp.net core server. when i'm sending json string using websockets client server, error: unexpected character encountered while parsing value: {. path 'argument', line 1, position 39. the json string follows (the error seems originate opening bracket after "argument:"): { "methodname": "createuser", "argument": { "user": { "attributes": [{ "name": "age", "value": "30", "type": 0 }], "email": "test@mail.com", "name": "test name" }, "password": "1234" } } the code throws error here: public string receive(string input) { try { debug.writeline(input); instructionserver jsonobject = jsonconvert.deserializeobject<instructionserver>(input); //

swift - Is there a way to tell if a MIDI-Device is connected via USB on iOS? -

i'm using coremidi receive messages midi-keyboard via camera connection kit on ios-devices. app pitch recognition. want following functionality automatic: by default use microphone (already implemented), if midi-keyboard connected use instead. it's find out how tell if usb-keyboard using default driver. ask device called "usb-midi": private func getusbdevicereference() -> midideviceref? { index in 0..<midigetnumberofdevices() { let device = midigetdevice(index) var name : unmanaged<cfstring>? midiobjectgetstringproperty(device, kmidipropertyname, &name) if name!.takeretainedvalue() string == "usb-midi" { return device } } return nil } but unfortunately there usb-keyboards use custom driver. how can tell if i'm looking @ 1 of these? standard bluetooth- , network-devices seem online. if wifi , bluetooth turned of on device (strange?).

How to compact code in VBA Macros (Excel) -

i'd make code shorter due getting error "procedure large". how can write code take range a2 a10 1 worksheet, open other worksheet , paste b214 b222 in exact order. right code works well. when make 200 of give me error. private sub commandbutton1_click() dim ean string worksheets("button excel").select ean = range("a2") worksheets("magic").select worksheets("magic").range("b214").select activecell.value = ean ean = range("a3") worksheets("magic").select worksheets("magic").range("b215").select activecell.value = ean ean = range("a4") worksheets("magic").select worksheets("magic").range("b216").select activecell.value = ean ean = range("a5") worksheets("magic").select worksheets("magic").range("b217").select activecell.value = ean ean = range("a6") worksheets("magic").select worksh

I try to run form action edit.php and godaddy server give me that error -

i want run form action edit.php , server give me error. internal server error server encountered internal error or misconfiguration , unable complete request. <?php $edittext = $_post['edittext']; $editvieta = $_post['editvieta']; $xml=simplexml_load_file("content.xml"); if($editvieta == "aboutusheader") { $xml->headers->header[0] = $edittext; } $xml->asxml("content.xml"); header("location: http://stamantus.eu"); ?>

runtime - read the output from java exec -

hello have question java. here code: public static void main(string[] args) throws exception { process pr = runtime.getruntime().exec("java -version"); bufferedreader in = new bufferedreader(new inputstreamreader(pr.getinputstream())); string line; while ((line = in.readline()) != null) { system.out.println(line); } pr.waitfor(); system.out.println("ok!"); in.close(); system.exit(0); } in code i'am trying java version command execute ok, can't read output return null. why? use geterrorstream() . bufferedreader in = new bufferedreader(new inputstreamreader(pr.geterrorstream())); edit: you can use processbuilder (and read documentation) processbuilder ps=new processbuilder("java.exe","-version"); //from doc: initially, property false, meaning //standard output , error output of subprocess sent 2 //separate streams ps.redirecterrorstream(true); process pr = ps.sta

amazon web services - Change server timeout elastic beanstalk server -

i trying figure out change timeout setting on server. set app through elastic beanstalk, , 502 proxy error (didn't receive response form upstream server). i've searched seems timeout issue. i'm guessing settings modify on local tomcat server don't carry on when deploy amazon web server? if not how go editing timeout settings server eb uses?

angular - Webpack 2 won't work when using ts-loader -

Image
i have been setting basic angular 2 (typescript) application, uses webpack 2 bundling etc. my issue when use ts-loader process typescript (.ts) files lot of errors. suspect, not totally sure, errors ts-loader not excluding node_modules directory though specify exclude in webpack config. i want able setup webpack config (and app) typescript can transpiled , app can correctly bundled webpack. please help. webpack.config.js var webpack = require('webpack'); module.exports = { entry: './src/main.ts', output: { filename: './dist/bundle.js', }, resolve: { // add `.ts` , `.tsx` resolvable extension. extensions: ['.ts', '.tsx', '.js'] // note if using webpack 1 you'd need '' in array }, module: { loaders: [{ test: /\.tsx?$/, exclude: /node_modules/, loader: 'ts-loader' }] }, plugins: [ new webpack.contextreplacementplugin( /angular(\\|\/)core(\\|\/)(

What is the Build Drop Location environment variable name for PowerShell in TFS 2015/2017 -

in previous versions of tfs (before 2015), there build environment variable powershell called: tf_build_droplocation, gave the location of drop: https://msdn.microsoft.com/library/hh850448%28v=vs.120%29.aspx . i can't find equivalent variable in tfs 2017. best practice it? you can list environment variables following command: get-childitem env:\ i assuming create simple build job executes , @ console output determine name of environment variable need.

c# - Is there a less torturous way to INSERT INTO? -

if want insert multiple objects sql server db seems have this: using (var command = new sqlcommand(@"insert table1 ( param_1, param_2, param_3, ... ) values ( @param1, @param2, @param3, ... )",conn)) { command.params.add("@param1",...); command.params.add("@param2",...); command.params.add("@param3",...); ... foreach(var o in objects) { command.params["@param1"].value = o.param1; command.params["@param2"].value = o.param2; command.params["@param3"].value = o.param3; ... command.executenonquery(); } } just putting has me pulling hair out, , have table 28 fields. have write o

reactjs - Using redux in complex SPA app -

i'am ambiguous how implement redux in complex app using atomic design. as remember, atomic design methodology composed of 5 distinct stages working create interface design. 5 stages : atoms button, text input, molecules search field composed of 1 input , 1 button, organisms search form, templates generic template, page search page using generic template, search organisms, molecules or atoms search form, item list, header , footer. imagine app composed : app (page) header (organism in template) menu (molecule) button (atom) ... button (atom) link (atom) content (div) form (organism in page) field (molecule) label (atom) input (atom) field (molecule) label (atom) input (atom) button (atom) footer (organism in template) link (atom) on stage, implement redux ? a reducer/container

Javascript - How to create a promise for creating dynamic elements -

i execute scroll to function after elements section scroll have been created. thought promises way go. have tried not working, not sure how write promises right way when not used ajax request: script: var showmagazinedetail = function showmagazinedetail(id, slug, name, summary, issueimage, magazineimage, page){ images = []; nextimage = 0; imagesindex = 0; loadedimages = []; scrollpoint = document.height; window.location.hash = slug; let createmagazinedetails = new promise((resolve, reject) => { $(".magazine-section").css('visibility', 'visible'); $('#name').text(name); $('#summary').text(summary); $('#cover-image').attr({"src" : '/imagecache/cover/' + issueimage, "alt" : name}); if (magazineimage != '') { $('#issueimage').show(); $('#issueimage').attr({"src" : '/imagecache/medium/

apache - Query string (URL) lead to 403 -

please me on this.already tried disable mode_security module through .htaccess no use. php version 5.6.30 apache redirect request 403 page if pass parameter below. &test[object_type]=0 the name ( object_type ) leads 403 page. eg:http://www.cudec.com.my/?test[object_type]=0 ✖ not working leads 403 eg:http://www.cudec.com.my/?test[object_types]=0 ✓ working will update post full answer got more information work ;) i tried call 403-url: you don't have permission access / on server. additionally, 403 forbidden error encountered while trying use errordocument handle request. you ensured modsecurity 1 replying 403? looks more folder permissions insufficient. check if documentroot @ least readable users (an 'r' @ last triple or 4 in last byte). if it's modsecurity, have /var/log/apache2/modsecurity_audit.log , should see rule (by id) 1 throwing 403 , reason (error-msg in rule) why. does http://www.cudec.com.my/?test[object_types]=0

mysql - Add Value For Enum In SQL -

i have database use enum in it.when try insert data in table ..... nothing happen!! here code of enum part : alter table `question` change `status` `status` enum ( 'pending', 'publish', 'answered' ) character set utf8 collate utf8_general_ci not null default 'pending'; and it's query : query("insert `question`(`username`, `email`, `phone`, `content`,status) values ('$name','$mail','$phone','$content','pending')"); i ignore status ( because define default value ) , , try insert data again , still nothing happen! what must done??!

javascript - d3 connected series circles -

Image
i trying create application circles touch edges of each other. i having issues trying calculate cx function. .attr("cx", function(d, i) { return (i * 50) + 50; //math.sqrt(d) ;// + 50; }) http://jsfiddle.net/59bunh8u/56/ var el = $('.serieschart'); var w = el.data("width"); var h = el.data("height"); var margin = { top: 65, right: 90, bottom: 5, left: 150 }; var svg = d3.select(el[0]).append("svg") .attr("class", "series") .attr("width", w + margin.left + margin.right) .attr("height", h + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); svg.selectall("circle") .data([400, 100, 1000, 300]) .enter().append("circle") .attr("cy", 60) .attr("cx", function(d, i) {

php - select from one database and update into another with matching rows -

select database values , update database same id : error getting trying property of non-object how can achieve there solution ?? $servername = "localhost"; $username = "root"; $password = "pass"; $dbname = "db1"; $dbname2="db2"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $conn2 = new mysqli($servername, $username, $password, $dbname2); if ($conn2->connect_error) { die("connection failed: " . $conn2->connect_error); } $sql = "select * affiliates"; $result = $conn->query($sql); if ($result->num_rows > 0) { //output data of each row while($row = $result->fetch_assoc()) { echo "from db1 id: " . $row["id"]. "publish " .$row["publishinsuppliercontants"]. "<br&

Laravel, Route required parameter is not validating by Form Request Validation -

i using laravel 5.4 routes/web.php [route] route::get('/email-confirmation/{token}', ['uses' => 'components\confirmationcontroller@sendemailconfirmation', 'as' => 'web.email.confirmation']); components/confirmationcontroller.php [controller] public function sendemailconfirmation(emailconfirmationrequest $request) { dd($request->input('token')); // ouput empty } // know that, route required parameter access passing in second parameter emailconfirmationrequest.php [request] public function rules() { return ['token' => 'required|max:3']; } url : /email-confirmation/hello - not validating so, cannot validated token parameter in request. i not sure, doing wrong. as of comments have said, passing $token route parameter, not input value. to use route parameter update method (adding $token ) public function sendemailconfirmation(emailconfirmationrequest $request, $token) {

How to bind Toolbar MenuItem.IsEnabled with MvvmCross and Xamarin.Android -

using mvvmcross , xamarin.android possible bind isenabled property of toolbar menuitem boolean value in viewmodel? if so, how done? i believe it's impossible @ time bind android imenuitem.isenabled boolean value on viewmodel due fact isenabled readonly , changed enabled state of menu item requires call setisenabled(bool) . i worked around limitation adding event handler mvxviewmodel.propertychanged in activity/fragment. viewmodels inherit mvxviewmodel i'll share a way can accomplished. of app implemented fragments, example reflects that, (in actual code i've put of in base fragment class, wanted keep simple): public class myviewmodel : mvxviewmodel { public bool menuitemisenabled { get{return _menuitemisenabled;} set{setproperty(ref _menuitemisenabled, value); } } [mvxfragment(typeof(mainviewmodel), resource.id.content_frame, true)] [register(nameof(myfragment))] public class myfragment : mvxfragment { private toolbar toolbar;