问:
How to rotate specific elements/labels on the y-axis with axis.text.y in ggplot?
Please, find My Data below.

I have produced this plot:

I would like the encircled "20%-point increase"-text on the y-axis to be rotated at angle=90 but keep the remaining text at angle=0.

I have used this script

```<code>ggplot(as.data.frame(nd), aes(x = lnd))  +

  geom_area(aes(y = y), data = function(x) subset(x, lnd >= 0 & lnd <=10),fill="#2C77BF", alpha=0.3) +
  geom_area(aes(y = y), data = function(x) subset(x, lnd >= 10 & lnd <= 25),fill="#E38072", alpha=0.3) +
  geom_area(aes(y = y), data = function(x) subset(x, lnd >= 25 & lnd <= 100),fill="#6DBCC3", alpha=0.3) +

  geom_line(aes(y = y, col = lnd),size=1) +

  geom_segment(aes(x = 0, y = 0.3479943, xend = 0, yend = 0.2), lty="solid", size=0.9, color="black") +
  geom_point(mapping = aes(x = 0, y = 0.3479943), size=4, shape=20, col="black", alpha=0.5) +

  ggtitle("", subtitle = "Risk") + scale_x_continuous(name="", breaks=seq(0,100,by=10), limits=c(0,100), label=c("LND 0% \nn=664","10%","20%", "30%", "40%","50%","60%","70%","80%","90%","100%")) +

  scale_y_continuous(name = "", breaks = seq(0.35,1,by=.1), labels=c("35%","20%-point\nincrease","55%","20%-point\nincrease","75%","20%-point\nincrease","95%")) +

  coord_cartesian(ylim=c(0.25,1)) +

  annotate("text", x = 5, y = 0.3, label = "LND 0 - \u226410%\nn=427", fontface=2,cex=3.5, colour="#2C77BF") +
  annotate("text", x = 17.5, y = 0.3, label = "LND 10 - 25%\nn=195", fontface=2,cex=3.5, colour="#E38072") +
  annotate("text", x = 30, y = 0.3, label = "LND \u226525%\nn=91", fontface=2,cex=3.5, colour="#6DBCC3") +

theme(axis.text.x = element_text(colour="grey20",size=11,face=c("bold","plain","plain","plain","plain","plain","plain","plain","plain","plain","plain")),
      axis.title.x = element_text(color = "grey20", size = 11, face="bold", margin=ggplot2::margin(t=12)),
      axis.text.y = element_text(color = c("grey","black","grey","black","grey","black","grey"),angle = 0, size = 11),
      axis.title.y = element_text(color = "grey20", size = 14, face="bold", margin=ggplot2::margin(r=12)),
      plot.title = element_text(color = "grey20", size = 18,face="bold",hjust = 0.5),
      plot.subtitle = element_text(hjust = 0.5),
      legend.text=element_text(size=12), legend.title=element_text(size=14), legend.position="none")
</code>```

I simply tried ...,angle=c(0,90,0,90,0,90,0),... but I received this error: "I if (0 <= angle & angle < 90) { :.... length >1 and only the first element will be used"

Any solutions on how to angle some of the y-axis text?

```<code>My data

nd <- structure(list(y = c(0.347994323433218, 0.374015418531899, 0.399629966119251,
                     0.421742599051725, 0.44036657229005, 0.457260948328608, 0.474417648309559,
                     0.493640865541709, 0.51488973428659, 0.537423493454801, 0.560430703662936,
                     0.583045245963954, 0.604403317363394, 0.624118977779026, 0.642197094829998,
                     0.658675856783435, 0.673612299496595, 0.687077654264746, 0.699153267191595,
                     0.709927163750076, 0.719491270455802, 0.727939260908065, 0.735364964416906,
                     0.741861259442995, 0.747519368138831, 0.752428469501541, 0.756675554521809,
                     0.760345455237322, 0.763520989282281, 0.766283171326885, 0.768711452044572,
                     0.770883953521034, 0.772877677101532, 0.774768665456197, 0.776627848464512,
                     0.778481560816502, 0.780330067279974, 0.782173296838651, 0.784011178693879,
                     0.785843642275446, 0.787670617252314, 0.78949203354347, 0.791307821328959,
                     0.793117911060613, 0.794922233473425, 0.796720719596049, 0.798513300762498,
                     0.800299908622762, 0.802080475154149, 0.803854932672504, 0.805623213843368,
                     0.807385251693197, 0.809140979620611, 0.810890331407796, 0.812633241231531,
                     0.814369643674837, 0.816099473738181, 0.81782266685046, 0.819539158880875,
                     0.821248886149957, 0.822951785441022, 0.824647794011433, 0.826336849604117,
                     0.828018890458497, 0.829693855322157, 0.831361683462205, 0.833022314676256,
                     0.834675689303694, 0.836321748237183, 0.837960432933643, 0.839591685425587,
                     0.841215448331989, 0.84283166486968, 0.844440278864124, 0.846041234760886,
                     0.847634477636162, 0.849219953207282, 0.850797607844881, 0.852367388582385,
                     0.853929243127316, 0.855483119871763, 0.857028967903429, 0.858566737015336,
                     0.860096377717062, 0.861617841244557, 0.863131079570552, 0.864636045414574,
                     0.866132692253169, 0.867620974331152, 0.869100846667809, 0.870572265071487,
                     0.872035186145084, 0.873489567298754, 0.874935366756863, 0.87637254356889,
                     0.877801057617996, 0.879220869629812, 0.8806319411832, 0.882034234714961,
                     0.883427713533749, 0.884812341823933), lnd = c(0, 1, 2, 3, 4,
                                                                    5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
                                                                    22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
                                                                    38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
                                                                    54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
                                                                    70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
                                                                    86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100)), row.names = c(NA,
                                                                                -101L), class = c("data.table", "data.frame"))
</code>```

答:
First, I took the liberty to reorganize the dataframe a little bit to simplify the plotting code:

```<code>library(tidyverse)

nd2 <- nd %>% mutate(lnd_cat = as.factor(case_when(lnd >= 0 & lnd <=10 ~ 1,
                                  lnd >= 10 & lnd <=25 ~ 2,
                                  lnd >= 25 & lnd <= 100 ~ 3)))
</code>```

And then the plot itself:

Despite the warning() you can actually provide a vector of integers to the angle subargument of axis.text. To align the 'angled' y-axis labels to the ticks, I have used hjust = 0.5.

```<code>ggplot(data = nd2, aes(x = lnd, y=y))  +
  geom_area(aes(group = lnd_cat, fill = lnd_cat, alpha = 0.3)) +
  scale_fill_manual(values = c("#2C77BF","#E38072", "#6DBCC3")) +
  geom_line() +
  ggtitle(label = " ", subtitle = "Risk") +
  scale_x_continuous(breaks=seq(0,100,by=10), lim = c(0,100), label=c("LND 0% \nn=664","10%","20%", "30%", "40%","50%","60%","70%","80%","90%","100%")) +
  scale_y_continuous(breaks = seq(0.35,1,by=.1), labels=c("35%","20%-point\nincrease","55%","20%-point\nincrease","75%","20%-point\nincrease","95%")) +

  coord_cartesian(ylim=c(0.25,1)) +

  annotate("text", x = c(5, 17.5, 30), y = 0.3,
           label = c("LND 0 - \u226410%\nn=427","LND 10 - 25%\nn=195","LND \u226525%\nn=91"),
           fontface=2, cex=3.5,
           colour=c("#2C77BF","#E38072", "#6DBCC3" )) +

  theme(axis.text.x = element_text(colour="grey20",face=c("bold", rep("plain", 10))),
        axis.text.y = element_text(color = c(rep(c("grey","black"), 3) ,"grey"),
        angle = c(0, 90), hjust = 0.5),   # <-- the integer vector will be reused
        axis.title = element_blank(),
        plot.subtitle = element_text(hjust = 0.5),
        legend.position="none")
</code>```

I know the solution is a bit messy, however, it works.

Body:
Please, find My Data below.

I have produced this plot:

I would like the encircled "20%-point increase"-text on the y-axis to be rotated at angle=90 but keep the remaining text at angle=0.

I have used this script

ggplot(as.data.frame(nd), aes(x = lnd))  +

  geom_area(aes(y = y), data = function(x) subset(x, lnd >= 0 & lnd <=10),fill="#2C77BF", alpha=0.3) +
  geom_area(aes(y = y), data = function(x) subset(x, lnd >= 10 & lnd <= 25),fill="#E38072", alpha=0.3) +
  geom_area(aes(y = y), data = function(x) subset(x, lnd >= 25 & lnd <= 100),fill="#6DBCC3", alpha=0.3) +

  geom_line(aes(y = y, col = lnd),size=1) +

  geom_segment(aes(x = 0, y = 0.3479943, xend = 0, yend = 0.2), lty="solid", size=0.9, color="black") +
  geom_point(mapping = aes(x = 0, y = 0.3479943), size=4, shape=20, col="black", alpha=0.5) +

  ggtitle("", subtitle = "Risk") + scale_x_continuous(name="", breaks=seq(0,100,by=10), limits=c(0,100), label=c("LND 0% \nn=664","10%","20%", "30%", "40%","50%","60%","70%","80%","90%","100%")) +

  scale_y_continuous(name = "", breaks = seq(0.35,1,by=.1), labels=c("35%","20%-point\nincrease","55%","20%-point\nincrease","75%","20%-point\nincrease","95%")) +

  coord_cartesian(ylim=c(0.25,1)) +

  annotate("text", x = 5, y = 0.3, label = "LND 0 - \u226410%\nn=427", fontface=2,cex=3.5, colour="#2C77BF") +
  annotate("text", x = 17.5, y = 0.3, label = "LND 10 - 25%\nn=195", fontface=2,cex=3.5, colour="#E38072") +
  annotate("text", x = 30, y = 0.3, label = "LND \u226525%\nn=91", fontface=2,cex=3.5, colour="#6DBCC3") +

