Posts

Showing posts from July, 2014

java - Android : How to Pass the JSON object From AsncTask class to the Main Class -

i have jsonobject receiving api call within asynctask class. want pass json object mainactivity class show jsonobject data in gui. found solutions throughout searches , came close solution. when access mainactivity class says jsonobject null. have dont wrong here? best way ? following asynctask class import android.content.context; import android.os.asynctask; import android.util.log; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httpget; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.util.entityutils; import org.json.jsonobject; /** * created nisal on 13-sep-17. */ public class getstationsapicall extends asynctask<string, void, jsonobject> { context ctx; jsonobject responseobj; string result; public interface asyncresponse { void processfinish(jsonobject output); } public asyncresponse deleg...

Is there any way to specify the group name AND id for a group with docker run --group-add? -

currently have following in script: docker_group_id=$(cut -d: -f3 < <(getent group docker)) ... docker run --group-add ${docker_group_id} ... problem when run script, messages following in resultant container time: groups: cannot find name group id 999 solution : based on answer @tarunlalwani have following in script: docker_group_id=$(cut -d: -f3 < <(getent group docker)) cmd="docker run -d \ --group-add ${docker_group_id} \ ...

c# - Mono on Linux System.DllNotFoundException: Kernel32 -

i create small application (show code). want run mono on linux (ubuntu 16.04). how can importing right stuff "kernel32" lib? code: public class program { static bool exitsystem = false; #region trap application termination [dllimport("kernel32")] private static extern bool setconsolectrlhandler(eventhandler handler, bool add); private delegate bool eventhandler(ctrltype sig); static eventhandler _handler; } where error or library missing? have tried on windows works mono. on linux show "kernel 32" error. possible @ wait consolencloseevent? hope can me ...

Amazon S3 consistency for versioning buckets -

how versioning work amazon s3 consistency? in use case want upload multiple versions same bucket (with versioning enabled). many writes may occur @ same time. will read-after-write-consistency, eventual consistency, no consistency or race condition (data being overwritten , lost) concurrent updates (puts) same objects in same bucket? the documentation consistency https://docs.aws.amazon.com/amazons3/latest/dev/introduction.html#consistencymodel has nothing versioning. the documentation versioning https://docs.aws.amazon.com/amazons3/latest/dev/versioning.html has nothing consistency.

angular - Should I make Protractor E2E Test completely synchronous -

brief: trying make e2e test in angular 2 synchronous protractor wrapper around jasmine adds support promises in e2e tests, devs didn't have create lot of nested async callbacks, async hell. presume protractor encourages devs make tests synchronous. quotation here: https://blog.liip.ch/archive/2015/01/28/angularjs-end-to-end-testing-with-protractor.html it important note protractor entirely asynchronous, api methods return promises. under hood, protractor uses selenium’s control flow (a queue of pending promises) allow write tests in pseudo-synchronous way. protractor smart enough make work. this how people confused this. dealing synchronously in protractor tests https://github.com/angular/protractor/issues/673#issuecomment-125599377 so, there still cases when devs should deal async methods in tests, e.g. need href attribute of link , check if has id @ end of it, must define callback attribute's value, parse , after check if has id or not. $(...

clone - Custom GitLab not working with remote pull -

i've been looking answers curious case im facing right now. work client, whom has custom gitlab server, , i'm being asked tu automate tasks require som git pulls , clones. thing can't neither clone nor pull repos provided me. far thit i've tried: git clone git clone https://git.someorganization.com.mx/project_name/repo_name</code> the response is: fatal: unable access ' http://git.someorganization.com.mx/project_name/repo_name/ ': couldn't connect server so, can see, it's changing https http , , i'm not being able connect

java - Unexpected error in Eclipse Juno main class -

Image
this error getting in main class cartester @ line 21: this class car: package mohantyashutosh; public class car { private int mileage; private int gaspresent; private int price; public car(int mileage, int gaspresent, int price) { this.mileage = mileage; this.gaspresent = gaspresent; this.price = price; } public car() { // todo auto-generated constructor stub mileage = 20; gaspresent = 1 ; price = 500000; } public void drive(int distance) { } public void addgas(int quantity){ } } i cannot understand why during object creation in main class, cannot take parameterized constructor.

language agnostic - Is floating point math broken? -

0.1 + 0.2 == 0.3 -> false 0.1 + 0.2 -> 0.30000000000000004 why happen? binary floating point math this. in programming languages, based on ieee 754 standard . javascript uses 64-bit floating point representation, same java's double . crux of problem numbers represented in format whole number times power of two; rational numbers (such 0.1 , 1/10 ) denominator not power of 2 cannot represented. for 0.1 in standard binary64 format, representation can written as 0.1000000000000000055511151231257827021181583404541015625 in decimal, or 0x1.999999999999ap-4 in c99 hexfloat notation . in contrast, rational number 0.1 , 1/10 , can written as 0.1 in decimal, or 0x1.99999999999999...p-4 in analogue of c99 hexfloat notation, ... represents unending sequence of 9's. the constants 0.2 , 0.3 in program approximations true values. happens closest double 0.2 larger rational number 0.2 closest double 0.3 smaller rational number 0.3 . sum ...

rtc - Why does lscm crash with on MacOS -

i installed rtc command line tools (v 6.0.4) on mac (macos sierra 10.12.6) in hopes of using lscm command check out files rtc repository. lscm login (and many of other lscm subcommands) fails with: unexpected exception java.lang.noclassdeffounderror: com/ibm/team/process/common/advice/iprocessreport @ com.ibm.team.filesystem.cli.client.internal.subcommands.logincmd.run(logincmd.java:83) @ com.ibm.team.filesystem.cli.core.abstractsubcommand.run(abstractsubcommand.java:51) anyone know going on?

fragment - Android proguard back arrow not displayed (although working in debug APK) -

i have activity containing fragment shows list of settings. when clicking on list item, fragment transaction performed , detail fragment displayed. also, hamburger menu item transformed arrow (home up). in debug apk, works perfectly. however, in release version, hamburger menu not transformed arrow, stays same. when clicking hamburger menu button detail fragment, fragment dismissed expected. problem display of arrow not shown in release version using proguard. i found solution. since using drawerarrowdrawable, have include v7 support graphics library in proguard file. -keep class android.support.v7.graphics.** { *; } now arrow drawable displayed.

python - I am really not sure why this is a Syntax Error, works without while loop -

quick question. find out how syntax error? if remove while loop @ top works fine want code inside while loop repeat many times specify in 'total' variable all code there no such thing braces blocks in python (unlike c, java ...). need indentation. while cond: # no { # code here # no }

java - Handle expired links while parsing JSON from within the android application -

i designing application in kotlin parses json-array. have completed application stuck on 1 minor(in case major) glitch.i have successfully parsed array , displayed required array of objects in cardview , opened link in browser when card item clicked. problem the json contains links expired or no longer in use. how i handle such(expired) links within app when user clicks on particular card (with flowery message or `imageview)? comfortable in android basics , still learning devise kotlin in android application , searched on internet best of knowledge efforts went in vein. any warmly , benignly welcomed.... below code fragment( feedviewholder.kt ): class feedviewholder(itemview: view):recyclerview.viewholder(itemview), view.onclicklistener,view.onlongclicklistener { var txttitle: textview var txtpubdate: textview var txtcontent: textview private var itemclicklistener: itemclicklistener? = null init { txttitle = itemview.findviewbyid(r.id.txttitle) textview txtpu...

How do I make it so SonarQube comments on my pull requests on VSTS? -

i use vsts sonarqube extension , trying basic pull request 1 branch another. change 1 line of code add if(true=true) reaction sonarqube , tell me it's bad coding, don't see sonarqube extension when looking @ pull request. right build definition project not work think isn't necessary i'm trying do... how can make see sonarqube comments on pull request? the build definition working absolutely required. sonarqube extension publish results pull request when build running part of branch policy.

php - LARAVEL MYSQL how to use natural JOIN -

i need return in collection paginate can return in array because query use natural join. how query using laravel collections : select mensagens.* mensagens natural join ( select id_emissor, max(created_at) created_at mensagens id_receptor = ".$user_id." group id_emissor) t i have used code: $mensagem = \db::select( db::raw("select mensagens.* mensagens natural join ( select id_emissor, max(created_at) created_at mensagens id_receptor = ".$user_id." group id_emissor) t ") ); if want use query use - \db::raw("select mensagens.* mensagens natural join ( select id_emissor, max(created_at) created_at mensagens id_receptor = ".$user_id." group id_emissor) t"); else can use eloquent also.

Send data from Apache Flume to ElasticSearch -

i using following flume 1.7 agent configuration stream data kafka 0.9.0.1 topic, , send data elasticsearch setup on rancher using es found in catalog version v0.5.0. agent.sources = flume_test agent.channels = kafka_test_channel agent.sinks = elasticsearchsink agent.sources.flume_test.type = org.apache.flume.source.kafka.kafkasource agent.sources.flume_test.zookeeperconnect = stage-kafka01.stage:2181,stage-kafka02.stage:2181,stage-kafka03.stage:2181 agent.sources.flume_test.topic = hrzn_stage1_test agent.sources.flume_test.groupid = flume_kafka_stage1_test agent.sources.flume_test.channels = kafka_test_channel agent.sources.flume_test.spooldir = /var/log/spooldir/auth agent.sources.flume_test.interceptors = i1 agent.sources.flume_test.interceptors.i1.type = com.cpm.interceptors.testinterceptor$builder agent.channels.kafka_test_channel.type = file agent.channels.kafka_test_channel.checkpointdir = /dev/shm/flume/checkpointsdir/auth agent.channels.kafka_test_channel.datadirs =...

c# - How return JSON endpoint or a partial view in same function? -

working on mvc5 app. have search form. client wants me either show search results on page, or "expose necessary actions json endpoints". the partial view search works fine. but, can't json part of code return in way can "consumed". (if understand requirement.) ideas how can (within same function)? here's snippet of code.... public actionresult _searchit(searchviewmodel response) { : : // work of getting data based on users inputs : : // either return partial view or json endpoint... if (response.returnjson == true) { // return serialized json object rather partial view string json = jsonconvert.serializeobject(model); return this.content(json); // returns data properly, // not in consumable manner } else { // works perfect ...

swift - Cannot get groups folder on iOS 11 simulators -

the following returns nil on iphone 11 simulators works fine on devices , simulators prior 11. let containerurl = filemanager.containerurl(forsecurityapplicationgroupidentifier: "group.my.group.name.here") anyone else encounter this? solution?

django - Python sports game outcome algorithm -

i create algorithm generate score both teams in game using both element of random, , teams overall rating. far have similar following. # determine score home_overall = 78 away_overall = 85 home_score = numpy.random.choice(range(4), p=[.2, .4, .3, .1]) away_score = numpy.random.choice(range(4), p=[.2, .4, .3, .1]) as example of i'm looking do, i'd have such if team rated 95 playing against team 75, have higher chance of getting higher score lower rated team. calculate p based on teams rating somehow? team 95 rating have p=[.1,.2,.5,.3] and lower rated team have p=[.3,.4,.2,.1] i'm not sure algorithm since values of p have add 1 , i'd want recalculate p every time game run.

ruby - How to deal with Twilio API SMS errors and invalid phone numbers in Rails -

how can handle errors in twilio api in regards creating sms message? every time invalid phone number gets entered, message , 500 error: unable create record: 'to' number not valid phone number. how can have redirect home page , flash error notice? class messager def initialize @account_sid = env['account_sid'] @auth_token = env['auth_token'] @twilio_number = env['twilio_number'] @client = twilio::rest::client.new @account_sid, @auth_token end def send_message(phone_number, movies, username) text_message = @client.api.account.messages.create( from: @twilio_number, to: phone_number, body: "hello movie lover, #{username}!\nhere current watch list:\n#{movies}" ) puts text_message.to end end i don't need fancy, redirect main page , quick error message saying phone number invalid, not 500 error page. i'm new twilio api, , i've been troubleshooting issue hours. twilio developer ev...

airflow - Can a workflow with many, many subdags be performant? -

i have workflow involves many instances of subdagoperator, tasks generated in loop. pattern illustrated following toy dag file: from datetime import datetime, timedelta airflow.models import dag airflow.operators.dummy_operator import dummyoperator airflow.operators.subdag_operator import subdagoperator dag = dag( 'subdaggy-2', schedule_interval=none, start_date=datetime(2017,1,1) ) def make_sub_dag(parent_dag, n): dag = dag( '%s.task_%d' % (parent_dag.dag_id, n), schedule_interval=parent_dag.schedule_interval, start_date=parent_dag.start_date ) dummyoperator(task_id='task1', dag=dag) >> dummyoperator(task_id='task2', dag=dag) return dag downstream_task = dummyoperator(task_id='downstream', dag=dag) n in range(20): subdagoperator( dag=dag, task_id='task_%d' % n, subdag=make_sub_dag(dag, n) ) >> downstream_task i find conveni...

python - Loop in recursive function -

for algorithm found convenient define recursive function looks this: def f(l): in range(2): if len(l)>=1: print(l+[i]) else: return f(l+[i]) f([0]) but behavior different expect. print [0, 0] [0, 1] but expect print [0,0] [0,1] [1,0] [1,1] somehow nested function has access variable i, , instead of starting new loop different variable, continues on counting variable i. don't understand why python this. my (vague) question therefore why python this, , there obvious modification code give output expected? your code never recurses. for in range(2): if len([0])>=1: print([0]+[i]) else: return f([0]+[i]) # de-functified first time through for loop, len([0]) >= 1 true , prints [0] + [0] . second time through for loop, len([0]) >= 1 still true , prints [0] + [1] . loop ends , control passes outside function. never reach recursive case ( len(l) < 1 ) note intended result ...

graphql - Apollo resetStore is not working in Angular client -

i trying integrate authorization token @ client side. passing token in middleware. when user logout reset store , new token. when send new request still sending old token(cached) here code app.module.ts const networkinterface = createnetworkinterface({ uri: "http://localhost:3000/graphql" }); networkinterface.use([ { applymiddleware(req, next) { if (!req.options.headers) { req.options.headers = {}; // create header object if needed. } req.options.headers.authorization = localstorage.getitem(auth_token); next(); } } ]); export function provideclient(): apolloclient { return new apolloclient({ networkinterface, dataidfromobject: (o: any) => `${o.__typename}-${o.id},` }); } when logout have code localstorage.removeitem(auth_token); this._apollo.getclient().resetstore(); then when make request still taking old token in request headers. how can update new token? i might change middleware this...

nservicebus - Particular ServiceControl : Where to put RavenDB Configuration options? -

i'm confused ravendb configuration options such raven/memorycachelimitmegabytes or raven/esent/cachesizemax should placed when running particular servicecontrol embedded ravendb. want limit memory consumption ravendb play nice other applications running on server. per ravendb configuration options webpage here . talks using raven.server.exe.config file, doesn't appear exist. neither raven.server.exe. the other file looks may used in place servicecontrol.exe.config used configure servicecontrol. correct file add ravendb configuration options to? particular documentation doesn't go detail should entered on page here . full path: c:\program files (x86)\particular software\particular.servicecontrol\servicecontrol.exe.config thanks! is correct file add ravendb configuration options to? yes. ravendb used servicecontrol embedded ravendb, not standalone server. therefore settings ravendb need provided via servicecontrol.exe.config , not raven.server...

Firebase Rules permission denied but why? -

this rules: { "rules": { "freecoinsrequest":{ ".read": false, ".write": " newdata.child('uid').val() == auth.uid 1. && (root.child('users').child(auth.uid).child('/server/lasttimetookfreecoins').val() < - 10000 2. || !root.child('users').child(auth.uid).child('/server/lasttimetookfreecoins').exists()) " , "uid":{ ".validate" : true }, "$other":{ ".write": false, ".validate": false } }, } } so user should able write path if: the json contains "uid" key, , uid value he did not write server/lasttimetookfreecoins within 10 seconds ago or he never wrote server/lasttimetookfreecoins i can not understand why gets denied in simulator. when uncomment 1 , 2, seen in rules, works. thanks. in testing, ru...

project template - GeneXus Platform SDK installer not working for Visual Studio 2015 -

i'm trying setup environment develop genexus extension version 15. after installing visual studio express 2015 (based on genexus wiki instructions) i'm installing genexus sdk platform 15 upgrade 3 the sdk installer pop error "can't find vstudio 2005 or 2008", , continue installation. but genexus projects templates not available in vstudio 2015 after that. worked fine vs2008. i try this genexus wiki suggestion doesn't work. manually installing files inside vstudio folders. genexus package.ico genexus package.vsdir genexus package.vsz genexus pattern.ico genexus pattern.vsdir genexus pattern.vsz please, need visual studio working genexus platform sdk. encontramos un par de problemas en el estado actual del sdk. con rodolfo estuvimos ya en contacto y logramos que le funcionara, pero actualizo la info aquí por si alguno más se enfrenta con esto. uno de los problemas era que los templates de proyecto fueron hechos para versiones anterior...

how to add a delay in downstream project before it gets triggered by upstream project in jenkins -

Image
i have 2 jobs configured on jenkins job-a upstream , job-b downstream. once job-a completes execution triggers job-b want job-b should start @ least 5/10 minutes after job-a completes. , in case job-a starts @ random time in day use jenkins quiet period feature add wait time before starting build. quiet-period: number of seconds wait between consecutive runs of job. this can configured @ jenkins global level or each individual job level. in case configure job-b quiet period 5 or 10 minutes.

kotlin - How can we use automatic reloading? -

trying utilise automatic module reloading feature (as described here ), documentation unfortunately not helpful. it says use configuration, configuration page empty. i believe can pass in "watch" list of modules embeddedserver() call this page , when do, following exception: module function provided lambda cannot unlinked reload . so won't let pass in lambda application module, i'm not sure how avoid doing while getting access application methods (e.g. routing() ). has been able automatic reloading working lately? if so, how? lambda might have captured state containing function , cannot reloaded – there no way restore captured state. have extract application separate function this: fun application.module() { install(calllogging) install(routing) { get("/") { call.respondtext("""hello, world!<br><a href="/bye">say bye?</a>""", contenttype.text.html) }...

r - How to add frequency count labels to the bars in a bar graph using ggplot2? -

Image
this question has answer here: show frequencies along barplot in ggplot2 4 answers i want plot frequency distribution of [r] factor variable bargraph, bars represent frequency counts of factor levels. use ggplot2 , there's no problem that. what can't figure out how add frequency count labels bars in bargraph. syntax i've tried follows: ggplot(data, aes(x = factorvar)) + geom_bar(fill = "somecolor") + geom_text(aes(y = ???)) i think thoroughly searched in stackoverflow , "r graphics cookbook" w.chang couldn't find specific answer parameter should match "y" in aesthetics of geom_text() above. tried variants like: (y = ..count..) didn't work. i appreciate help. thanks... ggplot(data=diamonds,aes(x=clarity)) + geom_bar() + geom_text(stat='bin',aes(label=..count..),vjust=-1)

performance - Android imageView is lagging when loading image from bitmap -

i have imageview has touch event move, rotate, , zoom imageview. code works fine, when load image gallery instead of drawable folder, touch event lagging. when try move, rotate or zoom in image, there delay , slow. imgphoto.setontouchlistener(new view.ontouchlistener() { relativelayout.layoutparams parms; int startwidth; int startheight; float dx = 0, dy = 0, x = 0, y = 0; float angle = 0; @override public boolean ontouch(view v, motionevent event) { final imageview view = (imageview) v; ((bitmapdrawable) view.getdrawable()).setantialias(true); switch (event.getaction() & motionevent.action_mask) { case motionevent.action_down: parms = (relativelayout.layoutparams) view.getlayoutparams(); startwidth = parms.width; startheight = parms.height; dx = event.getrawx() - parms.leftmargin; ...

javascript - How do I create a promise chain in js shaped like a diamond -

i'm stuck promises. say program structure this func //gets data passes i1 , j2 / \ func i1 func j1 //then route & j run without interaction | | func i2 func j2 \ / func b //func b gets both result of both i'm have bit of trouble getting work. i'm far as getdata.then(data=>{ var methods = promise.all([ funci1.x(data).then(output=>{ funci2.x(output) }), funcj1.x(data).then(output2=>{ funcj2.x(output2) }) ]) methods.then(([a,b])=>{ console.log(a,b); }) }) but doesn't seem working. help? you don't return can casted promise in 2 then() callbacks, change this: getdata.then(data => { var methods = promise.all([ funci1.x(data).then(output => funci2.x(output)), funcj1.x(data).then(output2 => func...

java - JPA: Find by Interface instead of Implementation -

i want use find method interface, instead of using implementation. that said here code: public goods findgoods(long goodsid) { return this.jpaapi.withtransaction(()->{ goods goods = null; try{ entitymanager em = this.jpaapi.em(); query query = em.createquery("select g goods g id=:id", goods.class); query.setparameter("id", goodsid); goods = (goods) query.getsingleresult(); }catch (exception e) { // todo: handle exception e.printstacktrace(); } return goods; }); } my entity: @entity(name = "goods") @table(name = "goods") @inheritance(strategy = inheritancetype.single_table) public class goodsimp implements goods, serializable { .. } my interface: @jsontypeinfo(include = jsontypeinfo.as.property, property = "type", use = id.name, defaultimpl = goodsimp.class, visible = true) @jsonsubtypes({ @type(val...

HI, i am creating a unit test for simple game in c# , but they my each test are failing -

whenever run test, failed , output shows value set true actual value false private list<item> _items; public list<item> items { { return _items; } } public inventory() { _items = new list<item>(); } this add items sword in inventory public void put(item itm) { // list<item> items = new list<item>(); items.add(itm); } this returns true if item in inventory public bool hasitem(string id) { // item itm = null; // put(itm); bool hasitem = false; foreach (item ident in _items) { if (item.equals(ident, id.tolower())) { hasitem = true; } } return hasitem; } it takes item inventorey doesnn't remove public item take(string id) { foreach (item itm in items) { if (item.equals(id, id.tolower())) ...

hardware - Ubuntu can't find the PICKIT3 driver -

i kind of beginner in ubuntu. i've installed mplab x v3.65 can't find pickit3 driver. enter image description here does know way program pic pickit3 on ubuntu? thanks.

node.js - Request within a request in nodejs -

i using request library in nodejs. need call new url within request not able join response asynchronouse. how send variable a in below request containing result of request within request. request({ url: url, json: true }, function (error, response, body) { var = []; a.push(response); (i = 0; < a.length; i++) { if (a.somecondition === "rightcondition") { request({ url: url2, json: true }, function (error, response, body) { a.push(response); }); } } res.send(a); }); your code seems right want. sending response in wrong callback. move sends after second request has completed: request({ url: url, json: true }, function (error, response, body) { var = []; a.push(response); request({ url: url2, json: true }, function (error, response, body) { for(i=0;i<a.length;i++){ if(a....

Can't extract mp3 audio from video with ffmpeg -

my input .mp4 video file. try #1 ffmpeg -i pipe:0 -y -map media/73.mp3 error: ffmpeg version 3.3.3 copyright (c) 2000-2017 ffmpeg developers built apple llvm version 8.1.0 (clang-802.0.42) configuration: --prefix=/usr/local/cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-vda libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libavresample 3. 5. 0 / 3. 5. 0 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f977d800000] stream 1, offset 0xa8: partial file [mov,mp4,m4a,3gp,3g...

python - Google Earth Engine : Exporting MODIS images from GEE to AWS S3 bucket -

i working on machine learning project uses modis dataset. pc doesn't meet computational requirements of project, had taken aws server. problem earth engine exporting images google drive or google cloud storage want them exported s3 bucket. i have come across answers suggesting download data local storage , upload them s3 bucket. given huge datasets , poor data speed, take me ages so. hence want export them s3 bucket directly using earth engine. i have gone through documentation exporting happens ( ee.batch.export.image ). thinking of writing function exports geotiff images aws s3 bucket instead of google drive or cloud storage. p.s. i have verified amazon modis public datasets , datasets want (mod09a1 , few others) aren't offered amazon. i have windows 10 installed on pc. modis imagery on aws s3 ( https://aws.amazon.com/public-datasets/modis/ ) however, interesting question other data set , here few things consider 1) google earth engine can write on...

How to convert jQuery to JavaScript? -

i need convert code javascript: $(function(){ $("#include_header").load("includes/header.html"); $("#include_footer").load("footer.html"); }); issue is, beginner javascript , can't figure out how... in javascript? it's jquery. try sample: window.addeventlistener('domcontentloaded', function() { console.log('window - domcontentloaded - capture'); var xhr = new xmlhttprequest(); //ajax request xhr.open('get', 'includes/header.html'); xhr.onload = function() { if (xhr.status === 200) { document.getelementbyid('include_header').innerhtml =xhr.responsetext; } else { alert('request failed. returned status of ' + xhr.status); } }; xhr.send(); //second request var xhr = new xmlhttprequest(); //ajax request xhr.open('get', 'footer.html'); xhr.onload = function() { if (xhr.status === 200) { ...

functional programming - Limit recursion to the first three elements of list of floats -

i'm new functional programming (reasonml / ocaml). i have list of floats. want first 3 non-zero items of list , no more. items can positive, negative, , zero. how can recursion limited until first 3 non-zero floats extracted? i thinking of doing like: switch (list) { | [first, second, third, ...rest] => (first +. second +. third) /. 3.0 | _ => 0.0 }; but how can guarantee first , second , , third non-zero floats? , if are, discard them recursively until 3 non-zero floats found -- or return 0.0 . a nicer way using recursion make more generic: instead of finding 3 first non-zero, let's find n first non-zero. below ocaml implementation, don't know reason. let rec find_n l n ~f = if n = 0 [] else match l | [] -> failwith "cannot find enough items" | h::t -> if f h h :: (find_n t (n-1) ~f) else find_n (t n ~f) here's function's signature: val find_n : 'a list -> int -...

python - Pandas groupy on series with intervals -

here example point : missing_values=-999.0 level1=pd._libs.interval.interval(-np.inf, 1, closed='right') level2=pd._libs.interval.interval(1,np.inf, closed='right') data=pd.dataframe({'a':[level1,missing_values,level2]}) >>> data 0 (-inf, 1] 1 -999 2 (1, inf] and when try data.groupby(['a']).count() , goes wrong typeerror: unorderable types: interval() > float() but if set -999 @ first line, or set 3 interval levels, can run! >>> data 0 -999 1 (-inf, 1] 2 (1, inf] >>> data.groupby(['a']).count() -999.0 1 (-inf, 1] 1 (1, inf] 1 >>> data 0 (-inf, 1] 1 -999 2 (1, 2] 3 (2, inf] >>> data.groupby(['a']).count() (-inf, 1] 1 -999.0 1 (1, 2] 1 (2, inf] 1 name: a, dtype: int64 that means groupby can sort interval , float? typeerror means? i'm not sure groupby works intervals , ...

java - Trying to debug int arrays -

i'm trying put little game concept in java, , have encountered strange problem; int arrays don't seem storing values in parts of code! (using netbeans 8.2) suspect small , tedious have missed. constructor basic creature. see "addtrait" method? focus. public creature(string inputname) { if(debug>0){system.out.println("debug: creature ");} creaturename = inputname; size = 1; population = 1; addtrait(new trait("test",0,new int[]{4,4,4,4,4,4}),0); addtrait(new trait("empty",0,new int[]{0,0,0,0,0,0}),1); addtrait(new trait("empty",0,new int[]{0,0,0,0,0,0}),2); } this method in creature class. public void addtrait(trait newtrait, int slotnum) { mytraits[slotnum] = newtrait; if(debug>0){system.out.println("debug: creature > " + "addtrait > mytraits["+slotnum+"].getname() = "+ mytraits[slotnum].getname());} f...

python - Import Math Module on Aptana Studio 3 -

i using aptana studio 3 self-learn python. try write program solves quadratic equations , need use sqrt() function math module. however, try import math, compiler shows "unused import". try download , install module online can't find sources seem solve problem. wish help, thanks!

java - Using Application Config file in android -

i porting java project android. has jar library uses config file (xml). java application, xml has placed application jar or in folder jar library present. when using in android studio, unable find should place xml file. xml read jar library automatically, don't have write code read values jar. i tried placing jar mainactivity.java file , in "libs" folder jar library present. shows error: config file not found i using android studio 2.3.3 what doing wrong?

bluetooth - How to set specific range in start monitoring beacon region ? (iOS) -

i want set range when user enter region using app. example, entering region in 300m far beacon ( now, distance based on beacon signal strength ). , then, notification comes. in case, app killed. so, using startmonitoring() . my questions : 1. possible set maximum distance entering region? if yes, how set ? if i enter region , i kill app . how give notification enter region ?

Error (timeout?) when loading data into Vora 1.4 -

i'm trying create vora table , append data orc file. far hit couple issues. appending data using gui (vora tools - modeler - append) seems ignore "orc" setting made in dialog. looks bug. when trying append multiple orc files total of 29mio records, following message presented: sap.hanavora.jdbc.voraexception: hl(9): runtime error. (could not handle api call, failure reason : execution of scheduler plan failed: internal error message: ttl exceeded, no response received: ttl=2m0s, task=1, nodes=[120];caught exception during execution of abort plan : generic runtime error.(tx_id:31)) error code 0, status error_status it doesn't matter engine use, relational or disk, message appears anyway. there timeout setting configure? update: details on issue #2. tx coordinator log has got following: 2017-09-18 09:54:17.088741|+1000|error|error @ processing of api call|tc103|hana v2 api|140657103492864|processrequest|v2net_request_handler.cpp(73) ... 2017-09-18 09:57...

Angularjs node js mysql crud -

i want build crud web application using mysql nodejs , angularjs. please tell me how this. i tried build application i'm facing many problems , errors. you need create simple nodejs application mysql database. client side first use simple html , check application whether it's working or not. help code here, example of nodejs mysql then try create client side interface using angular there no changes server side code need create user interface @ client side using angular. start application in angular here

JavaScript: Getting random location on globe -

i trying create function returns random point on globe. when try following code, ends bunching more of points @ poles , fewer @ equator. function random_location() { return { lon: math.floor(math.random() * 360) - 179, lat: math.floor(math.random() * 181) - 90 } } (var = 0; < 100; i++) { var location = random_location(); // } how should this? note: point might on sphere size of earth, other size. need create randomly evenly distributed latitude , longitude. from http://mathworld.wolfram.com/spherepointpicking.html : function random_location() { return { lon: math.floor(math.random()*360) - 180, lat: math.round(math.acos(2*math.random() - 1)*180/math.pi) - 90 } }

python - redirect reverse in Django -

i'm working on django 1.11 i want redirect user view. contents of myapp/accounts/urls.py app_name = 'accounts' urlpatterns = [ url(r'^$', views.profileview.as_view(), name='profile'), url(r'^profile/', views.profileview.as_view(), name='profile') ] and in myapp/accounts/views.py from django.contrib.auth.models import user # create views here. django.http import httpresponseredirect django.urls import reverse django.views.generic import templateview, updateview class profileview(templateview): template_name = 'accounts/profile.html' class updateprofile(updateview): model = user fields = ['first_name', 'last_name'] template_name = 'accounts/update.html' def get_object(self): return self.request.user def get_success_url(self): messages.success(self.request, 'profile updated successfully') return httpresponseredirect(reverse('pr...

voip - iOS pushKit pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials neverCall in Individual devices -

is open capabilities -push notifications open background mode : voice on ip open backgroud fetch open remote notifications open location updaete open; code : enter image description here delegate <pkpushregistrydelegate> observe device (especially small probability) never call didupdatepushcredentials() mothod, tested many times, (uninstall app, install app),it never call method, when restart device method called, has ever been fall in situation? can explain this?

c# - OutOfMemoryException on drawing bezier curves in WinForms -

while drawing bezier curve following data, shows outofmemoryexception graphics g = e.graphics; pointf pf0, pf1, pf2, pf3; pen pen = new pen(color.black); pen.width = 2; pf0 = new pointf(153.649292f, 141.85f); pf1 = new pointf(153.650925f, 141.848969f); pf2 = new pointf(153.652557f, 141.848465f); pf3 = new pointf(153.65419f, 141.848465f); g.drawbezier(pen, pf0, pf1, pf2, pf3); if pen.width changed 1.5f, curve drawn without showing exception. possible way avoid exception?

android - How can I get custom unmodified list after changing its list object data in java -

// here have list // how can prevent list modified after object data changed want have unmodified original list without updating data. have used arraylist , collection.unmofifiedlist also how can original list i.e. "s age"- 10 "s age"- abc "s name "- 30 "s name "- xyz student s1 = new student(); s1.setage(10); s1.setname("abc"); student s2 = new student(); s2.setage(30); s2.setname("xyz"); arraylist<student> al = new arraylist<student>(); al.add(s1); al.add(s2); // here getting list data for(int i=0; i<al.size(); i++) { system.out.println("f age " + al.get(i).getage()); system.out.println("f name " + al.get(i).getname()); } student s3 = new student(); s3 = al.get(0); s3.setage(50); s3.setname("shyam"); for(int i=0;i< al.size(); i++) { system.out.println("s age " + al.get(i).getage()); system.out.println("s name " + al.get(i...