Posts

Create equidistant points along (Poly)line in R -

Image
if have spatial lines object this: require(sp) x <- c(18.25721, 18.25763,18.25808,18.25846,18.25864,18.25886,18.25892,18.25913,18.25940,18.25962, 18.25976,18.25997,18.26021,18.26048,18.26061,18.26086,18.26107,18.26128,18.26154,18.26219, 18.26276,18.26350,18.26445,18.26510,18.26584,18.26668,18.26704,18.26807,18.26850,18.26944, 18.27020,18.27080,18.27111,18.27134,18.27168,18.27191,18.27217,18.27254,18.27309,18.27345, 18.27368,18.27389,18.27398,18.27400,18.27392,18.27383,18.27370) y <- c(44.69540,44.69539,44.69544,44.69552,44.69563,44.69586,44.69608,44.69644,44.69672,44.69687 ,44.69701,44.69718,44.69737,44.69763,44.69771,44.69778,44.69781,44.69781,44.69782,44.69776 ,44.69772,44.69778,44.69794,44.69805,44.69814,44.69822,44.69824,44.69826,44.69821,44.69805 ,44.69775,44.69737,44.69728,44.69717,44.69701,44.69687,44.69671,44.69649,44.69616,44.69598 ,44.69578,44.69560,44.69539,44.69513,44.69490,44.69476,44.69453) river<-...

How do I update Google Analytics session data using Measurement Protocol without creating a new session -

question: how can assure visitor's original session updated/attributed new goal triggered using measurement protocol, if trigger happens after original session window has expired? problem in detail: i capturing cid _ga cookie when visitor reaches site , makes contact via form i use measurement protocol captured cid send data google analytics trigger goal "client registered" if visitor later registers services. if happens within 4 hour session window of visitor's first visit site, session created first visit attributed goal. however, if send data google analytics after 4 hour session window, google analytics sees measurement protocol hit new session , creates new session goal attributed. want original session show new goal value. i believe following stackoverflow question related, has no answers posted: " google analytics measurement protocol session timeout , query time limits " nope, not possible, can make hit non-interactive. can...

python - Creating a new instance of a Custom User Model in Django -

i have model extension of user model in django 1.8. connecting mysql database this. class libraryuser(models.model): user_id = models.onetoonefield(user) is_catalogue_subscriber = models.booleanfield(default=true) is_research_subscriber = models.booleanfield(default=true) library_membership_number = models.charfield(max_length=64) the reason why extended user model, of course use authentication framework. so now, want create new libraryuser using library_membership_number login username. how should so? create user first reference libraryuser ? ie given some_ variables either received post or migration of users new table u = user.objects.create_user(email=some_email, password=some_password) lu = libraryuser(library_membership_number, user_id = u.id) lu.save() or there correct way this? tried finding online can't find particularly address problem. you should assign value specify fields following: lu = libraryuser(library_membership_number= ...

xcode - How do I detect if the charger is plugged in or unplugged using Swift? -

this question has answer here: detect if device charging 5 answers i want detect when charger plugged , when becomes unplugged. want write using swift. great if share code snippet it, if can tell me use nice. see this doc more info. swift: uidevice.currentdevice().setbatterymonitoringenabled(true) if uidevice.currentdevice().batterystate() == uidevicebatterystatecharging { nslog("device charging.") }

mongodb - Idle Connection Timeout in mongoose -

is there way set idle connection timeout in mongoose ? trying 1 below. mongoose.createconnection(ip:port/{server:{"maxidletimems":1800000}}) but above code doesn't seem work. appreciated this option called connecttimeoutms not maxidletimems , socket option. sample code work : var uri = 'mongodb://localhost/mydb'; var options = { server: { socketoptions: { connecttimeoutms: 1800000}}}; mongoose.createconnection(uri, options, function (err) { if (!err){ console.log("connection successful");} }); good luck

smt - Why does Z3 return unknown for this nonlinear integer arithmetic example? -

i have simple example in nonlinear integer arithmetic, namely search pythagorean triples. based on read in related questions (see below), i'd expect z3 find solution problem, returns 'unknown'. here example in smt-lib v2: (declare-fun x () int) (declare-fun y () int) (declare-fun z () int) (declare-fun xsquared () int) (declare-fun ysquared () int) (declare-fun zsquared () int) (declare-fun xsquaredplusysquared () int) (assert (= xsquared (* x x))) (assert (= ysquared (* y y))) (assert (= zsquared (* z z))) (assert (= xsquaredplusysquared (+ xsquared ysquared))) (assert (and (> x 0) (> y 0) (> z 0) (= xsquaredplusysquared zsquared))) (check-sat) (exit) there few related questions, notably: how z3 handle non-linear integer arithmetic? need understanding equation combining nonlinear real linear int z3 support nonlinear arithmetic z3 limitations in handling nonlinear real arithmetics it seems z3 won't attempt finding solution bit-b...

angularjs - How to split code coverage by separate files for Angular, Karma and Webpack? -

how can split coverage separate files? right working fine bundle file. using angular , webpack bundling , karma / mocha / chai testing. i have following webpack.config: module.exports = { entry: { public: "./application/src/public.js", office: "./application/src/office.js" }, output: { path: "./client/javascripts/", filename: "[name].js", sourcemapfilename: "[name].js.map" } }; and following karma.conf.js: module.exports = function(config) { config.set({ basepath: "", frameworks: ["mocha", "chai"], reporters: ["mocha", "coverage"], files: [ "./client/libs/angular/angular.js", "./client/libs/angular-route/angular-route.js", "./client/libs/angular-animate/angular-animate.js", "./client/libs/angular-cookies/angular-cookies.js", ...