theme(axis.text.x = element_text(colour="grey20",size=11,face=c("bold","plain","plain","plain","plain","plain","plain","plain","plain","plain","plain")),
      axis.title.x = element_text(color = "grey20", size = 11, face="bold", margin=ggplot2::margin(t=12)),
      axis.text.y = element_text(color = c("grey","black","grey","black","grey","black","grey"),angle = 0, size = 11),
      axis.title.y = element_text(color = "grey20", size = 14, face="bold", margin=ggplot2::margin(r=12)),
      plot.title = element_text(color = "grey20", size = 18,face="bold",hjust = 0.5),
      plot.subtitle = element_text(hjust = 0.5),
      legend.text=element_text(size=12), legend.title=element_text(size=14), legend.position="none")

I simply tried ...,angle=c(0,90,0,90,0,90,0),... but I received this error: "I if (0 <= angle & angle < 90) { :.... length >1 and only the first element will be used"

Any solutions on how to angle some of the y-axis text?

My data

nd <- structure(list(y = c(0.347994323433218, 0.374015418531899, 0.399629966119251,
                     0.421742599051725, 0.44036657229005, 0.457260948328608, 0.474417648309559,
                     0.493640865541709, 0.51488973428659, 0.537423493454801, 0.560430703662936,
                     0.583045245963954, 0.604403317363394, 0.624118977779026, 0.642197094829998,
                     0.658675856783435, 0.673612299496595, 0.687077654264746, 0.699153267191595,
                     0.709927163750076, 0.719491270455802, 0.727939260908065, 0.735364964416906,
                     0.741861259442995, 0.747519368138831, 0.752428469501541, 0.756675554521809,
                     0.760345455237322, 0.763520989282281, 0.766283171326885, 0.768711452044572,
                     0.770883953521034, 0.772877677101532, 0.774768665456197, 0.776627848464512,
                     0.778481560816502, 0.780330067279974, 0.782173296838651, 0.784011178693879,
                     0.785843642275446, 0.787670617252314, 0.78949203354347, 0.791307821328959,
                     0.793117911060613, 0.794922233473425, 0.796720719596049, 0.798513300762498,
                     0.800299908622762, 0.802080475154149, 0.803854932672504, 0.805623213843368,
                     0.807385251693197, 0.809140979620611, 0.810890331407796, 0.812633241231531,
                     0.814369643674837, 0.816099473738181, 0.81782266685046, 0.819539158880875,
                     0.821248886149957, 0.822951785441022, 0.824647794011433, 0.826336849604117,
                     0.828018890458497, 0.829693855322157, 0.831361683462205, 0.833022314676256,
                     0.834675689303694, 0.836321748237183, 0.837960432933643, 0.839591685425587,
                     0.841215448331989, 0.84283166486968, 0.844440278864124, 0.846041234760886,
                     0.847634477636162, 0.849219953207282, 0.850797607844881, 0.852367388582385,
                     0.853929243127316, 0.855483119871763, 0.857028967903429, 0.858566737015336,
                     0.860096377717062, 0.861617841244557, 0.863131079570552, 0.864636045414574,
                     0.866132692253169, 0.867620974331152, 0.869100846667809, 0.870572265071487,
                     0.872035186145084, 0.873489567298754, 0.874935366756863, 0.87637254356889,
                     0.877801057617996, 0.879220869629812, 0.8806319411832, 0.882034234714961,
                     0.883427713533749, 0.884812341823933), lnd = c(0, 1, 2, 3, 4,
                                                                    5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
                                                                    22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
                                                                    38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
                                                                    54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
                                                                    70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
                                                                    86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100)), row.names = c(NA,
                                                                                -101L), class = c("data.table", "data.frame"))

Body:
First, I took the liberty to reorganize the dataframe a little bit to simplify the plotting code:

library(tidyverse)

nd2 <- nd %>% mutate(lnd_cat = as.factor(case_when(lnd >= 0 & lnd <=10 ~ 1,
                                  lnd >= 10 & lnd <=25 ~ 2,
                                  lnd >= 25 & lnd <= 100 ~ 3)))

And then the plot itself:

Despite the warning() you can actually provide a vector of integers to the angle subargument of axis.text. To align the 'angled' y-axis labels to the ticks, I have used hjust = 0.5.

ggplot(data = nd2, aes(x = lnd, y=y))  +
  geom_area(aes(group = lnd_cat, fill = lnd_cat, alpha = 0.3)) +
  scale_fill_manual(values = c("#2C77BF","#E38072", "#6DBCC3")) +
  geom_line() +
  ggtitle(label = " ", subtitle = "Risk") +
  scale_x_continuous(breaks=seq(0,100,by=10), lim = c(0,100), label=c("LND 0% \nn=664","10%","20%", "30%", "40%","50%","60%","70%","80%","90%","100%")) +
  scale_y_continuous(breaks = seq(0.35,1,by=.1), labels=c("35%","20%-point\nincrease","55%","20%-point\nincrease","75%","20%-point\nincrease","95%")) +

  coord_cartesian(ylim=c(0.25,1)) +

  annotate("text", x = c(5, 17.5, 30), y = 0.3,
           label = c("LND 0 - \u226410%\nn=427","LND 10 - 25%\nn=195","LND \u226525%\nn=91"),
           fontface=2, cex=3.5,
           colour=c("#2C77BF","#E38072", "#6DBCC3" )) +

  theme(axis.text.x = element_text(colour="grey20",face=c("bold", rep("plain", 10))),
        axis.text.y = element_text(color = c(rep(c("grey","black"), 3) ,"grey"),
        angle = c(0, 90), hjust = 0.5),   # <-- the integer vector will be reused
        axis.title = element_blank(),
        plot.subtitle = element_text(hjust = 0.5),
        legend.position="none")

I know the solution is a bit messy, however, it works.


来源: stackexchange

问:
Angular 8 Reactive Forms with reusable child-components example
I have created a solution on stackblitz.com using Angular Reactive Forms and child-components.
However, - I get an error, when using formControlName on Input elements. Can someone provide an example on how to use Reactive Forms and child-components?

Problem is in company.component.html

```<code><input type="text" formControlName="companyName">
</code>```

答:
You're using formControlName incorrectly.

formControlName is a HTML attribute for a FormGroup to interpret as it parses a template and attaches handlers, it doesn't require square brackets [].

This confusion arises often because you use the Angular input tag [formControl] to attach a standalone FormControl, i.e. [formControl]="myFormControl"

In addresss.component.html and company.component.html you need to change your formControlNames to the format: formControlName="{{formControlName}}"

Alternatively, you could create individual FormControls public StreetNameFormControl = new FormControl('') in those components and reference them with a format such as: [formControl]="StreetNameFormControl".

EDIT: As a side note, from experience, building forms this way will often lead to heartache. It is possible, but unless you really need to break down the form into these sub components, I'd advise not doing it. One problem you will likely face is populating the forms later, say for example if you want to reuse them to edit an existing entity. You will have to write custom code to pass values all the way down your components to populate them. On the other hand, if you have them as one FormGroup, you have convenience methods such as patchValue at your disposal.

ContentLicense: CC BY-SA 4.0

Body:
I have created a solution on stackblitz.com using Angular Reactive Forms and child-components.
However, - I get an error, when using formControlName on Input elements. Can someone provide an example on how to use Reactive Forms and child-components?

Problem is in company.component.html

<input type="text" formControlName="companyName">


问:
Regex with multiple square brackets
I'm working with some transcriptions and I've struggled with their normalization. Some of them have square brackets within other square brackets to specify the different noises / sound events that can be found when listening to the corresponding audio file. This is an example of one file's line:

```<code>U012_W038 [other_speech_adult: [laughter] yeah you can you can read [undefined] tomorrow] [other_speech_adult: are you recording me now] this is annoying eh [noise] [noise_bkgspeech/]
</code>```

In every line the format corresponds to

```<code><audio file reference> <transcription>
</code>```

My ideal output would be:

Get the text that is not enclosed by any square brackets: e.g: "this is annoying eh"

Extract the text that's inside of square brackets only if ":" is found. The text to catch would be the one after the colon. e.g: yeah you can you can read

The output should look something similar to this:

```<code>U012_W038 yeah you can you can read tomorrow are you recording me now this is annoying eh
</code>```

I tried to solve this problem using sed, but I wouldn't mind trying perl or any other text processing tool. My closest attempt so far is:

```<code>sed 's/\[[^]]*]//g'
</code>```

Do you think there's a way to solve this out by coding or it's to be by a manual checking?

Thanks in advance!

答:
Based on your example, something like

```<code>perl -pe 's/\[[a-z_]+:|\[[a-z_\/]+\]|\]//g' file
</code>```

This can be easily expressed in sed too, but the regex variations differ between dialects. If you have sed -E or sed -r, you could probably use this regex verbatim.

Title: Regex with multiple square brackets

Body:
I'm working with some transcriptions and I've struggled with their normalization. Some of them have square brackets within other square brackets to specify the different noises / sound events that can be found when listening to the corresponding audio file. This is an example of one file's line:

U012_W038 [other_speech_adult: [laughter] yeah you can you can read [undefined] tomorrow] [other_speech_adult: are you recording me now] this is annoying eh [noise] [noise_bkgspeech/]

In every line the format corresponds to

<audio file reference> <transcription>

My ideal output would be:

Get the text that is not enclosed by any square brackets: e.g: "this is annoying eh"

Extract the text that's inside of square brackets only if ":" is found. The text to catch would be the one after the colon. e.g: yeah you can you can read

The output should look something similar to this:

U012_W038 yeah you can you can read tomorrow are you recording me now this is annoying eh

I tried to solve this problem using sed, but I wouldn't mind trying perl or any other text processing tool. My closest attempt so far is:

sed 's/\[[^]]*]//g'

Do you think there's a way to solve this out by coding or it's to be by a manual checking?

Thanks in advance!

Body:
Based on your example, something like

perl -pe 's/\[[a-z_]+:|\[[a-z_\/]+\]|\]//g' file

This can be easily expressed in sed too, but the regex variations differ between dialects. If you have sed -E or sed -r, you could probably use this regex verbatim.


问:
How can I put user input into a list using eval?
thanks for helping.
I am having trouble with the following code:

```<code>digitsList = input("Enter any list of 0 or more digits in the form [digit, digit, ...]:")

if element == int(list[index]):
   index += 1
   return True

else:
   index += 1
   return False
</code>```

for example the user entered : [1,2,3]

then I get a following error :

