Posts

android - AsyncTaskLoader not initialized after screen rotation -

i using recyclerview getting data adapter gets data trough asynctaskloader. runs fine until rotate screen portrait landscape. @ point nullpointer exception when using .forceload(); on asynctaskloader have absolutelly no idea why fileloader null when same oncreate method called regardless of orientation , works on portrait , doesnt on landscape. here code: package sk.tomus.filescoper; import android.content.activitynotfoundexception; import android.content.intent; import android.content.sharedpreferences; import android.net.uri; import android.preference.preferencemanager; import android.support.v4.app.loadermanager; import android.support.v4.content.loader; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.support.v7.widget.gridlayoutmanager; import android.support.v7.widget.linearlayoutmanager; import android.support.v7.widget.recyclerview; import android.util.log; import android.view.view; import android.widget.toast; import java.io.f...

input - Avoid re-loading datasets within a reactive in shiny -

i have shiny app requires input 1 of several files. simplified example be: library(shiny) x <- matrix(rnorm(20), ncol=2) y <- matrix(rnorm(10), ncol=4) write.csv(x, 'test_x.csv') write.csv(y, 'test_y.csv') runapp(list(ui = fluidpage( titlepanel("choose dataset"), sidebarlayout( sidebarpanel( selectinput("data", "dataset", c("x", "y"), selected="x") ), mainpanel( tableoutput('contents') ) ) ) , server = function(input, output, session){ mydata <- reactive({ infile <- paste0("test_", input$data, ".csv") data <- read.csv(infile, header=false) data }) output$contents <- rendertable({ mydata() }) })) in reality, files read in large, avoid reading them in each time input$data changes, if has been done once. example, making matrices mat_x , mat_y available within environment, , withi...

ssl - Gitlab pages and Jekyll - issue with set up TLS Lets Encrypted -

i try add ssl/tls on static web site. use gitlab static pages, , jekyll content. follow instructions set tls - gitlab tutorial . i stack on part - got 404 error gitlab pages once build finishes, test again if working well: # note we're using actual domain, not localhost anymore $ curl http://yourdomain.org/.well-known/acme-challenge/5tbu788fw0tq5eowzmdu1gv3e9c33gxjv58hvtwtbdm the problem next generated certificate command ./letsencrypt-auto certonly -a manual -d example.com created custom page letsencrypt-setup.html in root directory whit appropriate content. i run jekyll build command , created _site/.well-known/acme-challenge/5tbu788fw0tq5eowzmdu1gv3e9c33gxjv58hvtwtbdm.html page. when run curl command page worked , without .html extension - both commands work, , return appropriate value curl http://localhost:4000/.well-known/acme-challenge/5tbu788fw0tq5eowzmdu1gv3e9c33gxjv58hvtwtbdm curl http://localhost:4000/.well-known/acme-challenge/5tbu788fw0tq5eo...

How to create individual chunks when using #+ with spin function in knitr R package -

when using #+ spin cannot separate chunks. for example if r script 1 below: #+ data(cars) #+ cars #+ plot(cars$speed, cars$dist) i get: ```{r } data(cars) ```{r } cars ```{r } plot(cars$speed, cars$dist) ``` but not separate chunks, commands embedded in same chunk. how can separate chunks spin?

C: Accessing pointer to pointer to struct element from pointer to structure -

i want access members of struct double pointer error "error: expected identifier before ‘(’ token" c double pointer structure double pointer struct inside struct : struct test{ struct foo **val; }; struct foo{ int a; } int main (){ struct test *ptr = (struct test *)malloc(sizeof(struct test)); ptr->val = &foo; /*foo malloced , populated*/ printf ("value of %d", ptr->(*val)->a); } i've tried: *ptr.(**foo).a you want this: #include <stdio.h> #include <stdlib.h> struct test { struct foo **val; }; struct foo { int a; }; int main(void) { struct test* test_ptr = malloc(sizeof(struct test)); struct foo* foo_ptr = malloc(sizeof(struct foo)); foo_ptr->a = 5; // equivalent (*foo_ptr).a = 5; test_ptr->val = &foo_ptr; printf ("value of %d\n", (*(test_ptr->val))->a); free(test_ptr); free(foo_ptr); return 0; } output: c02qt2ubfvh...

How to embed a map into Netlogo using GIS extension? -

the format of map imported should preferably ".shp" file.also please tell how create such file. have tried kml didn't work. yes, vectors need .shp imported. can create vector files in gis programs (arcgis, qgis, etc) , export .shp. or there's online tools converting kml .shp (eg http://www.zonums.com/online/kml2shp.php ) raster files need saved .asc or .grd use dataset in netlogo.

How to extract text in square brackets from string in JavaScript? -

how can extract text between pairs of square brackets string "[a][b][c][d][e]" , can following results: → array: ["a", "b", "c", "d", "e"] → string: "abcde" i have tried following regular expressions , no avail: → (?<=\[)(.*?)(?=\]) → \[(.*?)\] i don't know text expecting in string of array, example you've given. var arrstr = "[a][b][c][d][e]"; var arr = arrstr.match(/[a-z]/g) --> [ 'a', 'b', 'c', 'd', 'e' ] typeof 'array' can use `.concat()` on produced array combine them string. if you're expecting multiple characters between square brackets, regex can (/[a-z]+/g) or tweaked liking.