loops

Styling only one element in an array, in Leaflet's pointToLayer

二次信任 提交于 2020-01-25 05:10:10
问题 I'm trying to only style one element in an array and apply it to pointToLayer , while the other elements in the array stay at a default parameter. Specifically, I'm trying to have the most recent earthquake point to have a radius weight of 3 while leaving the remainder earthquake points with a radius weight of 1. Here is a picture of my legend/points on the map. As you can see Recent is identified with a larger radius weight. I thought the best way to do this was to create a function and call

How can I catch an exception in an enhanced for loop and restart the process for this loop?

断了今生、忘了曾经 提交于 2020-01-25 02:28:15
问题 I have started working with enhanced for loops due to it's best practices and habilities to work with ArrayLists . My code basically gets an ArrayList that contains links to songs and parses this list downloading the songs. One of the exceptions thrown is the TimeoutException, whitch normally happens when the server is overloaded or there's an instability with the internet connection. To clarify: try { for(Track track : album.getTracks()) { songdown.downloadTrack(track, directorio,

sed replace variables while read lines

♀尐吖头ヾ 提交于 2020-01-25 00:07:15
问题 I'm working on a shell script and i need to change some strings from different lines of a file into a while read statement. The structure need to be like this, because the String_Search and String_result will be calculated on each line. while read line do varA="String_Search" resA="String_Result" line=`echo $line | sed -e "s/$varA/$resA"` echo $line >> outputFile.txt done < "inputFile.txt" The script doesn't works and its showing to me this error message: sed: -e expression #1, char 31:

sed replace variables while read lines

微笑、不失礼 提交于 2020-01-25 00:06:44
问题 I'm working on a shell script and i need to change some strings from different lines of a file into a while read statement. The structure need to be like this, because the String_Search and String_result will be calculated on each line. while read line do varA="String_Search" resA="String_Result" line=`echo $line | sed -e "s/$varA/$resA"` echo $line >> outputFile.txt done < "inputFile.txt" The script doesn't works and its showing to me this error message: sed: -e expression #1, char 31:

SSIS foreach loop enumerator empty is empty - only when deployed

本小妞迷上赌 提交于 2020-01-24 22:08:53
问题 In SSIS I am using a Foreach loop container to loop through a list of files. My project works fine in locally - it finds the files, but when I deploy to SSMS and run it, it gives the error: The for each file enumerator is empty. The for each file enumerator did not find any files that match the pattern, or specified directory was empty. The directory I am pointing to is a network location I have permissions on this directory. Has anyone experience this issue before? 来源: https://stackoverflow

How to stack individual raster layers from files contained in individual subfolders in R?

旧巷老猫 提交于 2020-01-24 21:48:28
问题 I am working with raster layers. I have 10 subfolders in a parent folder. Each of the subfolders contains hundreds of raster. I would like to apply a script for each of the subfolders and to create several stacks for each of my subfolders. #List all my subfolders in my parent folder list_dirs<- list.dirs(path/parentfolder/, recursive = F) for (i in list_dir){ # set the working directory to the subfolder i setwd(i) # List all the files with a certain pattern in the subfolder i s<- list.files

Python For…loop iteration

跟風遠走 提交于 2020-01-24 21:42:26
问题 Alright, I have this program to sparse code in Newick Format, which extracts both a name, and a distance for use in a phylogenetic tree diagram. What my problem is, in this branch of code, as the program reads through the newickNode function, it assigns the name and distance to the 'node' variable, then returns it back into the 'Node' class to be printed, but it seems to only print the first node 'A', and skips the other 3. Is there anyway to finish the for loop in newickNode to read the

How to create 10 random rasters in R?

不羁岁月 提交于 2020-01-24 21:26:05
问题 I am looking to generate several random raster in a loop that I plan to store. I tried something (below) that but it does not work: r1= raster(nrows = 1, ncols = 1, res = 0.5, xmn = -1.5, xmx = 1.5, ymn = -1.5, ymx = 1.5, vals = 0.3) a<- 10 for (i in 1:length(a)){ values(r1[i]) = round(runif(ncell(r1[i]), 0, 1))} Thanks for any help. 回答1: There's a much simpler way: library(raster) r1 <- raster(nrows = 1, ncols = 1, res = 0.5, xmn = -1.5, xmx = 1.5, ymn = -1.5, ymx = 1.5, vals = 0.3) rr <-

SwiftUI: How do I loop through an array of Int inside “For Each”

允我心安 提交于 2020-01-24 19:25:53
问题 I am getting the following error "Closure containing control flow statement cannot be used with function builder 'ViewBuilder'" Not able to find similar troubleshoot anywhere. struct FavoriteView: View { @EnvironmentObject var userData: UserData @State var isfavorite = false var favoriteindex = [1,2,3] var body: some View { NavigationView { List { ForEach(userData.labvaluesUserdata) {section in for numbers in favoriteindex { if section.id == (numbers) { ItemRow(list: section) } } } } } } }

SwiftUI: How do I loop through an array of Int inside “For Each”

跟風遠走 提交于 2020-01-24 19:24:05
问题 I am getting the following error "Closure containing control flow statement cannot be used with function builder 'ViewBuilder'" Not able to find similar troubleshoot anywhere. struct FavoriteView: View { @EnvironmentObject var userData: UserData @State var isfavorite = false var favoriteindex = [1,2,3] var body: some View { NavigationView { List { ForEach(userData.labvaluesUserdata) {section in for numbers in favoriteindex { if section.id == (numbers) { ItemRow(list: section) } } } } } } }