```<code>ValueError: invalid literal for int() with base 10: '['
</code>```

I tried everything I can but not being able to solve it.

答:
Use following code:</p>

```<code>x = [i for i in eval(input("Enter comma seperated"))]
</code>```

ContentLicense: CC BY-SA 3.0

Body:
thanks for helping.
I am having trouble with the following code:

digitsList = input("Enter any list of 0 or more digits in the form [digit, digit, ...]:")

if element == int(list[index]):
   index += 1
   return True

else:
   index += 1
   return False

for example the user entered : [1,2,3]

then I get a following error :

ValueError: invalid literal for int() with base 10: '['

I tried everything I can but not being able to solve it.

Body:
Use following code:

x = [i for i in eval(input("Enter comma seperated"))]


问:
Using pattern matching to find String data with no digits in Java
Looking to match only String's with no digits, using \D from regex.

Every string shows as false, but why?

Output:

```<code>thufir@dur:~/NetBeansProjects/parseCSV$
thufir@dur:~/NetBeansProjects/parseCSV$ gradle run

> Task :run
Feb. 16, 2020 5:24:49 A.M. parseCSV.FileHelper processLines
INFO:           false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: z10               false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: y9                false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: x7                false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: atrib6            false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: alice             false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: home5             false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: cell4             false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: sue               false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: phone3            false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: phone2            false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: phone1            false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: joe               false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: people            false

BUILD SUCCESSFUL in 1s
3 actionable tasks: 1 executed, 2 up-to-date
thufir@dur:~/NetBeansProjects/parseCSV$
</code>```

relevant method from class:

```<code>public void processLines() {
    String regex = "\\D";
    boolean isDigit = false;
    for (String s : lines) {
        isDigit = Pattern.matches(regex, s);
        log.info(s + "\t\t" + Boolean.toString(isDigit)
        );

    }
</code>```

答:
You should be using the regex pattern ^\D+$, which matches one or more continuous non digit characters from start to end.  Since Pattern#matches implicitly covers the entire string, we can just use \D+:

```<code>public void processLines() {
    String regex = "\\D+";
    boolean isDigit = false;
    for (String s : lines) {
        isDigit = Pattern.matches(regex, s);
        log.info(s + "\t\t" + Boolean.toString(isDigit)
        );
    }
}
</code>```

Body:
Looking to match only String's with no digits, using \D from regex.

Every string shows as false, but why?

Output:

thufir@dur:~/NetBeansProjects/parseCSV$
thufir@dur:~/NetBeansProjects/parseCSV$ gradle run

> Task :run
Feb. 16, 2020 5:24:49 A.M. parseCSV.FileHelper processLines
INFO:           false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: z10               false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: y9                false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: x7                false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: atrib6            false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: alice             false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: home5             false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: cell4             false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: sue               false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: phone3            false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: phone2            false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: phone1            false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: joe               false
Feb. 16, 2020 5:24:50 A.M. parseCSV.FileHelper processLines
INFO: people            false

BUILD SUCCESSFUL in 1s
3 actionable tasks: 1 executed, 2 up-to-date
thufir@dur:~/NetBeansProjects/parseCSV$

relevant method from class:

