Posts

draw lines on overlaid scatter plots in R -

Image
i want visualize embedding r^2 r^2. have overlaid scatter plots of original data , transformed data. want join dots stars corresponding same color line can see how each point gets transformed. idea how in r. reproducible example of overlaid scatter plot given below. set.seed(18) m<-cbind(a=runif(10),b=runif(10)) n<-cbind(d=rnorm(10),e=rnorm(10)) plot(n[,1],n[,2],col=rainbow(10),pch=20,xlab="x",ylab="y") points(m[,1],m[,2],col=rainbow(10), pch=8) one way segments segments(n[,1], n[,2], m[,1], m[,2], col = rainbow(10))

Prolog program about lists -

i new programmer in prolog , tried program says: make predicate penta(x) , x list , returns true when in x there 5 consecutive elements : first element sum between first , second. third element difference between 5th , 4th example: x = [ ... 5, 7, 12, 18, 30, ... ] . so did this: penta(x) :- \+length(x,0), //here verify if lists contains less 5 elements gives false. \+length(x,1), \+length(x,2), \+length(x,3), \+length(x,4), (a, b, c, d, e | x), c + b, c d - e, penta(x). this not compile doesn't work yet. tell me what's wrong if like. thank much. in prolog, write predicates not functions . predicate defines rule succeed or fail on sets of instantiated variables. want predicate, penta(x) succeeds if x list contains 5 consecutive elements meeting criteria. start top. either 5 consecutive elements meet criteria @ head of list, or later in list. % succeed if first 5 elements meets criteria penta([a, b, c, d, e |_]) :- ... % goes here succeed? %...

object - Case Else Statement from different tables -

i trying retrieve name based on type of claim. seem easy enough, it's not working me. working 2 main tables, claim , exposure , , contactname table. each claim can have multiple exposures , each exposure can have 1 claim . both tables contain nameid field - claim.nameid , exposure.nameid . nameid correlates contactname table. contact name id name 111 jim 222 bob 333 john 444 sam 555 walt normally, each claim can have multiple exposures , exposures on claim can have same name or different names. name ids found on exposure . the exposure.nameid joins contactname.id claim claim.nameid exposureno exposure.nameid name a null 1 111 jim a null 2 222 bob a null 3 333 john b null 1 444 sam b null 2 444 sam workers comp claims different. each workers...

java - Get Bit values from Byte Array -

i have byte array need read specific bits , convert int (see byte array structure below). though bits information want read in 3 bytes, tried reading 4 bytes (6-9) integer , read bits integer value bits or bitsvalue method somehow not able see right values bit manipulation. , expertise in bits pretty sure doing wrong. can please suggest doing correctly , why not working. in advance!! byte array in little endian format. 0th byte - value 1st byte - value 2nd - 5th byte - value 6th - 9th byte - first 18 bits represent value - next 5 bits represent value - next 1 bit represent value - last 8 bits represent value public class test { public static void main(string... dataprovider) { string s = "46 00 ef 30 e9 08 cc a5 03 43"; byte[] bytes = new byte[s.length()]; bytes = hexstringtobytearray(s); int bytepointer = 0; int msgtype = getintfromsinglebyte(bytes[bytepointer]); // 0th byte int version = ge...

Need to compare 2 dates -

i need compare 2 dates/time stamps , see if within 10 minutes of each other in sql. if within 10 minutes of each other, not want data output in. if outside of 10 minutes, output data. example: if event 1 occurs on saturday 9/10/2017 10:00:00, , event 2 occurs on saturday 9/10/2017 10:00:09, not want data queried. if event 1 occurs on saturday 9/10/2017 10:00:00, , event 2 occurs on saturday 9/10/2017 10:00:11, want data queried.

android - UUID's have to be distinct for service , characteristic and descriptor? -

i trying make client-server connection server containing 1 service 1 characteristic contains 1 descriptor. i've made service, characteristic , descriptor have same uuid , when try write on descriptor/characteristic (in android app) pop-up appears tells me , bluetooth has shut down becouse of problem (not known). there condition uuid's have distinct ? the "uu" of uuid means "universally unique". uuid describing type of data, though, can have 2 characteristics same uuid if both providing same sort of data. (ex 2 thermometers) think descriptors supposed have uuid's dictated standard (so know they're descriptors). so, service, characteristic, , descriptor should have different uuid's.

javascript - Cannot subscribe Page to Facebook App -

when use facebook graph api explorer , send post request page_id/subscribed_apps?access_token=access_token all ok, page appears in subscribed pages webhook. but when use fb node.js api , send request like: fb.api( /${fbselectedpage}/subscribed_apps, 'post', {"access_token": ${selectedpagetoken}}, function(response) { console.log(response); } ); page not appear in subscribed pages webhook section. same postman. works graph api explorer. does know solution? p.s. real subscribe many pages 1 app , webhook events them?