Posts

Featured post

A way to access google streetview from R? -

Image
there nice interface google earth images available via ggmap . example: ggmap::get_map(location = c(lon = -95.3632715, lat = 29.7632836), maptype ="satellite",zoom=20) will return satellite map image google maps/earth. on google maps website if zoom bit more, switches streetview. there similar way r streetview images? there seem api , can't find analogous ggmap interface in r. my googleway package has google map widget (and works with shiny ). you'll need valid google api key use it library(googleway) ## valid api key here #key <- read.dcf("~/documents/.googleapi", fields = "google_map_key") df <- data.frame(lat = -37.817714, lon = 144.967260, info = "flinders street station") google_map(key = key, height = 600, search_box = t) %>% add_markers(data = df, info_window = "info") ## other available methods # add_markers # add_heatmap # ad

javascript - How to trace all paths of a tree like data structure? -

let's have nested object so: { label: 'parent', eyecolor: 'brown', kids: [ { label: 'kid_0', eyecolor: 'brown', kids: [ { label: 'kid_0_0', eyecolor: 'green', kids: [] }, { label: 'kid_0_1', eyecolor: 'brown', kids: [ { label: 'kid_0_1_0', eyecolor: 'brown', kids: [] } ] } ], }, { label: 'kid_1', eyecolor: 'brown', kids: [ { label: 'kid_1_0', eyecolor: 'brown', kids: [] } ], }, { label: 'kid_2', eyecolor: 'green', kids: [] } ] }; if wanted store unique paths, how recursively? i've tried many attempts, can't seem obtain unique paths (m

javascript - Event touchstart doesn't work on iPhone -

i have code works, except on iphone. when window loads, function called. when have event click , works fine on desktop, not on mobile. i've tried looking around solutions mobile, , touchstart seems recommended solution. but, though works on emulators, doesn't work on iphone (tested on latest os version). missing something? function addxclassonclick() { var els = document.getelementsbyclassname('item'); array.prototype.foreach.call(els, function(el) { el.addeventlistener('touchstart', function() { el.parentelement.classlist.toggle('x'); }, false); }); } thanks in advance! given document fragment: <div class="x"> <div class="item">item</div> </div> the anonymous event handler function's default scope bound clicked element, , not clicked element's parent, scope classlist.toggle should operate on. (edit: according documentation, foreach passes undefine

java ee - Trying to generate db tables with spring boot project -

org.springframework.beans.factory.beancreationexception: error creating bean name 'entitymanagerfactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/hibernatejpaautoconfiguration.class]: invocation of init method failed; nested exception org.hibernate.boot.registry.selector.spi.strategyselectionexception: unable resolve name [org.hibernate.dialect.mysql5dialect] strategy [org.hibernate.dialect.dialect] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1578) ~[spring-beans-4.2.3.release.jar:4.2.3.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:545) ~[spring-beans-4.2.3.release.jar:4.2.3.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:482) ~[spring-beans-4.2.3.releas

java - Spark Framework and relative path -

i'm using spark framework create web app , i've been going through tutorials on site. @ moment, i'm working on templates section, can't seem project recognize css , templates in resources folder. i'm using netbeans , maven manage dependencies. can me figure out how set relative paths/create project folders appropriately in environment? i'm newbie both maven , spark, go easy please. static files: if resources directory looked this: resources └───public ├───css │ style.css ├───html │ hello.html └───templates template.ftl you use staticfiles.location("/public") . make /public root staticfiles directory. you access hello.html this: http://{host}:{port}/html/hello.html if wanted use external location on filesystem, use staticfiles.externallocation(...) , works pretty same way above. note: staticfiles.externallocation(...) can set project's resources directory, means files au

javascript - Angular 2 Role based navigation on same path -

i've small question regarding angular 2 router using version 3.0.0-rc.1 want navigate different home component based on user role such admincomponent or usercomponent. can please in modifying below routes can achieve desired functionality? {path: 'login', component: logincomponent}, <----this redirects '/' in case user logged in { path: '', component: homecomponent, canactivate: [authguardservice], <-----check if user logged in, else redirect login children: [ { path: '', component: admincomponent <---- want navigate here if user role 'admin' }, { path: '', component: usercomponent <----- want navigate here if user role 'user' } ] } authguardservice.ts import {injectable} "@angular/core"; import {canactivate, router, activatedroutesnapshot, routerstatesnapshot} "@angular/router"; import {authservice} "./auth

ReactJS Warning: Each child in an array or iterator should have a unique "key" prop -

var divarr = [ '<div>布吉岛啊</div>', '<div>呵呵呵</div>', ]; reactdom.render( <div>{divarr}</div>, document.getelementbyid("example") ); but it's error: warning: each child in array or iterator should have unique "key" prop. check top-level render call using . see [warning-keys][1] more information. and don't know how insert 'key' you need put unique key inside array div check code var divarr = [ '<div key='1'>布吉岛啊</div>', '<div key='2'>呵呵呵</div>', ]; reactdom.render( <div>{divarr}</div>, document.getelementbyid("example") );