public void processLines() {
    String regex = "\\D";
    boolean isDigit = false;
    for (String s : lines) {
        isDigit = Pattern.matches(regex, s);
        log.info(s + "\t\t" + Boolean.toString(isDigit)
        );

    }

Body:
You should be using the regex pattern ^\D+$, which matches one or more continuous non digit characters from start to end.  Since Pattern#matches implicitly covers the entire string, we can just use \D+:

public void processLines() {
    String regex = "\\D+";
    boolean isDigit = false;
    for (String s : lines) {
        isDigit = Pattern.matches(regex, s);
        log.info(s + "\t\t" + Boolean.toString(isDigit)
        );
    }
}


问:
Why do I get undefined function isset() on Laravel
we are using Laravel Excel package and running it on the queue (on Supervisor). Sometimes it works perfect and sometimes I get

Call to undefined function App\Imports\ isset() error

on failed jobs table. And ideas?

答:
You have used Turkish char i̇ on i̇sset replace it with isset will resolve your issue:

var_dump(mb_strtoupper('i̇sset')); //Your turkish i̇sset: string(7) "İSSET"
var_dump(mb_strtoupper('isset')); //Correct isset: string(5) "ISSET"
```


问:
Stopping MSI from launching an EXE in the SYSTEM context
I've got a problem here with an MSI deployment that I'm working on (using InstallShield). We have a program running in the background that needs to run per-user, and it needs to start automatically without user intervention.

The problem is with Group Policy Object/Active Directory (GPO/AD) deployment the application is started in the SYSTEM context before anyone is logged in rather than as the user who is about to log in. The application can only run once per user, and it seems that the SYSTEM process prevents the USER process from starting. This means the PCs need to be rebooted twice before the software can be deployed to the users. How do we to stop this?

Basically the current workflow is:

Installation/upgrade runs... kill background application

Install new files

Startup background application

This works for published applications and interactive MSI installations - it's only 'assigned' applications that seem to have the problem. As step 3 happens in the SYSTEM context rather than the user context :(

Ideally, I'd have the development team patch the EXE file to prevent launching in the SYSTEM context, but that's a release cycle away, and I'm looking for an installer-based solution for the interim.

(I don't know Installscript... So I'm guessing VBScript is probably the way to go if there's no native InstallShield stuff I can use.)

答:
I wouldn't rely on a Windows installer property to accomplish this. If I understand correctly you want to run an EXE file once per user - probably to set up user defaults? The only time you can guarantee that you are in the right context is when the user actually logs in. With the amount of impersonation going on these days in the average deployment scenario I just don't trust anything but a real user login as the correct stage to run EXE files.

There are too many problem sources: custom permission and priviledge lockdowns, terminal server lockdown, virtualization redirects, impersonation run by the deployment system, operating system overrides for registry writes etc...

Microsoft has a feature called Active Setup which will allow you to run "something runnable" once per user, on logon. This can be anything from a script to an executable. See my answer here for more details: Updating every profile's registry on Windows Server 2003

OwnerDisplayName: sascha

LastEditorDisplayName: Mark Biek


问:
React native TextInput isFocused method
I want to change background image dynamically.I tried to know TextInput is focused or not with this way.Also I tried this.text.current.isFocused().But It didn't help me.Anyone knows?

```<code>text={};

renderDrawerContent(){
  let  image = this.text.isFocused() ?  require('../assets/images/gyzyl.png') : require('../assets/images/BlackBack.jpg');
        return(
            <Container style={styles.containerDrawer}>
               <ImageBackground
                source={image}
                style={{flex:1}}
                resizeMode={'cover'}
                 >

                   <Content style={{ paddingTop: 0, }}>
                       <View style={{paddingTop: 20}}>
                           <View style={{flexDirection:'column' , marginVertical:5 ,padding:15}}>
                               <Text style={styles.search}>Search</Text>
                               <TextInput ref={ref => this.text=ref} autotFocus={this.state.Focused} underlineColorAndroid={'white'} placeholder='Cinema, Theatre, Concert ...' placeholderTextColor = '#fff' style={{color: '#fff', fontSize: 16 ,flex:1 , borderBottomColor: '#fff'}} />
                           </View>
                       </View>

                   </Content>

                </ImageBackground>
            </Container>

        );
}

</code>```

答:
You can use the onFocus event from textinput to do this along with onBlur.
Using this method you should add to your state object a value that tracks if the input is focused.

```<code><TextInput onFocus={()=> this.setState({inputFocused: true})} onBlur={()=> this.setState({inputFocused: false})}/>
</code>```

then just use your inputFocused to check if the input is focused or not

Title: React native TextInput isFocused method

Body:
I want to change background image dynamically.I tried to know TextInput is focused or not with this way.Also I tried this.text.current.isFocused().But It didn't help me.Anyone knows?

text={};

renderDrawerContent(){
  let  image = this.text.isFocused() ?  require('../assets/images/gyzyl.png') : require('../assets/images/BlackBack.jpg');
        return(
            <Container style={styles.containerDrawer}>
               <ImageBackground
                source={image}
                style={{flex:1}}
                resizeMode={'cover'}
                 >

                   <Content style={{ paddingTop: 0, }}>
                       <View style={{paddingTop: 20}}>
                           <View style={{flexDirection:'column' , marginVertical:5 ,padding:15}}>
                               <Text style={styles.search}>Search</Text>
                               <TextInput ref={ref => this.text=ref} autotFocus={this.state.Focused} underlineColorAndroid={'white'} placeholder='Cinema, Theatre, Concert ...' placeholderTextColor = '#fff' style={{color: '#fff', fontSize: 16 ,flex:1 , borderBottomColor: '#fff'}} />
                           </View>
                       </View>

                   </Content>

                </ImageBackground>
            </Container>

        );
}

Body:
You can use the onFocus event from textinput to do this along with onBlur.
Using this method you should add to your state object a value that tracks if the input is focused.

<TextInput onFocus={()=> this.setState({inputFocused: true})} onBlur={()=> this.setState({inputFocused: false})}/>

then just use your inputFocused to check if the input is focused or not


问:
How to open a Python pickle file, append to it, save it, and close it?
Here is my code:

```<code> import pickle

 class User:
     def __init__(self, username, password):
         self.username = username
         self.password = password

     def set_password(self):
         self.password = input("Enter NEW password > ")

     def __get_password(self):
         return self.password

     def __get_username(self):
         return self.username

     def change_password(self):
         my_password = input("Enter your CURRENT password > ")
         if my_password == User.__get_password(self):
             self.set_password()
         else:
             print("Please try again")

     def display_details(self):
         print()
         print("Username and password")
         print("---------------------")
         print("username is: ", User.__get_username(self))
         print("password is: ", User.__get_password(self))
         print()

     def __repr__(self):
         return f'username: {self.username}'

 users = [User("MichaelPalin", "P4rr0t"), User("EricIdle", "M0nty"), User("TerryJones", "Pyth0n")]

 try:
     foo = pickle.load(open("users.pickle", "rb"))
 except (OSError, IOError) as f:
     foo = 3
     pickle.dump(foo, open("users.pickle", "wb"))

 # with open('users.pickle', 'wb') as f:
 #     pickle.dump(users, f)

 def find_user(name):
     for user in users:
         if user.username == name:
             return user

 def add_user():
     user = input("Enter NEW user > ")
     password = input(f"Enter password for {user} > ")
     users.append(User(user, password))

 def delete_user():
     delete_user = input("Enter the user you wish to remove > ")
     user = find_user(delete_user)
     if user:
         users.remove(user)
         print('done')
     else:
         print(f'user {delete_user} not found')

 def change_password():
     my_password = input("Enter your CURRENT password > ")
     change_password()

 def display_users():
     for user in users:
         print(user)

 def invalid_entry():  # Response for invalid entries to menu.
     print("Invalid entry, please try again")
     print()

 def menu():  # Display menu, prompt for and accept keyboard choice
     print("Please select one of the following:")
     print()
     print("Enter a if you want to add a new user")
     print("Enter d if you want to delete a user")
     print("Enter f if you want to find a user")
     print("Enter c if you want to change your password")
     print("Enter u if you want to display a list of users")
     print("Enter q if you want to Quit")
     choice = input("")
     return choice

 while True:
     menu_choice = menu()
     if menu_choice.lower() == "a":
         add_user()
     elif menu_choice.lower() == "d":
         delete_user()
     elif menu_choice.lower() == "f":
         find_user()
     elif menu_choice.lower() == "c":
         change_password()
     elif menu_choice.lower() == 'u':
         display_users()
     elif menu_choice.lower() == "q":
         print("Goodbye")
         with open('users.pickle', 'wb') as f:
             pickle.dump(users, f)
             quit()
     else:
         invalid_entry()
</code>```

It's not working properly though, as the pickle file is being overwritten every time the program runs. I'm guessing the culprit is the users line, but I don't know how to resolve the problem, if that's the case. I tried moving the entire line to the bottom of the try section, aligned with the pickle.dump line, but that just threw an error:

NameError: name 'users' is not defined

Can someone help me please? I've been trying to do this for about 2 weeks now and I'm getting increasingly frustrated. I've looked at so many related tutorials on the web that many of the links I'm seeing are now purple, but I just can't seem to work out how to write the code to create the correct logical flow.

I think the logic should probably be:

1) Does file exist?

If Y - do nothing

If N - create it with sample data

2) Does the user want to create a new login?

If Y - append the login to the file

If N - do nothing

答:
try this code:

```<code>try:
    users = pickle.load(open("users.pickle", "rb"))
except (OSError, IOError) as f:
    foo = 3
    print("except")
    pickle.dump(users, open("users.pickle", "wb"))
</code>```

also quit() outside with:

```<code>with open('users.pickle', 'wb') as f:
    pickle.dump(users, f)
quit()
</code>```

Body:
Here is my code:

 import pickle

 class User:
     def __init__(self, username, password):
         self.username = username
         self.password = password

     def set_password(self):
         self.password = input("Enter NEW password > ")

     def __get_password(self):
         return self.password

     def __get_username(self):
         return self.username

     def change_password(self):
         my_password = input("Enter your CURRENT password > ")
         if my_password == User.__get_password(self):
             self.set_password()
         else:
             print("Please try again")

     def display_details(self):
         print()
         print("Username and password")
         print("---------------------")
         print("username is: ", User.__get_username(self))
         print("password is: ", User.__get_password(self))
         print()

     def __repr__(self):
         return f'username: {self.username}'

 users = [User("MichaelPalin", "P4rr0t"), User("EricIdle", "M0nty"), User("TerryJones", "Pyth0n")]

 try:
     foo = pickle.load(open("users.pickle", "rb"))
 except (OSError, IOError) as f:
     foo = 3
     pickle.dump(foo, open("users.pickle", "wb"))

 # with open('users.pickle', 'wb') as f:
 #     pickle.dump(users, f)

 def find_user(name):
     for user in users:
         if user.username == name:
             return user

 def add_user():
     user = input("Enter NEW user > ")
     password = input(f"Enter password for {user} > ")
     users.append(User(user, password))

 def delete_user():
     delete_user = input("Enter the user you wish to remove > ")
     user = find_user(delete_user)
     if user:
         users.remove(user)
         print('done')
     else:
         print(f'user {delete_user} not found')

 def change_password():
     my_password = input("Enter your CURRENT password > ")
     change_password()

 def display_users():
     for user in users:
         print(user)

 def invalid_entry():  # Response for invalid entries to menu.
     print("Invalid entry, please try again")
     print()

 def menu():  # Display menu, prompt for and accept keyboard choice
     print("Please select one of the following:")
     print()
     print("Enter a if you want to add a new user")
     print("Enter d if you want to delete a user")
     print("Enter f if you want to find a user")
     print("Enter c if you want to change your password")
     print("Enter u if you want to display a list of users")
     print("Enter q if you want to Quit")
     choice = input("")
     return choice

 while True:
     menu_choice = menu()
     if menu_choice.lower() == "a":
         add_user()
     elif menu_choice.lower() == "d":
         delete_user()
     elif menu_choice.lower() == "f":
         find_user()
     elif menu_choice.lower() == "c":
         change_password()
     elif menu_choice.lower() == 'u':
         display_users()
     elif menu_choice.lower() == "q":
         print("Goodbye")
         with open('users.pickle', 'wb') as f:
             pickle.dump(users, f)
             quit()
     else:
         invalid_entry()

It's not working properly though, as the pickle file is being overwritten every time the program runs. I'm guessing the culprit is the users line, but I don't know how to resolve the problem, if that's the case. I tried moving the entire line to the bottom of the try section, aligned with the pickle.dump line, but that just threw an error:

NameError: name 'users' is not defined

Can someone help me please? I've been trying to do this for about 2 weeks now and I'm getting increasingly frustrated. I've looked at so many related tutorials on the web that many of the links I'm seeing are now purple, but I just can't seem to work out how to write the code to create the correct logical flow.

I think the logic should probably be:

1) Does file exist?

If Y - do nothing

If N - create it with sample data

2) Does the user want to create a new login?

If Y - append the login to the file

If N - do nothing

Body:
try this code:

try:
    users = pickle.load(open("users.pickle", "rb"))
except (OSError, IOError) as f:
    foo = 3
    print("except")
    pickle.dump(users, open("users.pickle", "wb"))

also quit() outside with:

with open('users.pickle', 'wb') as f:
    pickle.dump(users, f)
quit()


问:
How to instantiate an object and set member fields with PowerShell?
I'm trying to work out how to create objects, set fields for that object, and then add the object to a collection.

Specifically, how can I create a $newPerson where the Name field is "joe" and with an array consisting of "phone1, phone2, phone3"?  Similarly, "sue" has an array of "cell4 etc" and "alice" with her attributes, and so on.  Ultimately, to put these three objects into an array of objects, $collectionOfPeople?

output:

```<code>thufir@dur:~/flwor/csv$
thufir@dur:~/flwor/csv$ pwsh import.ps1
people name
joe name
phone1 attribute
phone2 attribute
phone3 attribute
sue name
cell4 attribute
home5 attribute
alice name
atrib6 attribute
x7 attribute
y9 attribute
z10 attribute
thufir@dur:~/flwor/csv$
</code>```

code:

```<code>$tempAttributes = @()
$collectionOfPeople = @()

function attribute([string]$line) {
  Write-Host $line  "attribute"
  $tempAttributes += $line
}
function name([string]$line) {
  Write-Host $line  "name"

  #is a $newPerson ever instantiated?
  $newPerson = [PSCustomObject]@{
    Name       = $line
    Attributes = $tempAttributes
  }
  $newPerson  #empty?  no output
  $collectionOfPeople += $newPerson
  $tempAttributes = @()
}

$output = switch -regex -file people.csv {

  '\d' { attribute($_) ; $_ }
  default { name($_); $_ }
}
#how to read the file from top to bottom?
#[array]::Reverse($output)

#$output

$collectionOfPeople  #empty???
</code>```

input from a CSV file:

```<code>people
joe
phone1
phone2
phone3
sue
cell4
home5
alice
atrib6
x7
y9
z10
</code>```

In the above CSV there's no marker between records, so I'm using an if statement on the assumption that every attribute has digits while the names never have digits.

答:
You could do something like the following, which keeps closely to your current logic. This does assume that the order of data in your file is exactly as you have stated. .

```<code>switch -regex -file people.csv {
   '\d' { $Attributes.Add($_) }
   default {
      if ($Attributes -and $Name) {
          [pscustomobject]@{Name = $Name; Attributes = $Attributes}
      }
      $Name = $_
      $Attributes = [Collections.Generic.List[string]]@()
   }
}
# Output Last Set of Attributes
[pscustomobject]@{Name = $Name; Attributes = $Attributes}
# Cleanup
Remove-Variable Name
Remove-Variable Attributes
</code>```

If there are no attributes for a name, that name is ignored. That feature can be changed by adding a condition elseif ($Name) { [pscustomobject]@{Name = $Name; Attributes = $null} } within the default block.

Body:
I'm trying to work out how to create objects, set fields for that object, and then add the object to a collection.

Specifically, how can I create a $newPerson where the Name field is "joe" and with an array consisting of "phone1, phone2, phone3"?  Similarly, "sue" has an array of "cell4 etc" and "alice" with her attributes, and so on.  Ultimately, to put these three objects into an array of objects, $collectionOfPeople?

output:

thufir@dur:~/flwor/csv$
thufir@dur:~/flwor/csv$ pwsh import.ps1
people name
joe name
phone1 attribute
phone2 attribute
phone3 attribute
sue name
cell4 attribute
home5 attribute
alice name
atrib6 attribute
x7 attribute
y9 attribute
z10 attribute
thufir@dur:~/flwor/csv$

code:

$tempAttributes = @()
$collectionOfPeople = @()

function attribute([string]$line) {
  Write-Host $line  "attribute"
  $tempAttributes += $line
}
function name([string]$line) {
  Write-Host $line  "name"

  #is a $newPerson ever instantiated?
  $newPerson = [PSCustomObject]@{
    Name       = $line
    Attributes = $tempAttributes
  }
  $newPerson  #empty?  no output
  $collectionOfPeople += $newPerson
  $tempAttributes = @()
}

$output = switch -regex -file people.csv {

  '\d' { attribute($_) ; $_ }
  default { name($_); $_ }
}
#how to read the file from top to bottom?
#[array]::Reverse($output)

#$output

$collectionOfPeople  #empty???

input from a CSV file:

people
joe
phone1
phone2
phone3
sue
cell4
home5
alice
atrib6
x7
y9
z10

In the above CSV there's no marker between records, so I'm using an if statement on the assumption that every attribute has digits while the names never have digits.

Body:
You could do something like the following, which keeps closely to your current logic. This does assume that the order of data in your file is exactly as you have stated. .

switch -regex -file people.csv {
   '\d' { $Attributes.Add($_) }
   default {
      if ($Attributes -and $Name) {
          [pscustomobject]@{Name = $Name; Attributes = $Attributes}
      }
      $Name = $_
      $Attributes = [Collections.Generic.List[string]]@()
   }
}
# Output Last Set of Attributes
[pscustomobject]@{Name = $Name; Attributes = $Attributes}
# Cleanup
Remove-Variable Name
Remove-Variable Attributes

If there are no attributes for a name, that name is ignored. That feature can be changed by adding a condition elseif ($Name) { [pscustomobject]@{Name = $Name; Attributes = $null} } within the default block.


问:
Silverlight project build fails in VS2010 when project is on a mapped network drive
I am just learning Blend/Silverlight/VS2010/.net/etc.  I have a simple project that resides on a network drive.  When I tell VS2010 to rebuild the project, I get the following error message:

```
------ Rebuild All started: Project: MySilverlightApplication, Configuration: Debug Any CPU ------
  MySilverlightApplication -> H:\PRJ\VisualStudio\ExpressionBlend\Unleashed\MySilverLightApplication\MySilverlightApplication\Bin\Debug\MySilverlightApplication.dll

C:\Program Files\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Silverlight.Common.targets(214,9):
 error : Could not load the assembly
         file:///H:\PRJ\VisualStudio\ExpressionBlend\Unleashed\MySilverLightApplication\MySilverlightApplication\obj\Debug\MySilverlightApplication.dll.
         This assembly may have been downloaded from the Web.  If an assembly has been downloaded from the Web,
         it is flagged by Windows as being a Web file, even if it resides on the local computer.
         This may prevent it from being used in your project. You can change this designation by changing the file properties.
         Only unblock assemblies that you trust. See http://go.microsoft.com/fwlink/?LinkId=179545 for more information.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
```

The project was not downloaded from the Web (I created it using Blend.) After doing some searching, I guessed the problem may be due to .net security settings.  I issued the following command:

```
C:\Program Files\Microsoft Visual Studio 10.0\VC>caspol -m -ag 1.3 -url "file://\\p4dc\h$\*" FullTrust
```

in the hope that would solve the problem.  p4dc is the name of the server machine, h$ is the administrative share for the h: drive on the server which in turn is mapped to the drive letter "H" on the local machine (\\p4dc\h$ is mapped to H in the local machine).

That did not solve the problem.  I don't know if my caspol command is correct (I wasn't planning on learning caspol on the fly), it just seemed like a reasonable thing to try.  The problem goes away when I make a copy of the entire project on the local C drive but, that "solution" is rather undesirable.

At this point, I don't really know what else to try to solve the problem without moving the project to a local drive.

Any help leading to a solution is much appreciated.

John.

答:
The error message displayed by VS2010 would lead anyone to believe the issue is with trust and security and it is BUT, no amount of allowing full trust on the network drive will solve the problem.

What lead to the solution was first to port the project to VS2008 to find out if it would encounter the same problem.  VS2008 was perfectly happy to run the project without complaint.

Then I converted the VS2008 project (which was working) to VS2010.  VS2010 refused to build the project but this time the error message was different, referring to "remote assemblies" and to a link on MSDN, which led to the solution.

The real problem is that VS2010 considers an assembly on a network drive a "remote assembly" (the same as if the assembly were being loaded from a web site.)  Caspol was not able to solve that problem (it seems it should have but, it may be my fault, I am not well versed in using Caspol).

To end this long story, the link provided in the error message is:

http://msdn.microsoft.com/en-us/library/dd409252(VS.100).aspx

after following the instructions in that link to edit "machine.config", I changed <runtime/> to:

```<code><runtime>
  <loadFromRemoteSources enabled="true"/>
</runtime>
</code>```

the project built successfully and ran without a hitch.

Thank you to Alison and CodeNaked for their efforts to help,

John.

PS: it would have been rather nice if VS2010 had displayed the "better" error message initially.  Instead, I had to port the VS2010 non working project to VS2008 where it worked and that one to VS2010 where I got the better error message that led to the solution.

Body:
I am just learning Blend/Silverlight/VS2010/.net/etc.  I have a simple project that resides on a network drive.  When I tell VS2010 to rebuild the project, I get the following error message:

------ Rebuild All started: Project: MySilverlightApplication, Configuration: Debug Any CPU ------
  MySilverlightApplication -> H:\PRJ\VisualStudio\ExpressionBlend\Unleashed\MySilverLightApplication\MySilverlightApplication\Bin\Debug\MySilverlightApplication.dll

C:\Program Files\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Silverlight.Common.targets(214,9):
 error : Could not load the assembly
         file:///H:\PRJ\VisualStudio\ExpressionBlend\Unleashed\MySilverLightApplication\MySilverlightApplication\obj\Debug\MySilverlightApplication.dll.
         This assembly may have been downloaded from the Web.  If an assembly has been downloaded from the Web,
         it is flagged by Windows as being a Web file, even if it resides on the local computer.
         This may prevent it from being used in your project. You can change this designation by changing the file properties.
         Only unblock assemblies that you trust. See http://go.microsoft.com/fwlink/?LinkId=179545 for more information.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

The project was not downloaded from the Web (I created it using Blend.) After doing some searching, I guessed the problem may be due to .net security settings.  I issued the following command:

C:\Program Files\Microsoft Visual Studio 10.0\VC>caspol -m -ag 1.3 -url "file://\\p4dc\h$\*" FullTrust

in the hope that would solve the problem.  p4dc is the name of the server machine, h$ is the administrative share for the h: drive on the server which in turn is mapped to the drive letter "H" on the local machine (\\p4dc\h$ is mapped to H in the local machine).

That did not solve the problem.  I don't know if my caspol command is correct (I wasn't planning on learning caspol on the fly), it just seemed like a reasonable thing to try.  The problem goes away when I make a copy of the entire project on the local C drive but, that "solution" is rather undesirable.

At this point, I don't really know what else to try to solve the problem without moving the project to a local drive.

Any help leading to a solution is much appreciated.

John.

Body:
The error message displayed by VS2010 would lead anyone to believe the issue is with trust and security and it is BUT, no amount of allowing full trust on the network drive will solve the problem.

What lead to the solution was first to port the project to VS2008 to find out if it would encounter the same problem.  VS2008 was perfectly happy to run the project without complaint.

Then I converted the VS2008 project (which was working) to VS2010.  VS2010 refused to build the project but this time the error message was different, referring to "remote assemblies" and to a link on MSDN, which led to the solution.

The real problem is that VS2010 considers an assembly on a network drive a "remote assembly" (the same as if the assembly were being loaded from a web site.)  Caspol was not able to solve that problem (it seems it should have but, it may be my fault, I am not well versed in using Caspol).

To end this long story, the link provided in the error message is:

http://msdn.microsoft.com/en-us/library/dd409252(VS.100).aspx

after following the instructions in that link to edit "machine.config", I changed <runtime/> to:

<runtime>
  <loadFromRemoteSources enabled="true"/>
</runtime>

the project built successfully and ran without a hitch.

Thank you to Alison and CodeNaked for their efforts to help,

John.

PS: it would have been rather nice if VS2010 had displayed the "better" error message initially.  Instead, I had to port the VS2010 non working project to VS2008 where it worked and that one to VS2010 where I got the better error message that led to the solution.


问:
Can't access the data returned by api call to http://dummy.restapiexample.com/api/v1/employee/3
I`m trying to model an application for managing the employees of a company. My problem: I'm trying to fetch the data of a specific user, calling the API endpoint : http://dummy.restapiexample.com/api/v1/employee/3 (the 3 can be replaced by other user-ids).
When I'm calling the endpoint from Postman I get this response

But when I try to access the same resource from my React application I get this response.

Here is how I call the API endpoint

```<code>export async function getSingleEmployee() {
return fetch('http://dummy.restapiexample.com/api/v1/employee/3', {
    mode: 'cors',
    method: 'GET',
    dataType: 'json',
    headers: {
        'Access-Control-Allow-Origin':'*',
        'Content-type': 'application/json;charset=utf-8',

    }
})
    .then(response => response)
    .then(data => {
        console.log(data);

    })}
</code>```

How can I access the data as I do in the Postman request? What am I missing?

答: Did you try using "await" fetch.... ?</p>

Body:
I`m trying to model an application for managing the employees of a company. My problem: I'm trying to fetch the data of a specific user, calling the API endpoint : http://dummy.restapiexample.com/api/v1/employee/3 (the 3 can be replaced by other user-ids).
When I'm calling the endpoint from Postman I get this response

But when I try to access the same resource from my React application I get this response.

Here is how I call the API endpoint

export async function getSingleEmployee() {
return fetch('http://dummy.restapiexample.com/api/v1/employee/3', {
    mode: 'cors',
    method: 'GET',
    dataType: 'json',
    headers: {
        'Access-Control-Allow-Origin':'*',
        'Content-type': 'application/json;charset=utf-8',

    }
})
    .then(response => response)
    .then(data => {
        console.log(data);

    })}

How can I access the data as I do in the Postman request? What am I missing?

Body: Did you try using "await" fetch.... ?


问:
What are the A11yLabel for a Datepicker in Angular Material?
What are the dateA11yLabel and the monthYearA11yLabel when configuring a custom format for a datepicker? What do they do? I did not find this information in the Angular Material documentation.

```<code>export const MY_FORMATS = {
  parse: {
    dateInput: 'LL',
  },
  display: {
    dateInput: 'LL',
    monthYearLabel: 'MMM YYYY',
    dateA11yLabel: 'LL',
    monthYearA11yLabel: 'MMMM YYYY',
  },
};
</code>```

https://material.angular.io/components/datepicker/overview#customizing-the-parse-and-display-formats

答:
This indicates the formatting for accessibility, basically you are defining how assistive technologies will look and act for people with impairments on the date adapter.

You can find details of a11y here: https://a11yproject.com/

Body:
What are the dateA11yLabel and the monthYearA11yLabel when configuring a custom format for a datepicker? What do they do? I did not find this information in the Angular Material documentation.

export const MY_FORMATS = {
  parse: {
    dateInput: 'LL',
  },
  display: {
    dateInput: 'LL',
    monthYearLabel: 'MMM YYYY',
    dateA11yLabel: 'LL',
    monthYearA11yLabel: 'MMMM YYYY',
  },
};

https://material.angular.io/components/datepicker/overview#customizing-the-parse-and-display-formats


问:
how to add subscript(or superscript) in notion block？
i am new in using notion as a notebook.Before this,i use oneNote instead,because i found that notion is more convinient in same ways.But one thing making me annoyed is that i can't add subscript(or superscript) in notion text block。Are there any fellows can handle this？
as shown：
text with subscript i need

when i edit in notion block i get like this

答:
For subscript:

```<code>/math
</code>```

Then C_1 renders C1

For superscript:

```<code>/math
</code>```

Then C^2 renders C2

Body:
For subscript:

/math

Then C_1 renders C1

For superscript:

/math

Then C^2 renders C2


问:
Can someone tell me how to sum only some of items nested in my JavaScript array?
I am not very proud of this codeㅠㅠ I have 6000 objects in the array and would like to sum only 10 items from the array. Now I am putting ten coding blocks to the program.

Someone can tell me how to make it look like programing?

<Text style={styles.text}>[{Number((items.find( x => x.id === indexTwoId+101).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+102).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+103).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+104).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+105).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+106).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+107).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+108).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+109).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+110).as==='1'?'1':'0'))}/10]</Text>

My array is as follows;

```<code>    count: 1,
    categories: [
        {id:1,as:0},
        {id:2,as:0},
        {id:3,as:0},
        {id:4,as:0},
        {id:5,as:0},
        {id:6,as:0},
        {id:7,as:0},
        {id:8,as:0},
        {id:9,as:0},
        {id:10,as:0},
.
.
.
.]}```
```

答:
I don't have experience with React, but in "regular" JS you might do something like this:

```<code>let sum = items.reduce((item, total) => {
    if (item.id < indexTwoId + 101 || item.id > indexTwoId + 110) return total;
    if (item.as === '1') return total + 1;
    return total;
}, 0)
</code>```

You can probably "translate" it to a single line with ternary operators.

EDIT:
If you just want to count items by criteria then:

```<code>items.filter(x => x.id >= indexTwoId + 101 && x.id <= indexTwoId + 110 && x.as === '1').length
</code>```

Body:
I am not very proud of this codeㅠㅠ I have 6000 objects in the array and would like to sum only 10 items from the array. Now I am putting ten coding blocks to the program.

Someone can tell me how to make it look like programing?

<Text style={styles.text}>[{Number((items.find( x => x.id === indexTwoId+101).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+102).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+103).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+104).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+105).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+106).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+107).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+108).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+109).as==='1'?'1':'0'))+Number((items.find( x => x.id === indexTwoId+110).as==='1'?'1':'0'))}/10]</Text>

My array is as follows;

    count: 1,
    categories: [
        {id:1,as:0},
        {id:2,as:0},
        {id:3,as:0},
        {id:4,as:0},
        {id:5,as:0},
        {id:6,as:0},
        {id:7,as:0},
        {id:8,as:0},
        {id:9,as:0},
        {id:10,as:0},
.
.
.
.]}```

Body:
I don't have experience with React, but in "regular" JS you might do something like this:

let sum = items.reduce((item, total) => {
    if (item.id < indexTwoId + 101 || item.id > indexTwoId + 110) return total;
    if (item.as === '1') return total + 1;
    return total;
}, 0)

You can probably "translate" it to a single line with ternary operators.

EDIT:
If you just want to count items by criteria then:

items.filter(x => x.id >= indexTwoId + 101 && x.id <= indexTwoId + 110 && x.as === '1').length


问:
Pass start and end date parameter from text field of access form
I am using MS Access 2016, I am trying to pass start and end date parameter to a query e.g. something like: =>[start date] & <= [End date]

What I need is if I leave any date blank e.g. start or end, I required all dates from that start date onward or all dates up until the end date.

答:
Simply include an or is null branch to your query selection criteria, e.g.:

```<code>select * from YourTable
where
    (YourDate >= Forms![Your Form]![Start Date] or Forms![Your Form]![Start Date] is null) and
    (YourDate <= Forms![Your Form]![End Date]   or Forms![Your Form]![End Date]   is null)
</code>```

Body:
Simply include an or is null branch to your query selection criteria, e.g.:

select * from YourTable
where
    (YourDate >= Forms![Your Form]![Start Date] or Forms![Your Form]![Start Date] is null) and
    (YourDate <= Forms![Your Form]![End Date]   or Forms![Your Form]![End Date]   is null)


问:
How to convert in Date format the columns of a particular excel file?
I have an excel file with 77 columns (with 43 NA columns) of different length, 12 of which are Date. Ideally, I want to import it in R the dataset with the columns that refer to Date in date format, while the other columns in numeric format. There is lot of material in stackoverflow and I tried all the options but it is not working.

The first option would be to do it directly from excel:

```<code>dataset <- read_xlsx("Data.xlsx", col_types = "numeric") #it gives everything numeric but column date always in this format "36164"

#I also tried something like this:

dataset <- read_xlsx("Data.xlsx", col_types = c("date", rep("numeric", n))) #where "n" stands for all the columns with numbers I have but it did not work

</code>```

I can import the data with the incorret date columns. After some cleaning (removing NA columns) I get a tbl with different column length. I tried the following codes to transform the incorrect column dates into date format:

```<code>dataset <- janitor::remove_empty(dataset, which = "cols") #remove NA columns
dataset <- dataset[-c(1),] #remove the first row of all columns

# Now using this command I could transform each incorrect date column into a date format:

  date <- as.Date(as.numeric(dataset$column1), origin = "1899-12-30")

# I would like to do it for all the date columns in one shot but when I try to do it in this way

  as.Date(as.numeric(dataset[,c(1,3,5,7,14,16,18,20,21,23,25,32)]), origin = "1899-12-30")

# I get an error, probably because the columns have different length
# the error is: Error in as.Date(as.numeric(var_dataset[, c(1, 3, 5, 7, 14, 16, 18, 20,  :
  'list' object cannot be coerced to type 'double'
# unlisting the object doesn't solve the problem

</code>```

I am aware it is missing data to reproduce my problem but in the first scenario I don't know how to approximate my quite big excel file while in the second case I don't know how to create a tbl with many columns of different length without wasting lot of time. Sorry.

Do you have any solution? Either for importing directly from Excel or playing with the dataframe

Thanks so much

I attach here the structure of my dataset:

```<code>Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   5500 obs. of  77 variables:
 $ Name...1                                                     : chr  "Code" "36164" "36165" "36166" ...
 $ VSTOXX VOLATILITY INDEX - PRICE INDEX                        : chr  "VSTOXXI(PI)" "18.2" "29.69" "25.17" ...
 $ ...3                                                         : logi  NA NA NA NA NA NA ...
 $ ...4                                                         : logi  NA NA NA NA NA NA ...
 $ ...5                                                         : logi  NA NA NA NA NA NA ...
 $ ...6                                                         : logi  NA NA NA NA NA NA ...
 $ Name...7                                                     : chr  "Code" "36799" "36830" "36860" ...
 $ EM COMPOSITE INDICATOR OF SOVEREIGN STRESS: GDP WEIGHTS NADJ : chr  "EMEBSCGWR" "7.8255999999999992E-2" "8.9886999999999995E-2" "8.0714999999999995E-2" ...
 $ ...9                                                         : logi  NA NA NA NA NA NA ...
 $ Name...10                                                    : chr  "Code" "36168" "36175" "36182" ...
 $ CISS BOND MKT: GOV & NFC VOLATILITY - ECONOMIC SERIES        : chr  "EMCIBMG" "4.4651999999999997E-2" "6.6535999999999998E-2" "4.9789E-2" ...
 $ ...12                                                        : logi  NA NA NA NA NA NA ...
 $ Name...13                                                    : chr  "Code" "36168" "36175" "36182" ...
 $ CISS MONEY MKT: 3M RATE+ VOLATILITY - ECONOMIC SERIES        : chr  "EMECM3E" "5.7435999999999994E-2" "7.463199999999999E-2" "7.2263999999999995E-2" ...
 $ CISS FX MKT: EUR VOLATILITY - ECONOMIC SERIES                : chr  "EMECFEM" "7.2139999999999996E-2" "8.6049E-2" "4.5948999999999997E-2" ...
 $ CISS FIN INTERM: BANK+ VOLATILITY - ECONOMIC SERIES          : chr  "EMCIFIN" "4.5384999999999995E-2" "0.11820399999999999" "0.11516499999999999" ...
 $ CISS NF EQUITY: VOLATILITY - ECONOMIC SERIES                 : chr  "EMCIEMN" "7.7453999999999995E-2" "0.12733" "0.11918899999999999" ...
 $ CISS: CROSS SUBINDEXCORRELATION - ECONOMIC SERIES            : chr  "EMCICRO" "-0.21210999999999999" "-0.29791000000000001" "-0.2369" ...
 $ SYSTEMIC STRESS COMPINDICATOR - ECONOMIC SERIES              : chr  "EMCISSI" "8.4954000000000002E-2" "0.174844" "0.16546" ...
 $ ...20                                                        : logi  NA NA NA NA NA NA ...
 $ ...21                                                        : logi  NA NA NA NA NA NA ...
 $ ...22                                                        : logi  NA NA NA NA NA NA ...
 $ ...23                                                        : logi  NA NA NA NA NA NA ...
 $ ...24                                                        : logi  NA NA NA NA NA NA ...
 $ ...25                                                        : logi  NA NA NA NA NA NA ...
 $ Name...26                                                    : chr  "Code" "33253" "33284" "33312" ...
 $ Z8 IPI: MFG., VOLUME INDEX OF PRODUCTION, 2015=100 (WDA) VOLA: chr  "Z8ES493KG" "81" "79.7" "79.400000000000006" ...
 $ ...28                                                        : logi  NA NA NA NA NA NA ...
 $ ...29                                                        : logi  NA NA NA NA NA NA ...
 $ ...30                                                        : logi  NA NA NA NA NA NA ...
 $ ...31                                                        : logi  NA NA NA NA NA NA ...
 $ ...32                                                        : logi  NA NA NA NA NA NA ...
 $ ...33                                                        : logi  NA NA NA NA NA NA ...
 $ ...34                                                        : logi  NA NA NA NA NA NA ...
 $ Name...35                                                    : chr  "Code" "35779" "35810" "35841" ...
 $ EH HICP: ALL-ITEMS NADJ                                      : chr  "EHES795WR" "1.7" "1.6" "1.6" ...
 $ ...37                                                        : logi  NA NA NA NA NA NA ...
 $ ...38                                                        : logi  NA NA NA NA NA NA ...
 $ Name...39                                                    : chr  "Code" "35110" "35139" "35170" ...
 $ EH HICP: ALL-ITEMS (%MOM) NADJ                               : chr  "EHESPQ93R" "0.4" "0.4" "0.3" ...
 $ ...41                                                        : logi  NA NA NA NA NA NA ...
 $ ...42                                                        : logi  NA NA NA NA NA NA ...
 $ ...43                                                        : logi  NA NA NA NA NA NA ...
 $ Name...44                                                    : chr  "Code" "35445" "35476" "35504" ...
 $ EH HICP: ALL-ITEMS HICP (%YOY) NADJ                          : chr  "EHESAKZER" "2.2000000000000002" "2" "1.7" ...
 $ ...46                                                        : logi  NA NA NA NA NA NA ...
 $ ...47                                                        : logi  NA NA NA NA NA NA ...
 $ ...48                                                        : logi  NA NA NA NA NA NA ...
 $ ...49                                                        : logi  NA NA NA NA NA NA ...
 $ Name...50                                                    : chr  "Code" "36206" "36234" "36265" ...
 $ EM EUROSYSTEM: BASE MONEY CURN                               : chr  "EMEBSMYBA" "426.64374199999997" "430.51499999999999" "432.34064499999999" ...
 $ ...52                                                        : logi  NA NA NA NA NA NA ...
 $ ...53                                                        : logi  NA NA NA NA NA NA ...
 $ ...54                                                        : logi  NA NA NA NA NA NA ...
 $ ...55                                                        : logi  NA NA NA NA NA NA ...
 $ Name...56                                                    : chr  "Code" "35703" "35734" "35762" ...
 $ EM EUROSYSTEM: TOTAL ASSETS/LIABILITIES (EP) CURN            : chr  "EMECBSALA" "710257.53500000003" "711193.47100000002" "714957.58900000004" ...
 $ ...58                                                        : logi  NA NA NA NA NA NA ...
 $ ...59                                                        : logi  NA NA NA NA NA NA ...
 $ ...60                                                        : logi  NA NA NA NA NA NA ...
 $ ...61                                                        : logi  NA NA NA NA NA NA ...
 $ ...62                                                        : logi  NA NA NA NA NA NA ...
 $ ...63                                                        : logi  NA NA NA NA NA NA ...
 $ Name...64                                                    : chr  "Code" "41548" "41579" "41609" ...
 $ TR EU FWD INFL-LKD SWAP 10YF20Y - MIDDLE RATE                : chr  "TREFSTT" NA NA NA ...
 $ TR EU FWD INFL-LKD SWAP 10YF10Y - MIDDLE RATE                : chr  "TREFS1T" NA NA NA ...
 $ TR EU FWD INFL-LKD SWAP 2YF2Y - MIDDLE RATE                  : chr  "TREFS22" "1.5158" "1.4669000000000001" "1.4715" ...
 $ TR EU FWD INFL-LKD SWAP 1YF1Y - MIDDLE RATE                  : chr  "TREFS11" "1.4509000000000001" "1.2338" "1.1225000000000001" ...
 $ TR EU FWD INFL-LKD SWAP 2YF3Y - MIDDLE RATE                  : chr  "TREFS23" "1.5906000000000002" "1.5453000000000001" "1.5283000000000002" ...
 $ TR EU FWD INFL-LKD SWAP 5YF10Y - MIDDLE RATE                 : chr  "TREFS5T" "2.3516000000000004" "2.3323" "2.3070000000000004" ...
 $ ...71                                                        : logi  NA NA NA NA NA NA ...
 $ ...72                                                        : logi  NA NA NA NA NA NA ...
 $ ...73                                                        : logi  NA NA NA NA NA NA ...
 $ ...74                                                        : logi  NA NA NA NA NA NA ...
 $ ...75                                                        : logi  NA NA NA NA NA NA ...
 $ Name...76                                                    : chr  "Code" "41255" "41286" "41317" ...
 $ TR EU FWD INFL-LKD SWAP 5YF5Y - MIDDLE RATE                  : chr  "TREFS55" "2.2027000000000001" "2.2637" "2.383" ...
</code>```

答:
edit: While this will most likely solve the error you're getting, I agree with Edward's advice to use readxl::read_excel which should preserve the dates.

The problem with

```<code>  as.Date(as.numeric(dataset[,c(1,3,5,7,14,16,18,20,21,23,25,32)]), origin = "1899-12-30")
</code>```

is that you apply as.numeric on a tibble which internally is a list. Instead do

```<code>dplyr::mutate_at(
    dataset,
    c(1,3,5,7,14,16,18,20,21,23,25,32),
    dplyr::funs(as.numeric, as.Date),
    origin = "1899-12-30",
    format = "%Y-%m-%d"
)
</code>```

You say the columns have a different length but that's not possible in R's table-like structures (tibble, data.frame, data.table).
Lesson: Always be aware what datatype you're working with doing e.g. str(dataset). as.numeric does not work on tables but needs to be applied to specific columns, using e.g. mutate.

Body:
I have an excel file with 77 columns (with 43 NA columns) of different length, 12 of which are Date. Ideally, I want to import it in R the dataset with the columns that refer to Date in date format, while the other columns in numeric format. There is lot of material in stackoverflow and I tried all the options but it is not working.

The first option would be to do it directly from excel:

dataset <- read_xlsx("Data.xlsx", col_types = "numeric") #it gives everything numeric but column date always in this format "36164"

#I also tried something like this:

dataset <- read_xlsx("Data.xlsx", col_types = c("date", rep("numeric", n))) #where "n" stands for all the columns with numbers I have but it did not work

I can import the data with the incorret date columns. After some cleaning (removing NA columns) I get a tbl with different column length. I tried the following codes to transform the incorrect column dates into date format:

dataset <- janitor::remove_empty(dataset, which = "cols") #remove NA columns
dataset <- dataset[-c(1),] #remove the first row of all columns

# Now using this command I could transform each incorrect date column into a date format:

  date <- as.Date(as.numeric(dataset$column1), origin = "1899-12-30")

# I would like to do it for all the date columns in one shot but when I try to do it in this way

  as.Date(as.numeric(dataset[,c(1,3,5,7,14,16,18,20,21,23,25,32)]), origin = "1899-12-30")

# I get an error, probably because the columns have different length
# the error is: Error in as.Date(as.numeric(var_dataset[, c(1, 3, 5, 7, 14, 16, 18, 20,  :
  'list' object cannot be coerced to type 'double'
# unlisting the object doesn't solve the problem

I am aware it is missing data to reproduce my problem but in the first scenario I don't know how to approximate my quite big excel file while in the second case I don't know how to create a tbl with many columns of different length without wasting lot of time. Sorry.

Do you have any solution? Either for importing directly from Excel or playing with the dataframe

Thanks so much

I attach here the structure of my dataset:

Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   5500 obs. of  77 variables:
 $ Name...1                                                     : chr  "Code" "36164" "36165" "36166" ...
 $ VSTOXX VOLATILITY INDEX - PRICE INDEX                        : chr  "VSTOXXI(PI)" "18.2" "29.69" "25.17" ...
 $ ...3                                                         : logi  NA NA NA NA NA NA ...
 $ ...4                                                         : logi  NA NA NA NA NA NA ...
 $ ...5                                                         : logi  NA NA NA NA NA NA ...
 $ ...6                                                         : logi  NA NA NA NA NA NA ...
 $ Name...7                                                     : chr  "Code" "36799" "36830" "36860" ...
 $ EM COMPOSITE INDICATOR OF SOVEREIGN STRESS: GDP WEIGHTS NADJ : chr  "EMEBSCGWR" "7.8255999999999992E-2" "8.9886999999999995E-2" "8.0714999999999995E-2" ...
 $ ...9                                                         : logi  NA NA NA NA NA NA ...
 $ Name...10                                                    : chr  "Code" "36168" "36175" "36182" ...
 $ CISS BOND MKT: GOV & NFC VOLATILITY - ECONOMIC SERIES        : chr  "EMCIBMG" "4.4651999999999997E-2" "6.6535999999999998E-2" "4.9789E-2" ...
 $ ...12                                                        : logi  NA NA NA NA NA NA ...
 $ Name...13                                                    : chr  "Code" "36168" "36175" "36182" ...
 $ CISS MONEY MKT: 3M RATE+ VOLATILITY - ECONOMIC SERIES        : chr  "EMECM3E" "5.7435999999999994E-2" "7.463199999999999E-2" "7.2263999999999995E-2" ...
 $ CISS FX MKT: EUR VOLATILITY - ECONOMIC SERIES                : chr  "EMECFEM" "7.2139999999999996E-2" "8.6049E-2" "4.5948999999999997E-2" ...
 $ CISS FIN INTERM: BANK+ VOLATILITY - ECONOMIC SERIES          : chr  "EMCIFIN" "4.5384999999999995E-2" "0.11820399999999999" "0.11516499999999999" ...
 $ CISS NF EQUITY: VOLATILITY - ECONOMIC SERIES                 : chr  "EMCIEMN" "7.7453999999999995E-2" "0.12733" "0.11918899999999999" ...
 $ CISS: CROSS SUBINDEXCORRELATION - ECONOMIC SERIES            : chr  "EMCICRO" "-0.21210999999999999" "-0.29791000000000001" "-0.2369" ...
 $ SYSTEMIC STRESS COMPINDICATOR - ECONOMIC SERIES              : chr  "EMCISSI" "8.4954000000000002E-2" "0.174844" "0.16546" ...
 $ ...20                                                        : logi  NA NA NA NA NA NA ...
 $ ...21                                                        : logi  NA NA NA NA NA NA ...
 $ ...22                                                        : logi  NA NA NA NA NA NA ...
 $ ...23                                                        : logi  NA NA NA NA NA NA ...
 $ ...24                                                        : logi  NA NA NA NA NA NA ...
 $ ...25                                                        : logi  NA NA NA NA NA NA ...
 $ Name...26                                                    : chr  "Code" "33253" "33284" "33312" ...
 $ Z8 IPI: MFG., VOLUME INDEX OF PRODUCTION, 2015=100 (WDA) VOLA: chr  "Z8ES493KG" "81" "79.7" "79.400000000000006" ...
 $ ...28                                                        : logi  NA NA NA NA NA NA ...
 $ ...29                                                        : logi  NA NA NA NA NA NA ...
 $ ...30                                                        : logi  NA NA NA NA NA NA ...
 $ ...31                                                        : logi  NA NA NA NA NA NA ...
 $ ...32                                                        : logi  NA NA NA NA NA NA ...
 $ ...33                                                        : logi  NA NA NA NA NA NA ...
 $ ...34                                                        : logi  NA NA NA NA NA NA ...
 $ Name...35                                                    : chr  "Code" "35779" "35810" "35841" ...
 $ EH HICP: ALL-ITEMS NADJ                                      : chr  "EHES795WR" "1.7" "1.6" "1.6" ...
 $ ...37                                                        : logi  NA NA NA NA NA NA ...
 $ ...38                                                        : logi  NA NA NA NA NA NA ...
 $ Name...39                                                    : chr  "Code" "35110" "35139" "35170" ...
 $ EH HICP: ALL-ITEMS (%MOM) NADJ                               : chr  "EHESPQ93R" "0.4" "0.4" "0.3" ...
 $ ...41                                                        : logi  NA NA NA NA NA NA ...
 $ ...42                                                        : logi  NA NA NA NA NA NA ...
 $ ...43                                                        : logi  NA NA NA NA NA NA ...
 $ Name...44                                                    : chr  "Code" "35445" "35476" "35504" ...
 $ EH HICP: ALL-ITEMS HICP (%YOY) NADJ                          : chr  "EHESAKZER" "2.2000000000000002" "2" "1.7" ...
 $ ...46                                                        : logi  NA NA NA NA NA NA ...
 $ ...47                                                        : logi  NA NA NA NA NA NA ...
 $ ...48                                                        : logi  NA NA NA NA NA NA ...
 $ ...49                                                        : logi  NA NA NA NA NA NA ...
 $ Name...50                                                    : chr  "Code" "36206" "36234" "36265" ...
 $ EM EUROSYSTEM: BASE MONEY CURN                               : chr  "EMEBSMYBA" "426.64374199999997" "430.51499999999999" "432.34064499999999" ...
 $ ...52                                                        : logi  NA NA NA NA NA NA ...
 $ ...53                                                        : logi  NA NA NA NA NA NA ...
 $ ...54                                                        : logi  NA NA NA NA NA NA ...
 $ ...55                                                        : logi  NA NA NA NA NA NA ...
 $ Name...56                                                    : chr  "Code" "35703" "35734" "35762" ...
 $ EM EUROSYSTEM: TOTAL ASSETS/LIABILITIES (EP) CURN            : chr  "EMECBSALA" "710257.53500000003" "711193.47100000002" "714957.58900000004" ...
 $ ...58                                                        : logi  NA NA NA NA NA NA ...
 $ ...59                                                        : logi  NA NA NA NA NA NA ...
 $ ...60                                                        : logi  NA NA NA NA NA NA ...
 $ ...61                                                        : logi  NA NA NA NA NA NA ...
 $ ...62                                                        : logi  NA NA NA NA NA NA ...
 $ ...63                                                        : logi  NA NA NA NA NA NA ...
 $ Name...64                                                    : chr  "Code" "41548" "41579" "41609" ...
 $ TR EU FWD INFL-LKD SWAP 10YF20Y - MIDDLE RATE                : chr  "TREFSTT" NA NA NA ...
 $ TR EU FWD INFL-LKD SWAP 10YF10Y - MIDDLE RATE                : chr  "TREFS1T" NA NA NA ...
 $ TR EU FWD INFL-LKD SWAP 2YF2Y - MIDDLE RATE                  : chr  "TREFS22" "1.5158" "1.4669000000000001" "1.4715" ...
 $ TR EU FWD INFL-LKD SWAP 1YF1Y - MIDDLE RATE                  : chr  "TREFS11" "1.4509000000000001" "1.2338" "1.1225000000000001" ...
 $ TR EU FWD INFL-LKD SWAP 2YF3Y - MIDDLE RATE                  : chr  "TREFS23" "1.5906000000000002" "1.5453000000000001" "1.5283000000000002" ...
 $ TR EU FWD INFL-LKD SWAP 5YF10Y - MIDDLE RATE                 : chr  "TREFS5T" "2.3516000000000004" "2.3323" "2.3070000000000004" ...
 $ ...71                                                        : logi  NA NA NA NA NA NA ...
 $ ...72                                                        : logi  NA NA NA NA NA NA ...
 $ ...73                                                        : logi  NA NA NA NA NA NA ...
 $ ...74                                                        : logi  NA NA NA NA NA NA ...
 $ ...75                                                        : logi  NA NA NA NA NA NA ...
 $ Name...76                                                    : chr  "Code" "41255" "41286" "41317" ...
 $ TR EU FWD INFL-LKD SWAP 5YF5Y - MIDDLE RATE                  : chr  "TREFS55" "2.2027000000000001" "2.2637" "2.383" ...

Body:
edit: While this will most likely solve the error you're getting, I agree with Edward's advice to use readxl::read_excel which should preserve the dates.

The problem with

  as.Date(as.numeric(dataset[,c(1,3,5,7,14,16,18,20,21,23,25,32)]), origin = "1899-12-30")

is that you apply as.numeric on a tibble which internally is a list. Instead do

dplyr::mutate_at(
    dataset,
    c(1,3,5,7,14,16,18,20,21,23,25,32),
    dplyr::funs(as.numeric, as.Date),
    origin = "1899-12-30",
    format = "%Y-%m-%d"
)

You say the columns have a different length but that's not possible in R's table-like structures (tibble, data.frame, data.table).
Lesson: Always be aware what datatype you're working with doing e.g. str(dataset). as.numeric does not work on tables but needs to be applied to specific columns, using e.g. mutate.


问:
Setting property to newly alloc'd object using accessor cause memory leak
I just want confirmation on whether or not the following causes a memory leak.

.h file

```<code>@property (nonatomic, retain) MyObject *foo;
</code>```

.m file

```<code>@synthesize foo;
...

self.foo = [[MyObject alloc] init];
</code>```

dealloc is setup as

```<code>[foo release];
</code>```

My understanding is that the implementation of the auto-generated accessor method looks like

```<code>-(void)setFoo:(MyObject *)newObject {
    if (foo != newObject) {
        [foo release];
        foo = [newObject retain];
    }
}
</code>```

Walking through self.foo = [[MyObject alloc] init]; now reads to me as, "allocated a new MyObject object whose retain count will be 1, pass it to setFoo:, foo will never be equal to myObject as it was newly allocated, so release the old value, increment the retain count of newObject making it 2 and assign it to foo"

dealloc releases foo therefore setting its retain count to 1, which means this object is leaked?

To do this safely we should write our code like

```<code>self.foo = [[[MyObject alloc] init] autorelease];
</code>```

Is my understanding correct?

EDIT

I realize this question is not really appropriate for SO, so feel free to point me to a better place to ask this type of question as well.

答:
And another common pattern:</p>

```<code>MyObject *newFoo = [[MyObject alloc] init];
self.foo = newFoo;
[newFoo release];
</code>```

Body:
I just want confirmation on whether or not the following causes a memory leak.

.h file

@property (nonatomic, retain) MyObject *foo;

.m file

@synthesize foo;
...

self.foo = [[MyObject alloc] init];

dealloc is setup as

[foo release];

My understanding is that the implementation of the auto-generated accessor method looks like

-(void)setFoo:(MyObject *)newObject {
    if (foo != newObject) {
        [foo release];
        foo = [newObject retain];
    }
}

Walking through self.foo = [[MyObject alloc] init]; now reads to me as, "allocated a new MyObject object whose retain count will be 1, pass it to setFoo:, foo will never be equal to myObject as it was newly allocated, so release the old value, increment the retain count of newObject making it 2 and assign it to foo"

dealloc releases foo therefore setting its retain count to 1, which means this object is leaked?

To do this safely we should write our code like

self.foo = [[[MyObject alloc] init] autorelease];

Is my understanding correct?

EDIT

I realize this question is not really appropriate for SO, so feel free to point me to a better place to ask this type of question as well.

Body:
And another common pattern:

MyObject *newFoo = [[MyObject alloc] init];
self.foo = newFoo;
[newFoo release];


问:
You need different package name because this name already exists in play store
google delete my play store account now i am uploading my application from new account but it is showing error that this name already exits.if i change my package name it is also connected to google-services.jason(firebase realtime database) but i cannot change firebase path because application users already using application with old package name and database
how can i fix it?</p>

答:
Google delete my Play Store account now I am uploading my application from a new account.

If they deleted your account, it's because you infringed some rules for your app, Google will give you warnings if your app needs something to change, if your account has been deleted is because your app is not able to be in the Play Store

Please check: https://play.google.com/about/developer-content-policy/

About the question

You can't change a package name of an existing app in the playstore once you upload it, if you try to have the same package name in another account, you can't upload that apk, you can change the package at your project level and in Firebase, but if you are trying to upload again your app and has been already uploaded in another account, you can't upload it again.