text:
Q: Filled barplot and density curve I am trying to create a bar graph with a density curve that shows the bar trends, see the example in the figure 1 (I created this example by PowerPoint).
The fill corresponds to the Time column, the y to the abundance value and the x to the species.
However, in the script I wrote, I couldn't this plot.
Would anyone here know how to improve my script?

data<-read.csv(file= "data.csv", header= TRUE, sep= ";" )
names(data)

library(ggplot2)
library(plyr)
library(dplyr)

mu <- ddply(data, "Time", summarise, grp.mean=mean(body_mass))
head(mu)

ggplot(data, aes(x=body_mass, y=Abund, color=Time, fill=Time)) +
geom_histogram(aes(y=..density..), position="identity", alpha=0.5)+
  geom_density(alpha=0.6)+
  geom_vline(data=mu, aes(xintercept=grp.mean, color=warfare),
             linetype="dashed")+
  scale_color_manual(values=c("#E69F00", "#56B4E9", "#FF1234"))+
  scale_fill_manual(values=c("#E69F00", "#56B4E9", "#FF1234"))+
  labs(title="Abundance",x="body mass", y = "abundancey")+
  theme_classic()
specie body_mass Time Abund
sp1 3824539.93 Time1 2
sp1 3824539.93 Time1 3
sp1 3824539.93 Time1 3
sp1 3824539.93 Time1 2
sp1 3824539.93 Time1 2
sp1 3824539.93 Time1 3
sp1 3824539.93 Time1 3
sp1 3824539.93 Time1 2
sp1 3824539.93 Time1 4
sp1 3824539.93 Time1 2
sp1 3824539.93 Time1 2
sp1 3824539.93 Time1 4
sp1 3824539.93 Time1 3
sp1 3824539.93 Time1 2
sp1 3824539.93 Time1 4
sp1 3824539.93 Time1 3
sp1 3824539.93 Time1 3
sp1 3824539.93 Time1 3
sp1 3824539.93 Time1 3
sp1 3824539.93 Time1 3
sp1 3824539.93 Time1 3
sp1 3824539.93 Time1 4
sp1 3824539.93 Time1 4
sp1 3824539.93 Time1 2
sp1 3824539.93 Time1 3
sp1 3824539.93 Time1 2
sp2 1536310.4 Time1 3
sp2 1536310.4 Time1 3
sp2 1536310.4 Time1 2
sp2 1536310.4 Time1 2
sp2 1536310.4 Time1 2
sp2 1536310.4 Time1 2
sp2 1536310.4 Time1 2
sp2 1536310.4 Time1 1
sp2 1536310.4 Time1 2
sp2 1536310.4 Time1 2
sp2 1536310.4 Time1 1
sp2 1536310.4 Time1 1
sp2 1536310.4 Time1 2
sp2 1536310.4 Time1 3
sp3 592665.98 Time1 2
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 2
sp3 592665.98 Time1 4
sp3 592665.98 Time1 2
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 2
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 4
sp3 592665.98 Time1 2
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 3
sp3 592665.98 Time1 2
sp3 592665.98 Time1 3
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 3
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 2
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp3 592665.98 Time1 4
sp4 562592.69 Time1 1
sp4 562592.69 Time1 1
sp4 562592.69 Time1 1
sp4 562592.69 Time1 1
sp4 562592.69 Time1 1
sp4 562592.69 Time1 1
sp4 562592.69 Time1 1
sp4 562592.69 Time1 3
sp4 562592.69 Time1 4
sp4 562592.69 Time1 3
sp4 562592.69 Time1 3
sp4 562592.69 Time1 3
sp4 562592.69 Time1 2
sp4 562592.69 Time1 4
sp4 562592.69 Time1 3
sp4 562592.69 Time1 3
sp4 562592.69 Time1 3
sp4 562592.69 Time1 3
sp4 562592.69 Time1 3
sp4 562592.69 Time1 3
sp4 562592.69 Time1 2
sp4 562592.69 Time1 1
sp4 562592.69 Time1 3
sp5 264173.96 Time1 1
sp5 264173.96 Time1 1
sp5 264173.96 Time1 3
sp5 264173.96 Time1 4
sp5 264173.96 Time1 1
sp5 264173.96 Time1 2
sp5 264173.96 Time1 3
sp5 264173.96 Time1 2
sp5 264173.96 Time1 2
sp5 264173.96 Time1 3
sp5 264173.96 Time1 3
sp5 264173.96 Time1 2
sp5 264173.96 Time1 2
sp5 264173.96 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 1
sp6 158623.93 Time1 1
sp6 158623.93 Time1 3
sp6 158623.93 Time1 2
sp6 158623.93 Time1 1
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 1
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 1
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 3
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 3
sp6 158623.93 Time1 3
sp6 158623.93 Time1 2
sp6 158623.93 Time1 3
sp6 158623.93 Time1 2
sp6 158623.93 Time1 1
sp6 158623.93 Time1 3
sp6 158623.93 Time1 2
sp6 158623.93 Time1 3
sp6 158623.93 Time1 3
sp6 158623.93 Time1 1
sp6 158623.93 Time1 2
sp6 158623.93 Time1 1
sp6 158623.93 Time1 3
sp6 158623.93 Time1 3
sp6 158623.93 Time1 2
sp6 158623.93 Time1 1
sp6 158623.93 Time1 3
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 3
sp6 158623.93 Time1 2
sp6 158623.93 Time1 2
sp6 158623.93 Time1 1
sp6 158623.93 Time1 3
sp6 158623.93 Time1 3
sp6 158623.93 Time1 3
sp6 158623.93 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 2
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp7 69063.79 Time1 2
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp7 69063.79 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp7 69063.79 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp7 69063.79 Time1 2
sp7 69063.79 Time1 4
sp7 69063.79 Time1 2
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp7 69063.79 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp7 69063.79 Time1 3
sp7 69063.79 Time1 2
sp7 69063.79 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp7 69063.79 Time1 4
sp7 69063.79 Time1 3
sp7 69063.79 Time1 3
sp7 69063.79 Time1 4
sp8 63369.98 Time1 2
sp8 63369.98 Time1 2
sp8 63369.98 Time1 2
sp8 63369.98 Time1 2
sp8 63369.98 Time1 2
sp8 63369.98 Time1 1
sp8 63369.98 Time1 1
sp8 63369.98 Time1 2
sp8 63369.98 Time1 2
sp8 63369.98 Time1 3
sp8 63369.98 Time1 2
sp8 63369.98 Time1 2
sp8 63369.98 Time1 2
sp8 63369.98 Time1 2
sp8 63369.98 Time1 2
sp8 63369.98 Time1 2
sp8 63369.98 Time1 3
sp8 63369.98 Time1 3
sp8 63369.98 Time1 2
sp8 63369.98 Time1 2
sp10 56175.2 Time1 2
sp10 56175.2 Time1 3
sp10 56175.2 Time1 3
sp10 56175.2 Time1 3
sp10 56175.2 Time1 2
sp10 56175.2 Time1 2
sp10 56175.2 Time1 3
sp10 56175.2 Time1 2
sp10 56175.2 Time1 2
sp10 56175.2 Time1 2
sp10 56175.2 Time1 3
sp10 56175.2 Time1 2
sp10 56175.2 Time1 1
sp10 56175.2 Time1 1
sp10 56175.2 Time1 2
sp10 56175.2 Time1 2
sp10 56175.2 Time1 2
sp10 56175.2 Time1 2
sp10 56175.2 Time1 1
sp10 56175.2 Time1 1
sp10 56175.2 Time1 2
sp10 56175.2 Time1 3
sp10 56175.2 Time1 2
sp10 56175.2 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 3
sp11 52399.99 Time1 3
sp11 52399.99 Time1 3
sp11 52399.99 Time1 2
sp11 52399.99 Time1 3
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 1
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 3
sp11 52399.99 Time1 2
sp11 52399.99 Time1 3
sp11 52399.99 Time1 3
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 3
sp11 52399.99 Time1 3
sp11 52399.99 Time1 3
sp11 52399.99 Time1 2
sp11 52399.99 Time1 3
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 3
sp11 52399.99 Time1 2
sp11 52399.99 Time1 3
sp11 52399.99 Time1 3
sp11 52399.99 Time1 3
sp11 52399.99 Time1 1
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 3
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 3
sp11 52399.99 Time1 3
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 1
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp11 52399.99 Time1 2
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 2
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 2
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 2
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 2
sp1 3824539.93 Time2 2
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 0
sp1 3824539.93 Time2 1
sp1 3824539.93 Time2 1
sp2 1536310.4 Time2 2
sp2 1536310.4 Time2 2
sp2 1536310.4 Time2 2
sp2 1536310.4 Time2 2
sp2 1536310.4 Time2 2
sp2 1536310.4 Time2 1
sp2 1536310.4 Time2 3
sp2 1536310.4 Time2 1
sp2 1536310.4 Time2 3
sp2 1536310.4 Time2 3
sp2 1536310.4 Time2 1
sp2 1536310.4 Time2 2
sp2 1536310.4 Time2 2
sp2 1536310.4 Time2 2
sp2 1536310.4 Time2 1
sp2 1536310.4 Time2 1
sp2 1536310.4 Time2 1
sp2 1536310.4 Time2 0
sp2 1536310.4 Time2 1
sp2 1536310.4 Time2 1
sp2 1536310.4 Time2 1
sp2 1536310.4 Time2 2
sp2 1536310.4 Time2 1
sp2 1536310.4 Time2 0
sp2 1536310.4 Time2 1
sp2 1536310.4 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 0
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 2
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 0
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 0
sp3 592665.98 Time2 2
sp3 592665.98 Time2 1
sp3 592665.98 Time2 2
sp3 592665.98 Time2 2
sp3 592665.98 Time2 1
sp3 592665.98 Time2 2
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 2
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 0
sp3 592665.98 Time2 2
sp3 592665.98 Time2 2
sp3 592665.98 Time2 2
sp3 592665.98 Time2 1
sp3 592665.98 Time2 0
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 0
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 2
sp3 592665.98 Time2 1
sp3 592665.98 Time2 0
sp3 592665.98 Time2 1
sp3 592665.98 Time2 1
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 0
sp3 592665.98 Time2 1
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 1
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp4 562592.69 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp5 264173.96 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 2
sp6 158623.93 Time2 1
sp6 158623.93 Time2 0
sp6 158623.93 Time2 1
sp6 158623.93 Time2 0
sp6 158623.93 Time2 1
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 1
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 2
sp6 158623.93 Time2 1
sp6 158623.93 Time2 2
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 0
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 2
sp6 158623.93 Time2 1
sp6 158623.93 Time2 1
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 2
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 0
sp6 158623.93 Time2 2
sp6 158623.93 Time2 2
sp6 158623.93 Time2 2
sp6 158623.93 Time2 2
sp7 69063.79 Time2 2
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 4
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 4
sp7 69063.79 Time2 4
sp7 69063.79 Time2 2
sp7 69063.79 Time2 4
sp7 69063.79 Time2 4
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 2
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 2
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 4
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 2
sp7 69063.79 Time2 2
sp7 69063.79 Time2 2
sp7 69063.79 Time2 2
sp7 69063.79 Time2 3
sp7 69063.79 Time2 2
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 1
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 4
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 2
sp7 69063.79 Time2 4
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 2
sp7 69063.79 Time2 3
sp7 69063.79 Time2 2
sp7 69063.79 Time2 3
sp7 69063.79 Time2 2
sp7 69063.79 Time2 1
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 2
sp7 69063.79 Time2 3
sp7 69063.79 Time2 2
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp7 69063.79 Time2 2
sp7 69063.79 Time2 1
sp7 69063.79 Time2 2
sp7 69063.79 Time2 2
sp7 69063.79 Time2 3
sp7 69063.79 Time2 2
sp7 69063.79 Time2 3
sp7 69063.79 Time2 1
sp7 69063.79 Time2 2
sp7 69063.79 Time2 1
sp7 69063.79 Time2 1
sp7 69063.79 Time2 2
sp7 69063.79 Time2 3
sp7 69063.79 Time2 3
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 2
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 1
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 1
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0
sp8 63369.98 Time2 0 1
sp11 52399.99 Time2 0
sp11 52399.99 Time2 0
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 2
sp11 52399.99 Time2 1
sp11 52399.99 Time2 2
sp11 52399.99 Time2 2
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 3
sp11 52399.99 Time2 2
sp11 52399.99 Time2 3
sp11 52399.99 Time2 2
sp11 52399.99 Time2 2
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 2
sp11 52399.99 Time2 2
sp11 52399.99 Time2 3
sp11 52399.99 Time2 1
sp11 52399.99 Time2 3
sp11 52399.99 Time2 2
sp11 52399.99 Time2 2
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 2
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 2
sp11 52399.99 Time2 3
sp11 52399.99 Time2 2
sp11 52399.99 Time2 2
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 2
sp11 52399.99 Time2 2
sp11 52399.99 Time2 3
sp11 52399.99 Time2 2
sp11 52399.99 Time2 2
sp11 52399.99 Time2 3
sp11 52399.99 Time2 3
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 3
sp11 52399.99 Time2 2
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 3
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 3
sp11 52399.99 Time2 3
sp11 52399.99 Time2 1
sp11 52399.99 Time2 0
sp11 52399.99 Time2 1
sp11 52399.99 Time2 0
sp11 52399.99 Time2 1
sp11 52399.99 Time2 1
sp11 52399.99 Time2 0
sp11 52399.99 Time2 0

A: look over this line geom_histogram(aes(y=..density..), i suspect this is where your error is arising


text:
Q: Better way for PHP Switch Statement with Condition operator in each Case? Optimization I am developing a template for a WordPress page. Users have levels (beginner, amateur, intermediate, and advanced). My need was to load a % of content based on the level, with each higher level increasing the % of content shown.
As a novice, I wanted to work only in page-template.php.  Alternative syntax lets you put HTML markup (without include and external .html files) between php tags. Next, the switch statement has fallthrough functionality to "load" content based on their level.
After reading more on switch, comparison operators in switch, heredoc, and alternative syntax, I still wasn't able to find what worked for me, so I wanted to share this to future novice programmers some time :p
Here is a functional piece of code that achieves what I want:
<?php $level = 1; // enter user level here ?>
<?php switch(true): ?>
<?php case ($level >= 1): ?>

        1

<?php if($level == 1){break;} ?>
<?php case ($level >= 2): ?> // ugly code

        2

<?php if($level == 2){break;} ?> // ugly code
<?php case ($level >= 3): ?>

        3

<?php if($level == 3){break;} ?> // ugly code
<?php case ($level >= 4): ?>

        4

<?php if($level == 4){break;} ?> // ugly code
<?php endswitch; ?>

That is, with each level, you get 25% more content until level 4... where all content is available. You will notice I have conditional breaks. This is because the conditionals in the cases don't seem to work alone as you one would hope -- I wasn't able to figure out why, but the break with the conditional help. It's redundant but it's the only thing I got to work.
For future readers, be wary of the spacing and tabination. Alternative syntax is very particular about it, and it may frustrate you if you neglect it.
So my question is if there is another way to improve this code or a cleaner way to write it? While writing this, I realize I can probably use alternative syntax for the breaks.

A: Maybe you can consider using a for loop?
<?php
$content[1] = "Content A";
$content[2] = "Content B";
$content[3] = "Content C";
$content[4] = "Content D";

$level = 3; // enter user level here

for ($lvl = 1; $lvl <= $level; $lvl++) { ?>

        <?php echo $content[$lvl]; ?>

<?php } ?>

A: I wouldn't use switch for this, but just a series of if statements:
<?php $level = 2; // enter user level here ?>

<?php if ($level >= 1) { ?>

 1

<?php } if ($level >= 2) { ?>

 2

<?php } if ($level >= 3) { ?>

 3

<?php } if ($level >= 4) { ?>

 4

<?php } ?>

An alternative is to first store all the content in an array, and then output a slice of that array:
<?php

$level = 2;

$content = [
<<<TEXT

 1

TEXT
,
<<<TEXT

 2

TEXT
,
<<<TEXT

 3

TEXT
,
<<<TEXT

 4

TEXT
];

echo implode("\n", array_slice($content, 0, $level));
?>

redpajama_set_name: RedPajamaStackExchange


text:
Q: Spring Boot Integration Test : Mock Environment Interface In my Spring Security UserDetailsService, I inject Environment to read credentials from env variables.
In an integration test, I would like to mock the Environment interface in order to change the env variables for the tests.
Here is my Test :
@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = EportfolioApplication.class)
@AutoConfigureMockMvc
public class IntegrationAuth {
    @Autowired
    private MockMvc mockMvc;

    @Autowired
    private ObjectMapper objectMapper;

    @Test
    void loginCorrectCredentials_returnsToken() throws Exception {
        User user = new User();
        user.setUsername("John Shepard");
        user.setPassword("Tali");

        MvcResult mvcResult = mockMvc.perform(post("/login")
                .contentType("application/json")
                .content(objectMapper.writeValueAsString(user)))
                .andExpect(status().isOk())
                .andReturn();

        assertNotNull(
                "JWT Token should be present",
                mvcResult.getResponse().getHeader("Authorization")
        );
    }
}

What would be the best approach for this ?

A: You can use @TestPropertySource#properties. From its javadoc:

Inlined properties in the form of key-value pairs that should be added to the Spring Environment before the ApplicationContext is loaded for the test. All key-value pairs will be added to the enclosing Environment as a single test PropertySource with the highest precedence.

Here is a minimal example:
@Service
class MyService(
        environment: Environment
) {
    private val foo = environment["com.caco3.demo.foo"]

    fun getFoo() = foo
}

Test:
@SpringBootTest
@TestConstructor(autowireMode = TestConstructor.AutowireMode.ALL)
@TestPropertySource(properties = ["com.caco3.demo.foo=test"])
class ApplicationTest(
        private val service: MyService
) {
    @Test
    fun fooIsEqualToTest() {
        assertEquals("test", service.getFoo())
    }
}


text:
Q: Silverstripe CMS gives File size zero error I have designed a page that has upload attachments ... one image and another PDF.
The data is created in the database, however, when trying to upload a file of either type I get a server error "File Size is zero bytes".
A search of this forum yielded entries that indicate it is a permission issue of site assets folder or assets/Uploads folder. I have checked both and the permissions are correct.
The search on other platforms seems to indicate file size issues are from the PHP5.6 php.ini file settings. Both are correct and set to a value well above the 8Mb default.
The Apache2 log looks like:
[Tue Jun 06 15:11:57.167558 2017] [:error] [pid 26971] [client 192.168.1.73:50192] PHP Warning:  mkdir(): Permission denied in /var/www/html/ss/framework/filesystem/Filesystem.php on line 53, referer: http://192.168.1.70/ss/index.php/admin/pages/edit/show/23
[Tue Jun 06 15:11:57.170810 2017] [:error] [pid 26971] [client 192.168.1.73:50192] PHP Warning:  copy(/var/www/html/ss/assets/Uploads/news-attachments/the-satern-ring.pdf): failed to open stream: Permission denied in /var/www/html/ss/framework/filesystem/Upload.php on line 207, referer: http://192.168.1.70/ss/index.php/admin/pages/edit/show/23

This code also seems to indicate a permission issue. The folders all have the owner as root group as root and drw-rw----, files can be uploaded manually but not through the CMS.
So where do I look now?
Environment:
SS v3.6.0 theme bootstrap
OS Linux Mint 18.1
Apache 2.4 PHP 5.6

A: This can occur when framework does not have permission to write files to the server. If this is the case, when we upload images through the CMS the file can not be written to assets and the CMS returns a  "File size zero error". The website also cannot combine files (such as JavaScript and CSS files) and cannot create new resampled images.
To help investigate this problem we can run the SilverStripe install wizard. The install wizard will notify us of issues preventing SilverStripe from running correctly.
To run the install wizard we visit http://www.example.com/install.php
The install.php is usually deleted after the site is installed, so if it is missing we will need to replace it. We can download the file from github. Here is the install.php file for SilverStripe 3.6: https://github.com/silverstripe/silverstripe-installer/blob/3.6/install.php
Once downloaded we upload this to the root directory of our webserver. Once this is done we can visit the install.php URL.
Here is a screenshot showing an example of the file permission issue warnings that the install wizard outputs:

What we want to do now is fix up all the warnings that the install wizard is reporting.
If this is a shared hosting environment we might not have the ability to fix these issues ourselves. In this case we should be able to send the install.php link to hosting support asking them fix the issues.
Once all the issues are fixed the site should work correctly. Make sure to delete the install.php when we are done.


text:
Q: F2051 Unit JclRegistry was compiled with a different version of System.UInt64 I'm implementing debugging with JEDI in my project. I added the ExceptionDialog with wizard, but when I'm trying the build project, I get

F2051 Unit JclRegistry was compiled with a different version of System.UInt64


text:
Q: "Great Leader, X" or "Great Leader X" I want to know if that comma is necessary in this case, it kinda gives me a feeling that it should be used but I'm not really sure.

*

*They went directly to the Great Leader, X

*They went directly to the Great Leader X

A: It depends on whether "Great Leader" is being used as a title (like Mr) or as a noun.  The use of "Great Leader" is not a common or standard title but some dictators might use it as a title.
For example, the first President of North Korea used "Great Leader" as a title. As a title, you don't need "the", but you do use capitals (the title is part of a name).

They went to Great Leader Kim Il Sung.
The went to President Trump.
The went to Mr Smith.

On the other hand, the comma can be used as an appositive. In this case you do need "the":

They went to the "great leader", Kim Il Sung.
They went to the president, Mr Trump.
They went to the butcher, Mr Smith.

The meaning is "the butcher, whose name is Mr Smith" or "Mr Smith, who is a butcher"
In these cases I've not used a capital (since these are common nouns) and I've used a separate title (Mr) or a full name "Kim Il Sung".  There are quote around "great leader" to indicate "the so-called great leader", rather than a leader who I think is particularly great.

A: In my opinion of course "Comma is needed." If we do not use comma,  we can say ,"X the great leader!". But in order to avoid the article "The" and longer text, we better use "Comma".


text:
Q: revert GIT HEAD to older commit I have realized that I have committed stuff into my branch that's bad and I want to revert to an earlier commit. I have confirmed that git checkout 8dd018c brings me to an earlier commit to which I want to revert HEAD to now, I  tried the following:
git checkout 8dd018c
git status
HEAD detached at 8dd018c
nothing to commit, working directory clean
git reset --hard  8dd018c
git push origin HEAD:<my_branch>

but got:
 ! [rejected]        HEAD -> my_branch (non-fast-forward)
error: failed to push some refs to 'https://github.com/my/repository.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

How do I do this correctly? I'm not the only one working on this repository so I think push -f is out of the question, is it?

A:
so I think push -f is out of the question, is it?

It doesn't matter whether it's out of the question. It is impossible to do what you're trying to do without using force, because you are asking the remote to throw away its references to all the commits after 8dd018c, and it will not do that willingly.
However, take comfort, because:

*

*No one else depends on this branch; it's yours.

*You can push --force-with-lease, which means, "Please do as I'm telling you to do, but only as long as it is safe" (safe in the sense that no one else has pushed to your branch, which, as it is yours, is pretty well guaranteed).

*You could solve the whole problem with no force, just by giving up on this branch entirely. After all, it is only a name. So start a new branch with a different name at 8dd018c, and push that branch. The remote will happily let you do that. Of course, you would also like to delete the old branch, and again, that will require you to use force in one form or another.

*You could solve the whole problem with no force, with a revert commit. Instead of removing commits, you add a new commit that makes your code go backwards to the same state it was when you were at 8dd018c. I think that's my favorite solution, actually. Sure, the bad code stays in the commits you already pushed, but who cares? People do make mistakes.
Basically, if you're going to push a branch to a shared remote, you're going to run into this sort of issue and you need to reconcile yourself to it. I personally am very fond of rewriting my branch's history before I push it, and that means I don't want to push it until I'm well and truly finished with it. If I'm concerned that my computer might be hit by a bus, I can make a backup, or I can even add a second remote and push the branch to that instead. Other folks are more cavalier about pushing their branch to the shared remote and changing its history with force. This is the kind of thing you should talk over with your team.

A: The way you could do it with minimum hassle is:
git checkout old-commit
git reset --soft the-branch
git commit -m "Going back in time"
# now you are one revision on top of the-branch but content is like old-revision
# if you like the result
git branch -f the-branch # set branch where you are now
git checkout the-branch

And now you can push and stuff.


text:
Q: What are the L-sentences that are true in an empty structure? I am looking for an algorithm or set of rules to figure out whether a sentence (in first order logic) is true when we are dealing with an empty set as domain. Clearly, it has to be a sentence (no free variables) or there would be nothing to assign. It's also clear to me that universal formulas will be true while existential ones won't, but I think I might be missing something else, maybe... what happens when the formula is $\forall\exists$ and $\exists\forall$? My guess would be to just take the first quantifier, but might be wrong about that... I would appreciate your input and suggestions about this.

A: The algorithm you are looking for is probably this: for quantified sentences, use just the first quantifier: $\forall$ sentences are true and $\exists$ sentences are false.
But the situation is more complicated. Remember that truth-in-a-structure is a defined notion.
There are two general ways of defining semantics for first-order structures, and they disagree when the structure is empty. They are:

*

*Define the notion of a 'variable assignment' function. Then a sentence is defined to be true if it is satisfied by some variable interpretation (or, in some books, by every variable interpretation; this is equivalent for sentences in non-empty models).

*Add a constant $c_a$ to the language for each element $a$ of the domain. Then a sentence of the form $(\forall x)\phi(x)$ is true if $\phi(c_a)$ is true for every element $a$ of the domain.
For non-empty structures, these give equivalent results. But for empty structures they do not, so the collection of true sentences of an empty structure depends on what convention you follow for defining the set of true sentences.
Option (2) works basically they way you want. But option (1) does not. There are no variable assignment functions, because the set of variables is always non-empty even if the domain is empty. So if we say that a sentence is true if it is satisfied by some variable assignment, then no sentence is true. If we say that a sentence is true if it is satisfied by every variable assignment, then every sentence is true. This is not what you would immediately expect.
Even if we use option (2), when we look at empty structures we lose many sentences that are true in all nonempty models. For example,
the prenex normal form of $(\forall x)(x = x) \land \bot$ is $(\forall x)(x = x \land \bot)$. The former is false in an empty structure, while the latter is true under option (2). But those two sentences are equivalent in every nonempty structure. Many of the inference rules of first-order logic, like the ones used for prenex normal form, have hidden assumptions that the domain is non-empty.


text:
Q: PHP: How to retrieve Stripe payment intents for a specific customer only I am trying to retrieve a list of payment intents from Stripe.
I found out that the below returns me all the latest payment intents which looks correct in my case.
How can I limit this to a specific customer only (based on the customer ID) AND retrieve only specific items of the payment intents, e.g. payment date, amount and ordered product or product ID (instead of dumping the whole data) ?
Can anyone here help me with this ?
My PHP:
\Stripe\Stripe::setApiKey('my_key');

$orders = \Stripe\PaymentIntent::all(['limit' => 10]);

print_r($orders);

A: For the first part of the question (limit this to a specific customer only) It's very well explained in the docs :
List of parameters for PHP PaymentIntent::all method
It reads:

customer -
  optional -
  Only return PaymentIntents for the customer specified by this customer ID.

So all you have to do is to replace
\Stripe\PaymentIntent::all(['limit' => 10]);

with
\Stripe\PaymentIntent::all(['limit' => 10, 'customer' => 'your customer id']);


text:
Q: How do I get a shared value in Fastlane? I use the changelog_from_git_commits Fastlane action to gather a changelog from the commit logs. The output ends up in a FL_CHANGELOG variable:
Actions.lane_context[SharedValues::FL_CHANGELOG] = changelog

Now I would like to post the changelog along with my Slack notification:
slack(payload: { 'Changelog' => WHAT_DO_I_WRITE_HERE? })

What do I write there? ENV["FL_CHANGELOG"] didn't work.

A: This worked:
payload: { 'Changelog' => Actions.lane_context[SharedValues::FL_CHANGELOG] })


text:
Q: Как создать POJO класс если поля должны меняться? Имеется JSON, но поле даты меняется. Как его указать в POJO классе?

A: Пример на kotlin:
data class Data(val rates: Map<Date, Map<String, Double>>)

Останется только правильно настроить десериализатор для даты по шаблону из yyyy-MM-dd. Или заменить Date на String


text:
Q: What is the fastest way to fill a simple object from a DataTable? I was just wondering is there a faster or more efficient method to convert a DataTable to an object?
The method I am currently using is this:
public class Job {
    int JobID { get; set; }
    decimal JobCost { get; set; }

    Job(DataRow dr)
    {
        ID = Convert.ToInt32(dr["ID"]);
        if(dr["JobCost "] != DBNull.Value)
            JobCost = Convert.ToDecimal(dr["DelAmt"]);
    }
}

public static List<Job> FillObjects()
{
    DataTable dtJobs = JobController.GetJobTable();

    foreach (DataRow dr in dtJobs.Rows)
    {
        jobs.Add(new Job(dr));
    }

    return jobs
}

This is an obviously simplified example, however this gets rather slow with many rows in the data table and many properties in the object. Is there a faster or more efficient method for doing something like this?
Thanks in advance for any replies!

A: Without utilizing Entity Framework your options are limited to something like you've already developed or using Linq to put them into their objects such as:
dtJobs.AsEnumerable().Select(x=> new Job{
                                   ID = x.Field<int>("ID"),
                                   JobCost = x.Field<Decimal>("DelAmt")
});

This will return an enumerable of Job objects, that you can then use to do whatever. One caveat with your current set up is that this will not allow for nulls to be returned. If you wanted to do this use a nullable decimal field and handle the null else where.

A: If order is not important - you can do this using a parallel for each loop over the data rows.  This will be much faster to process.  One must be careful doing this on a server application though.
Note: I updated to lock on the list when adding to it.  You can also use a collection from the concurrent collections instead of using a lock.
  class Program
{
    static void Main(string[] args)
    {
        var sync = new Object();
        var dt = new DataTable();  // fill data
        var jobs = new List<Job>();
        Parallel.ForEach(dt.AsEnumerable(), row =>
        {
            var job = JobFactory.GetJob(row);
            lock (sync)
            {
                jobs.Add(job);
            }
        });
    }
}

public class JobFactory
{
    public static Job GetJob(DataRow d)
    {
        var j = new Job();

        // do processing here from data row to fill job object
        return j;
    }
}

public class Job
{

}


text:
Q: Django Model Form Require Boolean Field To Be Checked True To Submit Form I would like a boolean field to be required to true in order for the form to be submitted and to throw an error to agree to the terms. Best way to do this?

A: I see two solutions here:

*

*You check if your input is checked in the processing of your form inside your Django view, but this means potentially going back and forth between the server and the client side if the input is not checked.

*You do the checking only on the client side using Javascript. I would recommend this solution as this improves user experience (well it's more the other solution would degrades it I think).

Hope this helps!


text:
Q: How to get the actual HTTP request from a model in rails 3? I would need to get the actual Request from a model in rails 3. I know there is not always an request processed, but if there is one I would like to be able to access it. How is it possible to reach. In case of controllers, the request method is in place. But now I need to access the request from a bit "lower level". Can you give me any clues how to do it in Rails?

A: You can store the request in the thread, and then access it anywhere.
This is def a hack as you really should not break the MVC convention this way, and if a model is really request dependent you could always pass the request to the model as a parameter.
but the hack to make your request available everywhere would be for application_controller.rb:
before_filter :store_request_in_thread

def store_request_in_thread
  Thread.current[:request] = request
end

and in your model  somemodel.rb or really anywhere you expect request to already exist, you can just access the request:
def something
  request = Thread.current[:request]
end


text:
Q: Inspection of Insert Statement When Using LINQ's SubmitChanges I want to see what my insert statement would look like as if I was wiring
up an text-based ADO.NET command. How do I do this?
I have been following the below link:
http://damieng.com/blog/2008/07/30/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers
And have added the DebugTextWriter class to my project. So, now, in my code I have the following which doesn't really do anything and I don't think its right:
    using(WorkbookDataContext dc = _conn.GetContext())
    {
        if(profile.ProfileId > 0)
        {
            dc.Profiles.Attach(profile, true);
        }
        else
        {
            dc.Profiles.InsertOnSubmit(profile);
        }

        dc.Log = new DebugTextWriter();

        #if DEBUG
            dc.Log = new System.IO.StreamWriter("linq-to-sql.log")
            {
                 AutoFlush = true
            };
        #endif

        dc.SubmitChanges();
    }

Any ideas what I am doing wrong and/or how to inspect my LINQ insert statement correctly?
Thanks

A: How to: Display Generated SQL (LINQ to SQL)
You can view the SQL code with the Log property.
Example: use the Log property to display SQL code in the console window before the code is executed.
You can use this property with query, insert, update & delete commands.
db.Log = Console.Out;
IQueryable<Customer> custQuery =
    from cust in db.Customers
    where cust.City == "London"
    select cust;

foreach(Customer custObj in custQuery)
{
    Console.WriteLine(custObj.CustomerID);
}

These lines from the console window are what you see when you execute the C# code above.
SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactT
itle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Coun
try], [t0].[Phone], [t0].[Fax]
FROM [dbo].[Customers] AS [t0]
WHERE [t0].[City] = @p0
-- @p0: Input String (Size = 6; Prec = 0; Scale = 0) [London]
-- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.20810.0

AROUT
BSBEV
CONSH
EASTC
NORTS
SEVES

Alternately, you can use the LINQ to SQL Debug Visualizer to hover over a LINQ expression while in the VS 2008 debugger, and then inspect the raw SQL that the ORM will execute at runtime when evaluating the LINQ query expression.


text:
Q: pointerEvents not working I have a list of the following elements :

I want the entire list to be disabled apart from the last two images in a function. I'm doing something like this :
  document.getElementById('toolbar-elements-right').style.pointerEvents = 'none';
  document.getElementById('toolbar-icons_zoom-in').style.pointerEvents = 'auto';
  document.getElementById('toolbar-icons_zoom-out').style.pointerEvents = 'auto';

However, the first element 'toolbar-icons_zoom-in'is enabled, but the second element 'toolbar-icons_zoom-out' remains disabled. Any way to solve this?

A: You can instead disable the first items only. I have added a css class for the disabled elements and applied css via JavaScript.

And the JS
var elem = document.querySelectorAll(".disable-pointer");
var i;
for (i = 0; i < elem.length; i++) {
    elem[i].style.pointerEvents = 'none';
}

If you prefer plain CSS, then that's much easier like doing
.disable-pointer {
  pointer-events: none;
}

A: It works in my case. Check your onClick function zoomNodeOut() if that is working.
https://jsfiddle.net/r110668L/

Note: There is a basic error in your HTML. You see the ID selector has to be unique in a page/DOM. You cannot have more than one element with same ID.

A: DEMO:
http://plnkr.co/edit/2g0hsfgeKRImzXbSPF1p?p=preview
It is working fine. Please check the demo.

document.getElementById('toolbar-elements-right').style.pointerEvents = 'none';
document.getElementById('d').style.pointerEvents = 'auto';
document.getElementById('e').style.pointerEvents = 'auto';

a

b

c

d

e


text:
Q: It is very difficult to solve. vs. It is too difficult to solve 'It is very difficult to solve.'
Is this sentence above grammatically correct?
Or does it have to be corrected as
 'It is too difficult to solve.'   ?

A: The idiomatic adjectival construction

*

*too Adjective to Verb Phrase
has the same meaning as the construction

*

*so Adjective that Not Verb Phrase
I.e,

*

*It is too difficult to solve
means something like
(the particular negative construction is vague here
because infinitives don't have tense or modality)

*

*It is so difficult that it can't/won't be solved
Too, in this construction, is a negative trigger, and can license Negative Polarity Items
like ever or take long, which can't occur outside a negative environment

*

**He has ever gone there.

**It takes long to do.
are ungrammatical without a negative, but

*

*He's too busy to ever go there. ( = He's so busy that he never goes/has never gone there)

*It's too simple to take long. ( = It's so simple that it won't/doesn't take long)

A: Both of these are correct, but mean different things.
It is very difficult to solve states that the problem is solvable, but with a high level of difficulty.  Perhaps most people could not solve the problem.
It is too difficult to solve states that the problem is not solvable, even at a high level of difficulty.

A: The syntax for both of these sentences are equally correct, because too and very are both adverbs being used to modify the adjective difficult. Which sentence you want to use depends entirely upon what semantic modification you wish to convey.
Very is an adjective which is cognate with verify from the Latin adjective verus, which means "true". On this basis it would make sense for it to signify something along the lines of "truly", e.g., it is "truly difficult to solve." However, it may also be used as an adverb, and adverbs indicating truth are often used figuratively, as grammatical intensifiers:

Intensifiers are adverbs or adverbial phrases that strengthen the meaning of other expressions and show emphasis. Words that we commonly use as intensifiers include absolutely, completely, extremely, highly, rather, really, so, too, totally, utterly, very and at all[.]

Intensifiers(Very,at all) from English Grammar Today:

 Very is exemplified to be among the class of intensifiers, and I would usually expect very difficult to simply be a method of increasing the degree of difficulty to a certain amount, as shown in the following definition:

VER'Y, adverb As an adverb, or modifier of adjectives and adverbs, very denotes in a great degree, an eminent or high degree, but not generally the highest; as a very great mountain; a very bright sun; a very cold day; a very pernicious war; a very benevolent disposition; the river flows very rapidly.

The American Dictionary of the English Language (A.D.E.L.) by Noah Webster, s.v.very

In brief, very difficult means "more difficult than just difficult", and not necessarily "the most difficult" (much less "impossible").
Too, on the other hand, is an adverb that essentially means the same thing as overly, when it precedes the adjective it means to modify. It notes that the degree of difficulty is excessive: more than what is reasonable.

TOO, adverb

*

*Over; more than enough; noting excess; as, a thing is too long, too short, or too wide; too high; too many; too much.

His will too strong to bend, too proud to learn. [—Abraham Cowley]

A.D.E.L. s.v. Too

 These concepts may seem rather similar, and they may indeed overlap in meaning. A person who finds something to be too difficult will almost always attest that it is also very difficult. The converse is not necessarily true, but it is perhaps more likely that a very difficult question will be found to be too difficult than a question which is just difficult.
However it is not necessary for the overlap to exist in all contexts. A question that is too difficult for a younger child to solve might not necessarily be very difficult for somebody with the accumulated knowledge and rational faculties of somebody who is older.

  "We ask a child therefore, "What is your name?" If he replies only by his first name we insist on knowing his family name "Roger? And then? And what else? etc."
    It happens sometimes that the child gives another name than the one by which he is enrolled. To explain these errors one must remember that there are many illegitimate children, and, what is more pitiable, the child's mother has had different husbands, and the name which the child bears in succeeding years is not always the same.
    When a child is not able to give his family name one must not ask him for that of his mother, for this question is too difficult for a three year old child, and the reply "She's called Mama" cannot be taken as a bad answer for this age.

Publications of the Training School at Vineland, New Jersey, Department of Research, Issue 11
  Here we are given an explanation regarding why a question that would be very simple for most people might be too difficult for a three year old child to satisfactorily answer. Whereas most adults would not consider this a very difficult question, and simply reply with our current legal surname, the three year old may have no concept of what that is, especially if the child has multiple potential answers to select.

I might call an examination too difficult if I do not believe that the students' curriculum prepared them to be able to answer it, even if the teacher can, or that the question is more advanced than they should be able to reasonably answer.

Teachers have slammed a Year 11 maths exam that has been deemed "far too difficult" for students and which reduced some to tears in the exam room.
…
However, teachers and students alike have rallied in their disappointment of the NZQA for putting out a test that was unfairly difficult and did not represent what students had been taught in the lead-up.

NZQA Slammed Over 'Far Too difficult' Maths Exam - Students Left in Tears from The New Zealand Herald

However, when designing a video game, I might name one of the difficulty settings very difficult with the full expectation that it should be eventually beatable by players who seek the sort of extra challenge enabling it gives them. This probably will not be too difficult for highly skilled players of the game, and may provide them with just the right degree of difficulty to prevent them from becoming bored.

In video gaming, "difficulty" often does not refer to how difficult a game is in general, but rather to a setting of the game, often chosen by the player in the menu or at the beginning of the game. Sometimes, the difficulty is set for the entirety of the game, sometimes it can be changed during the game. In many video games, difficulty modes run on a general scale of:

*

*Very easy (sometimes known as "beginner", "novice", "basic", etc.)

*Easy

*Normal (sometimes known as "medium", "intermediate", etc.)

*Hard

*Very hard (sometimes known as "hardcore", "nightmare", "extreme", "impossible", etc.)

Excerpt from the Wikipedia article Degree of Difficulty, which is licensed under CC-BY-SA 3.0 terms.

I would mention a particular game by name, but unfortunately the naming variations make it difficult for me to think of one with a plainly named "very difficult" setting. I think I have seen some before, though.
Without further context and information, I cannot tell you which one you should use, but hopefully, with this information, you should be able to compare the words and figure which one is better suited to your context for yourself.

A: Both sentences are correct. However, they have different meanings.

It is very difficult to solve.

The sentence above means that it is difficult. However, you can solve it.

It is too difficult to solve.

The sentence above means that it is too difficult to solve, so you cannot solve it.


text:
Q: In old C, what does this mean? double (*Window)(double) I am trying to convert some old DSP code written in C into Java and later to C#.  I do not understand what the argument "double (*Window)(double)" means and how to reference it in the Java code.  The following function has me unsure what to do.
void WinFirI(float LowOmega, float UppOmega,
       float *Shape, int Len, double (*Window)(double), float shift)
{ int i; double time,phase,shape;
// printf("WinFirI: %5.3f %5.3f %d\n",LowOmega,UppOmega,Len);
  for(i=0; i<Len; i++)
  { time=i+(1.0-shift)-(float)Len/2; phase=2*M_PI*time/Len;
    if(time==0) shape=UppOmega-LowOmega;
       else shape=(sin(UppOmega*time)-sin(LowOmega*time))/time;
// printf("%2d %5.1f %5.2f %7.4f %7.4f\n",i,time,phase,shape,(*Window)     (phase));
    Shape[i]=shape*(*Window)(phase)/M_PI; }
}

So far I have written this:
public void WinFirI(float LowOmega, float UppOmega,
       float[] Shape, int Len, double[] Window, float shift) {
        double time;
        double phase;
        double shape;
//      printf("WinFirI: %5.3f %5.3f %d\n",LowOmega,UppOmega,Len);
        for(int i=0; i<Len; i++) {
            time = i +(1.0-shift) - (float)Len/2;
            phase = 2 * Math.PI * time / Len;
            if(time==0) {
                shape = UppOmega - LowOmega;
            }
       else {
                shape=(Math.sin(UppOmega*time) - Math.sin(LowOmega*time))    / time;
            }
//          printf("%2d %5.1f %5.2f %7.4f %7.4f\n",i,time,phase,shape,    (*Window)(phase));
            //Shape[i]=shape*(*Window)(phase)/M_PI;
            Shape[i] = shape * Window[phase]/Math.PI;
        }
    }

A: Pointer to function with parameter double returning double.

A: As an added note, implementing this function pointer behavior in Java would be done through an anonymous class/interface.
double Window(double param);

In Java would be:
interface WindowFnWrapper {
    double Window(double param);
}

Then the function signature would be:
public void WinFirI(float LowOmega, float UppOmega,
   float[] Shape, int Len, WindowFnWrapper WindowWrapper, float shift)

Every time you call Window() you would replace it with WindowWrapper.Window().

A: The declaration double (*Window)(double) declares a parameter Window, whose value is a pointer to a function.  That function must be one which takes a single double as an argument, and returns a double.
In your C code, (well, actually the commented-out part), that pointer gets dereferenced, and the function called, passing phase as its argument.  That is, the value of the expression (*Window) (phase) is just the result of calling the function whose address you passed in.
If you're using Java 8 or above, the nearest available equivalent is the Function generic class, from the java.util.function package.  So if you write
import java.util.function.Function;

then you can declare the parameter as
Function<Double,Double> window

and use it as
window.apply(phase);

The only real difference between this and your C code is that the type parameters to Java generics can't be primitive types such as double.
Double is a reference type that works a bit like double, except that a Double can be null, whereas a double can't.  In effect, this should make no difference to your code, except that you may want to add some error handling to deal with the case where window.apply(phase) evaluates to null.


text:
Q: ValueError: invalid literal for int() with base 10: 'NewFilmLikes' in Python I am trying to get a value from an SQLite3 database and put that into a variable called FilmLikes, I then want to add one to it and I store that in the variable NewFilmLikes. I then try to change the value of this box in my database to the 'NewFilmLikes', however I always get this problem:
ValueError: invalid literal for int() with base 10: 'NewFilmLikes'
Here is the code showing that:
FilmLikes=i[2]
NewFilmLikes=(int(FilmLikes))+1
filmUpdate=("UPDATE HORRORALL SET likes = ? WHERE number = 1"(NewFilmLikes))
c.execute(filmUpdate)
conn.commit()

Here is the code for i:
for i in find_film:
                            print('')
                            print('Number',(i[0]))
                            print(i[1])
                        filmChoice=int(input('Please choose which number you would like to like: '))
                        if filmChoice==1:
                            find_film=c.execute("SELECT * FROM HORRORALL")
                            for i in find_film:
                                if i[0]==filmChoice:
##                                    FilmLikes=i[2]
                                    try:
                                        x=(int(i[2]))+1
                                    except:
                                        pass
##                                        FilmLikes=i[2]
##                                    NewFilmLikes=(int(str(FilmLikes)))+1
                                    filmUpdate=("UPDATE HORRORALL SET likes = ? WHERE number = 1"(x))
                                    c.execute(filmUpdate)
                                    conn.commit()

A: Without knowing much more about your setup, it's hard to answer this properly.
 Mind you, the specific error you refer to (ValueError: invalid literal for int() with base 10: 'NewFilmLikes') often occurs when you get a decimal rather than an integer.
Here's a sort of general answer.

*

*It's good practice not to use SELECT * because it hides what you are trying to retrieve. Specify, e.g SELECT film_id, file_name, no_of_likes FROM horrorall as this way you can see what you are retrieving and the positions.

*You're retrieving the entire list of films with find_film and then looping through to find which one. SQL has a find function, it's called WHERE and you are using it in the film_update section. If you have the ID or Name inputted by the user, you can then call only the record you need. E.g. "SELECT film_id, file_name, no_of_likes FROM horrorall WHERE film_id = ?" (filmChoice,)

*Note that parameterised queries use a tuple, even if there is only one parameter - hence it is (filmChoice,) with a comma (and for filmUpdate you would need (x,))

*filmUpdate will only ever update the first film. I assume that because your if ... loop continues through all the possible options? You can shortly this by putting another ? in there for your WHERE e.g. filmUpdate=("UPDATE HORRORALL SET likes = ? WHERE number = ?"(x,i[0]))

*How does the user know what film to select? You aren't retrieving the list until they give you a number!

Putting all of this together, here is an example. Note this is far from the ideal way of doing it, I don't want to throw too many ideas at you in one go!
# Get the whole list of films to show to the user
find_film = c.execute("SELECT film_id, film_name FROM HORRORALL")
# Present the list for selection
for films in find_film:
    print(str(films[0]) + '. ' + films[1])
# Get the users input as an integer
filmChoice = int(input('Please choose which number you would like to like: '))
# Fetch the number of likes of the selected film
film_likes = c.execute('SELECT likes FROM HORRORALL WHERE film_id = ?' (filmChoice,))
# Send the update back to the database
c.execute("UPDATE HORRORALL SET likes = ? WHERE film_id = ?"(int(film_likes[0]) + 1, filmChoice)
conn.commit()


text: Q: Page thumbnails with pdfbox I'm trying to produce thumbnails for pages for (larger, > 50 pages) pdf documents using pdfbox. I tried using renderer.renderImage(pageNumber) and then scale the image. I also tried using a scale parameter and renderImageWithDPI. Unfortunately, all these attempts take more than 1 second per page image, which makes it more than a minute for all thumbnails. When opening the document with AdobeReader or PDF XChange Editor, the thumbnails seem to appear almost instantaneously. Is there a chance to get the thumbnails more efficiently using pdfbox?


text:
Q: Using two grids for different purposes in Unity I am creating a 2D virtual boardgame in Unity, which has following setup:

This is put in manually as gameObjects, which is highly inconvenient when you need to create multiple mechanics.
For now I need to create 2 mechanics:

*

*Being able to determine which tiles are reachable for the player (decided by a dice)

*Being able to rotate any 3x3 object by its center, like this one:

Note: The big white squares are corner-pieces, and won't be used for any mechanic.
My current state of mind is to make a grid of tiles, then on top of that a 3x3 grid.

*

*Is this the proper way to go around this?

*How would I first create a tile-grid, then a 3x3 grid based on that tile grid?

I've tried messing around with creating the grid from a gameObject or IEnumerator, which either led to unsuccesful attempts, or extreme performance issues for my PC.

A: Here is my idea.

*

*Have a NxN grid consisting of all the game tiles.

*Have one 3x3 grid with 9 preloaded tiles and disable it at start. it is never a good idea to instantiate game objects at run-time.

*When user clicks a tile (Let's call the 9 tiles which lay around the clicked tile from the NxN grid, sub-grid):

*

*Move the 3x3 grid onto the sub-grid

*Hide the 9 tiles from the sub-grid

*Enable the 3x3 grid

*Enable/Disable the 3x3 grid tiles according to the sub-grid tiles

*Start the animation on the 3x3 grid (rotate the whole 3x3 grid) (1)

*Disable the 3x3 grid

*Enable/Disable the sub-grid tiles according to the 3x3 grid tiles (*)

*Show the sub-grid again

*Undo the rotation of 3x3 grid (*)
Note:
(*) When rotating the 3x3 grid the index of each tile is not valid anymore. because the 3x3 grid is rotated but not its tiles. so you need to translate the indices in the 3x3 grid to match the sub-grid indices. it's better not to change the actual indices but to just convert them before use. and remember to undo the rotation when it's done.
I would suggest this approach for translating indices:
struct XY {
    public int x;
    public int y;
    public XY(int X, int Y){x=X;y=Y;}
}

//no need for this one, it's just here to have a better understanding
static XY[,] _rotateNoneIdx = new XY {
   { new XY(0,0), new XY(1,0), new XY(2,0) },
   { new XY(0,1), new XY(1,1), new XY(2,1) },
   { new XY(0,2), new XY(1,2), new XY(2,2) }
};
//translating matrix for translating left-rotated 3x3 grid tiles
static XY[,] _rotateLeftIdx = new XY {
   { new XY(2,0), new XY(2,1), new XY(2,2) },
   { new XY(1,0), new XY(1,1), new XY(1,2) },
   { new XY(0,0), new XY(0,1), new XY(0,2) }
};
//translating matrix for translating right-rotated 3x3 grid tiles
static XY[,] _rotateRightIdx = new XY {
   { new XY(0,2), new XY(0,1), new XY(0,0) },
   { new XY(1,2), new XY(1,1), new XY(1,0) },
   { new XY(2,2), new XY(2,1), new XY(2,0) }
};

//this method translates the rotated tile indices to actual indices
static XY TranslateIndex(XY beforeRotateXY, bool isRotateLeft)
{
    if(isRotateLeft) return _rotateLeftIdx[beforeRotateXY.x, beforeRotateXY.y];
    return _rotateRightIdx[beforeRotateXY.x, beforeRotateXY.y];
}

I haven't test this code so you may need to try swapping the left and right.


text:
Q: How to use scalamock for the awssdk I have a function that has the following type signature:
def post(target: String, partition: String, payload: String): IO[Boolean]

In this function, a call is placed to a third party to post this data to a service through the awssdk. For testing, I don't want these calls actually placed, which has brought me to scalamock, but am not sure how to do this in looking at the documentation.
Within the post function I have leverage my private instance of aws's client for this service after setting credentials. There is a particular method on this instance that is responsible for the call to aws.
How can scalamock be leveraged to mock the awssdk to test the code I have surrounding this and not make the actual call?

A: Do you have a trait that defines this method? Then you can use Scalamock to get an instance of it and make it respond to post calls with whatever value you want it to.
https://scastie.scala-lang.org/KgJ0kptnRaiteNTWPBzrow
trait MyService {
  def post(target: String, partition: String, payload: String): Future[Boolean]
}

val mockedService = mock[MyService]

(mockedService.post _)
  .expects("a", "b","c")
  .returning(Future.successful(true))
  .once()

mockedService.post("a", "b", "c")


text:
Q: Convert a 's text into a hyperlink UPDATE:
Answer #3 ended up working the best.  I most likely did something wrong with the other suggestions; #3 was maybe the easiest to implement.  If you are curious, the example solutions that I tried can be found here (for now):

*

*http://dl.dropbox.com/u/1007716/spanToUrl/test01.html

*http://dl.dropbox.com/u/1007716/spanToUrl/test02.html

*http://dl.dropbox.com/u/1007716/spanToUrl/test03.html (winner)

*http://dl.dropbox.com/u/1007716/spanToUrl/test04.html

*http://dl.dropbox.com/u/1007716/spanToUrl/test05.html

*http://dl.dropbox.com/u/1007716/spanToUrl/test06.html

ORIGINAL POST:
I have a plain text website address inside a  tag.  I'd like to change that  tag into a proper hyperlink with target="_blank"
I've put together a detailed example of what I have to work with here: http://bit.ly/spantourl
If you don't want to click through, here is what I have:
http://www.domain.com/about

and I need to change that into:
http://www.domain.com/about

A: Put the span an id and then you can do something like
var linkText = $("#yourspanid").text();

$("").attr({"href": linkText, "target": "_blank"}).text(linkText).appendTo("body");
$("#yourspanid").remove();

Changing according to your edit
var elems = $("span.myClass > span");
elems.each(function(){
    var linkText= $(this).text();
    $("").attr({"href": linkText, "target": "_blank"}).text(linkText).appendTo("body");
});
elems.remove();

See a working demo

A: You need to have some form of identification in order to do the conversion from node A to node B. I would suggest something along the following lines:
The JQuery code:

The HTML:
http://www.google.com
http://www.youtube.com
http://www.facebook.com

The above code is not tested, but should hopefully lead you in the right direction.

A: Use jQuery.
give the span an id:
http://domain.com

jQuery code:
var href = jQuery('#linkChange').html();
var link = ""+href+"";

jQuery('#linkChange').replaceWith(link);

A: Try this:
$('.sampleClass span').replaceWith(function() {
    var url = $.trim($(this).text());
    return '' + url + '';
});

There's no need for each, since replaceWith can iterate through multiple elements and can take a function as a parameter.
Looking at your sample HTML, I see that it is only the first  that contains a URL. If there is indeed only one, you can add first() to the selector chain, like this:
$('.sampleClass span').first().replaceWith( /* ... */ );

If it is rather the entire column that contains links, than you'll want to operate on every other match. Do this by appending :even to your selector, like this:
$('.sampleClass span:even').first().replaceWith( /* ... */ );

(Yes, :even and not :odd to select the 1st, 3rd, &c. elements, because of 0-based indexing.)

A: Perhaps something like this: (no need to know ids/classes) useing jquerys for-each loop and specificly target spans inside of tds

        $(document).ready(function(){
            $('td span').each(function(){
                $(this).text("" +
                    $(this).text() + "");
            });
        });

EDIT:this code works much better:

The origional used the .text() function of jquery which html escaped the <> characters, unintentionally addin > < into the dom, while .html actually outputs the correct tags


text:
Q: spring resource in WEB-INF I have a bean that has a property of type File. I want that property to end up pointing to a file under WEB-INF.
It seems to me that the ServletContextResourceLoader should have that job, somehow, but nothing I try seems to do the job.
I'm trying to avoid resorting to something like this in the Java code.

A: If that property has to remain as type "File", then you're going to have to jump through some hoops.
It would be better, if possible, to refactor the bean to have a Resource property, in which case you can inject the resource path as a String, and Spring will construct a ServletContextResource for you. You can then obtain the File from that using the Resource.getFile() method.
public class MyBean {

   private File file;

   public void setResource(Resource resource) {
      this.file = resource.getFile();
   }
}

<bean class="MyBean">
   <property name="resource" value="/WEB-INF/myfile">
</bean>


text:
Q: Error running macro I'm having errors message running my macro with the codes below.
Error message when runned directly from Excel Workbook

We didn't fill in the values because the display formatting for some of the cells in the active column is using a different level of precision underlying value

Error message when runned via VBA

Run time error 9, Subscript out of range,

on code With Windows("InstData_TEMS_Existing").Sheets("L")
 Sub Graph()
'
' Graph Macro
'
' Keyboard Shortcut: Ctrl+e
'
'Select values in a column from specified workbook and sheet
Dim LR As Long, cell As Range, rng As Range

With Workbooks("Area3-LG").Sheets("Graph data")
LR = .Range("B" & .Rows.Count).End(xlUp).Row
For Each cell In .Range("B4:B" & LR)
    If cell.Value <> "" Then
        If rng Is Nothing Then
            Set rng = cell
        Else
            Set rng = Union(rng, cell)
        End If
    End If
Next cell
End With
rng.Copy ' copy the union range (no need to select it first)

'Paste without all the selecting
'Error code below
With Windows("InstData_TEMS_Existing").Sheets("L")
' Paste (without select) un the next empty cell fromn column AA
.Range("AA" & .Rows.Count).End(xlUp).Offset(1).PasteSpecial     Paste:=xlPasteValues, Operation:=xlNone, _
                        SkipBlanks:=False, Transpose:=False
End With

Application.CutCopyMode = False

'Go back to previous workbook & delete column
Workbooks("Area3-LG").Sheets("Graph data").Columns("B:B").Delete         Shift:=xlToLeft

End Sub

A: If you have changed your code as sktneer suggested (using With Workbooks("InstData_TEMS_Existing.xlsx").Sheets("L") rather than With Windows(...) and you get an subscript out of bounds error, it can be either that the file InstData_TEMS_Existing.xlsx is not open or that it doesn't have a sheet L in it. I would suggest to put 2 Debug.Print statements above the with-statement.
Debug.print Workbooks("InstData_TEMS_Existing.xlsx").name
Debug.print Workbooks("InstData_TEMS_Existing.xlsx").sheets("L").name

Then set a breakpoint to the beginning of the code (F9) and step thru the code (F8). Tf your range is large, maybe set another breakpoint on the rng.Copy statement and let it run (F5). Watch where exactly the runtime error happens.


text:
Q: Close title window from its child component flex I am implementing a title window, which is calling from the main appication like this
protected function sampleButton_clickHandler(event:MouseEvent):void
            {
                var ttlWndw:SampleTitleWindow = PopUpManager.createPopUp(FlexGlobals.topLevelApplication as DisplayObject, SampleTitleWindow, true) as SampleTitleWindow;
                PopUpManager.centerPopUp(ttlWndw);
            }

the title window will be this
<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               xmlns:local="*"
               width="288" height="230">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <local:SampleVBox id="sampleVBox" x="108" y="83"/>
</s:TitleWindow>

in the title window i had another child component called sample vbox and this component looks like this
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/mx">

    <fx:Script>
        <![CDATA[
            protected function closeBtn_clickHandler(event:MouseEvent):void
            {

            }
        ]]>
    </fx:Script>

    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:Button id="closeBtn" label="Close" click="closeBtn_clickHandler(event)"/>
</mx:VBox>

My question is, I want to close the title window using the button in the sampleVBox component. please someone help me in this.
Thanks in advance!

A: One solution is to dispatch an event from the SampleVBox component that the parent TitleWindow will listen to. To do this, add some metadata to your SampleVBox class that indicates the class dispatches such an event:
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/mx">

    <fx:Metadata>
        [Event(name="close", type="flash.events.Event")]
    </fx:Metadata>

    <fx:Script>
        <![CDATA[
            protected function closeBtn_clickHandler(event:MouseEvent):void
            {
                dispatchEvent(new Event(Event.CLOSE));
            }
        ]]>
    </fx:Script>

    <s:Button id="closeBtn" label="Close" click="closeBtn_clickHandler(event)"/>
</mx:VBox>

Now, that the SampleVBox declares that it dispatches a "close" event, you can listen for it in the TitleWindow:
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               xmlns:local="*"
               width="288" height="230">

    <fx:Script>
        <![CDATA[
            protected function onSampleBoxClose():void
            {
                PopUpManager.removePopUp(this);
            }
        ]]>
    </fx:Script>

    <local:SampleVBox id="sampleVBox" x="108" y="83" close="onSampleBoxClose()"/>
</s:TitleWindow>


text:
Q: timeout error with usocket on common lisp I'm having trouble with cl-smtp:send-email which seems to stem from a timeout error when calling usocket:socket-connect.
Here is what I am trying to do:
(cl-smtp:send-email "outgoing.mit.edu" "m_klein@mit.edu"
                    (list "m_klein@mit.edu") "s1" "m1")

This seems to be the call where the failure occurs (according to the backtrace):
(usocket:socket-connect "outgoing.mit.edu" 25
                        :protocol :stream
                        :element-type '(unsigned-byte 8)
                        :timeout nil
                        :deadline nil
                        :nodelay nil
                        :local-host nil
                        :local-port nil)

Here is the error:

Error: Error #<USOCKET:TIMEOUT-ERROR #x302001E5FDED>
While executing: USOCKET::RAISE-ERROR-FROM-ID, in process Listener(475).

The odd thing is that the same function call has worked on other machines, but not on my current mac laptop or the cloud-based mac I've also been using.
I am running Clozure Common Lisp 1.11.1 on a MacBook Pro on OS 10.13.3
Here are snapshots of the backtrace FYI: https://imgur.com/a/e2xcf
Any ideas? Any help would be greatly appreciated.

A: Since you are using an external server, first you need to check, correctness of the address (connect using telnet), port and maybe you need an authentication.
Since you are using cl-smtp, first I recommend you to test how it works, for that the easy way of testing smptp is using mailcatcher inside a docker container:
docker run -d -p 1080:1080 -p 1025:1025 --name mailcatcher schickling/mailcatcher

docker ps | grep mailcatcher
6fb056fceb6b        schickling/mailcatcher   "mailcatcher -f --ip…"   9 months ago        Up 18 minutes       0.0.0.0:1025->1025/tcp, 0.0.0.0:1080->1080/tcp   mailcatcher

Then you can access to the ourtgoing mail in a web browser localhost:1080, and send mail to localhost:1025
For testing the SMTP, server I recommend to use telnet:
telnet
telnet> o localhost 1025
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 EventMachine SMTP Server
EHLO localhost
250-Ok EventMachine SMTP Server
250-NO-SOLICITING
250 SIZE 20000000

there is a great article on that here
When you are sure that, you get the requirements try with lisp:
CL-USER> (cl-smtp:send-email "127.0.0.1" "antonio.querol@example.com" "pedro.lopez@example.com" "Say Hello" "Hello World"
                    :port 1025)
("Ok")


text:
Q: How to take out 'contact' values from a 'Many2one' field in Odoo? Any Many2one field which is either linked to hr.employee or res.users shows values Home addresses or contacts in the Many2one drop down tool. Anyone has a suggestion on how to stop this ?

A: You can use domain filter to avoid unwanted results.
For Eg:- In sale order we only see customers although its related object is res.patner, Its because of domain filter( please see the code )
                            <field name="partner_id" on_change="onchange_partner_id(partner_id, context)" domain="[('customer','=',True)]" context="{'search_default_customer':1, 'show_address': 1}" options='{"always_reload": True}'/>

Here domain filter is " domain="[('customer','=',True)]" "
ie. records with only customer field is True is shown
From your comments:- If you want to see system users only then user res.users instead of res.partner. Like:-
        'user_id' : fields.many2one('res.users', 'User')

Hope this helps.


text:
Q: A strange case in datetime I have this table WorkTBL
id  MyDate      Tdate
84  27/04/2018  2018-04-27 13:35:09.000
85  27/04/2018  2018-04-27 13:35:09.000
86  27/04/2018  2018-04-27 13:35:09.000
88  27/04/2018  2018-04-27 13:36:06.000
89  27/04/2018  2018-04-27 13:36:06.000
90  27/04/2018  2018-04-27 13:36:06.000
91  27/04/2018  2018-04-27 13:36:06.000
92  27/04/2018  2018-04-27 13:40:00.000
93  27/04/2018  2018-04-27 13:40:00.000
95  02/05/2018  2018-05-02 16:03:22.000
96  02/05/2018  2018-05-02 16:03:22.000
98  02/05/2018  2018-05-02 16:04:35.000
102 04/05/2018  2018-05-04 22:57:42.000
103 04/05/2018  2018-05-04 22:57:42.000
104 04/05/2018  2018-05-04 22:57:42.000

I try to look for records between 01/03/2018 and 03/05/2018
I try this:
select id, CONVERT(VARCHAR(10),Tdate,103), Tdate
from WorkTBL
where (CONVERT(VARCHAR(10),Tdate,103) >= '01/03/2018' and  CONVERT(VARCHAR(10),Tdate,103)  <= '03/05/2018')

and this:
select id, CONVERT(VARCHAR(10),Tdate,103), Tdate
from WorkTBL
where (CONVERT(VARCHAR(24),Tdate,103) between '01/03/2018' and  '03/05/2018')  order by id desc

But I get only these records:
95  02/05/2018  2018-05-02 16:03:22.000
96  02/05/2018  2018-05-02 16:03:22.000
98  02/05/2018  2018-05-02 16:04:35.000

Where is the rest? Why I do not get 88 27/04/2018  2018-04-27 13:36:06.000 for example?
Thanks

A: Don't convert date/times to strings for comparison!
Go for:
select id, CONVERT(VARCHAR(10), Tdate,1 03), Tdate
from WorkTBL
where Tdate >= '2018-01-03' and
      Tdate < '2018-05-04'

First, your comparisons are strings.  Strings are compared alphabetically, which explains your results.
Second, don't use between with dates and times.  Aaron Bertrand  has a very good blog on this subject.
Third, I removed the conversion to a date.  In general, the use of functions or conversions on a column prevents the use of indexes.  One of the very few exceptions is converting a datetime to a date.  However, the code is still simpler and cleaner without the conversion.

A: Use always ANSI SQL Standard date format YYYYMMDD
select id, CONVERT(VARCHAR(10),Tdate,103) Tdate
from WorkTBL
where cast(Tdate as date) >= '20180103' and
      cast(Tdate as date) <= '20180503'
order by id desc;

A: Right answer already accepted, but, to understand your problematic clearly, please use this:
select
     [id]       =   [id]
    ,[MyDate]   =   convert(datetime, [MyDate], 103)
    ,[Tdate]    =   convert(datetime, [Tdate], 121)
from
    [#WorkTBL]
where
        convert(datetime, [Tdate], 121) >  convert(datetime, '01/03/2018', 103)
    and convert(datetime, [Tdate], 121) <  convert(datetime, '03/05/2018', 103);

Full testing query: https://pastebin.com/Csk1nHsC


text:
Q: F# in Visual Studio Code type incorrect I'm writing a function to handle postfix evaluation in F#. This is what I currently have for the evaluation function
//Postfix evaluation of string expr given variables bound to values as specified in vars
    let (numSt:int list) = []
    let rec innerEval (vars:(List<(string * int)>)) (stack: int list) (expr:string) =
    //Head and Tail for stack, head and tail for expr
        let chExpr = Seq.toList expr
        match expr with
        |[] -> stack.Head
        |head::tail ->
            if head = '+' then
                let pushVal = stack.Head + stack.Tail.Head
                let newStack = pushVal::stack.Tail
                innerEval vars newStack tail
            elif head = '-' then
                let pushVal = stack.Head - stack.Tail.Head
                let newStack = pushVal::stack.Tail
                innerEval vars newStack tail
            elif head = '/' then
                let pushVal = stack.Head / stack.Tail.Head
                let newStack = pushVal::stack.Tail
                innerEval vars newStack tail
            elif head = '*' then
                let pushVal = stack.Head * stack.Tail.Head
                let newStack = pushVal::stack.Tail
                innerEval vars newStack tail
            elif head = '$' then
                let fstSt = stack.Head
                let sndSt = stack.Tail.Head
                let nhead = [fstSt; sndSt]
                let st =  nhead @ stack.Tail.Tail
                innerEval vars st tail
            elif head = '@' then
                let nhead = tail.Head
                let newVars = newVarList nhead vars stack.Head //helper function newVarList
                innerEval newVars stack.Tail tail

             //else it's a letter that needs to give back a number

            else
                let addNum = (getVal head vars) //get the number
                let newStack = addNum::stack //push that onto stack
                innerEval vars newStack expr //return to recursion on newStack

which I know is wordy, but when I try to run this code, I get an error in Code that reads
pa4.fs(1194,38): error FS0001: This expression was expected to have type
    'string'
but here has type
    'char'

So my question isn't about the code itself necessarily (unless someone can see what's wrong with it) but about the error message: obviously it means I have an element with an incorrect type, but what does the (1194, 38) mean? I'm assuming line 38, but the larger number increases each time I run the code and I'm not sure what it means?
Sorry if this is noob question, was given this task with little to no direction!

A: One of your functions is hoping to get a "string" (many characters I like to think of the party letters being held by a string)  but is instead getting a 'c' 'h' 'a' ,'r' (single character). I'm suspecting newvarlist because innereval looks okay? It's hard to say without looking at the functions, however you should be able to hover over them with your mouse. Both visual studio and visual studio code with the ionide extension support this. You would even get the red squiggles over the lines of code that don't work. Let me know if that was helpful!

A: F#'s T list is an immutable singly-linked list of type T, and that's not interchangeable with string which is its own primitive type. However, string implicitly is seq<char>, which is why you can use functions like Seq.toList expr.
So it follows that you won't be able to match using the list pattern.
let rec innerEval (vars:(List<(string * int)>)) (stack: int list) (expr:string) =
    match expr with //won't compile because expr isn't list
    | [] -> stack.Head
    | head::tail ->
         innerEval vars newStack tail //won't compile because tail is char list

An easier solution would be to change the signature of innerEval (expr: string) to innerEval (expr: char list), so conversions are simplified.


text:
Q: npm lzf module installation failure I was trying to get the lzf module for my project, then an error occurred during the installation. Just as other people would have done I googled about the question, but couldn't find the right solution for my situation.
lzf@0.3.0 install /home/grewvr/node_modules/lzf
node-gyp rebuild

/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/node-    gyp/lib/configure.js:354:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.4.0-45-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/grewvr/node_modules/lzf
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN moskit@1.0.0 No repository field.
npm ERR! Linux 4.4.0-45-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--save" "lzf"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! lzf@0.3.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lzf@0.3.0 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the lzf package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs lzf
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls lzf
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/grewvr/npm-debug.log

Been trying to fix the problem for two days, please help me.


text:
Q: Integrity assurance of smart contract call by Web3js library I have a necessity where I want to verify the authenticity and integrity of the data that is returned by the Web3js library methods.mymethod().call() from the smart contract. Something we do in the client-server communication model, the authenticity and integrity of the message/data the client receive could be validated with the Rest API response (Header, Body, signature). Could the same be done on the response we receive from the web3js library?

A:
I have a necessity where I want to verify the authenticity and integrity

The question does not discuss why you want to do this and does not make any sense and feels xy problem.
However here is a solution

*

*Run your own Ethereum node.

*Ethereum node is guaranteed to have have a valid state, by Etherum block validation rules

*Because you are running your own node, the JSON-RPC replies do not lie to yourself. Unless you are mad and then this is called Mad General Problem.


text:
Q: Ruby on Rails installation on Windows via Proxy click here for screenshot i try but can do this ...
how to set proxy , really i don't know
also see stack overflow and other forums...
here links:
Issue installing gems on windows 7 with proxy
but can not get it how to set variable , which proxy give(ip..browser or other) and how set port ,
plz can anyone simple way explain how to solve...
Thanks in advance...!!!
ERROR:  While executing gem ... (URI::InvalidURIError)
    bad URI(is not URI?): http://http_proxy = username:password@proxyserver:port


text:
Q: C call function type error I'm trying to compile this code which call func from "libcfmapi.so" to decrypt "cfg" file
#include <stdlib.h>
#include <stdio.h>
int restorebackup(const char *tmp_cfg_name,const char *xml_cfg_name);
int ATP_CFM_ExtCustomImportEncryptedUserCfgFile(const char *tmp_cfg_name);
int main(int argc, char **argv)
{
int ret;
if(argc < 3)
{
printf("specify temp config file name.\n");
exit(1);
}
ret=restorebackup(argv[1],argv[2]);
return ret;
}
int restorebackup(const char *tmp_cfg_name,const char *xml_cfg_name)
{
int ret=0;
//ret = ATP_CFM_ExtDigVerifyFile(tmp_cfg_name,tmp_cfg_name);
if(ret != 0)
{
printf("Verify File failed.\n");
return ret;
}
ret = ATP_CFM_ExtCustomImportEncryptedUserCfgFile(tmp_cfg_name);
return ret;
}

but got error regarding func type declare
root@kali:~/debian-qemu# gcc  h.c   -o demo
    /tmp/ccVbt5NT.o: In function `restorebackup':
    h.c:(.text+0x8c): undefined reference to `ATP_CFM_ExtCustomImportEncryptedUserCfgFile'
    collect2: error: ld returned 1 exit status

any help appreciated

A: The reason you're getting this error is because you're not linking against the required library, libcfmapi.so.
This is not a library you would expect to find in your Debian system as it is unique to the BT device you're trying to hack.
In short - get the lib from your device, cross compile to the device architecture against the lib you extracted from the device and you should be fine.

A: More information based on Ishay Peled answer:
readelf -s <pulled library> | grep ATP_CFM_ExtCustomImportEncryptedUserCfgFile

I suspect the problem isn't that function you call doesn't exist but rather there are no functions being displayed it is most likely empty just like nm result:

nm: libcfmapi.so: no symbols

do the command without piping to grep, my bet is your output is:
readelf -s libcfmapi.so

Dynamic symbol information is not available for displaying symbols.

If someone knows the way of getting the headers from the file, i believe then you can find your function you require then link and run (i too am trying to use libcfmapi.so, but lack the programming/reversing knowledge required).

A: when using a library, then must:

*

*include that library in the link statement via
-l cfmapi

*include the header file for that library in the source code:
#include <cfmapi.h>


text:
Q: How to remove or filter non-english (chinese, korean, japanese, arabic) strings in list? Here is an input example:
['ARTA Travel Group', 'Arta | آرتا', 'ARTAS™ Practice Development',    'ArtBinder', 'Arte Arac Takip App', 'アート建築', 'Arte Brasil Bar &    Grill', 'ArtPod Stage', 'Artpollo扫码', 'Artpollo阿波罗-价值最优的艺术品投资电商',    '아트홀']

Like above list, I want to remove elements with CHINESE, KOREAN, JAPANESE, ARBIC.
And below is the expected output (english only):
['ARTA Travel Group', 'ARTAS™ Practice Development', 'ArtBinder', 'Arte Arac Takip App', 'Arte Brasil Bar & Grill', 'ArtPod Stage']

A: Sorry, I can't comment on this post due to the reputation lock but here.
That question is answered here Detect strings with non English characters in Python
Hope this helps!

A: You can use regex and search with unicode range. ™ belongs to Letterlike Symbols which ranges from 2100—214F; you can either include them all or just pick the specific ones.
import re

s = ['ARTA Travel Group', 'Arta | آرتا', 'ARTAS™ Practice Development', 'ArtBinder', 'Arte Arac Takip App', 'アート建築', 'Arte Brasil Bar & Grill', 'ArtPod Stage', 'Artpollo扫码', 'Artpollo阿波罗-价值最优的艺术品投资电商', '아트홀']

result = [i for i in s if not re.findall("[^\u0000-\u05C0\u2100-\u214F]+",i)]

print (result)

['ARTA Travel Group', 'ARTAS™ Practice Development', 'ArtBinder', 'Arte Arac Takip App', 'Arte Brasil Bar & Grill', 'ArtPod Stage']

A: You can remove non-english strings in the list using the function isascii which was introduced in python 3.7. So the minimum requirement to use this function is that you must have the python version >= python 3.7.
 def isEnglish(s):

  return s.isascii()

print(isEnglish("Test"))

print(isEnglish("['ARTA Travel Group', 'Arta | آرتا', 'ARTAS™ Practice Development',    'ArtBinder', 'Arte Arac Takip App', 'アート建築', 'Arte Brasil Bar &    Grill', 'ArtPod Stage', 'Artpollo扫码', 'Artpollo阿波罗-价值最优的艺术品投资电商',    '아트홀']"))

Output:
  ['ARTA Travel Group', 'ARTAS™ Practice Development', 'ArtBinder', 'Arte Arac Takip App', 'Arte Brasil Bar & Grill', 'ArtPod Stage']

A: use regular expression. Put the chars need to the regular expression
c = ["ab cde", "test", "张三"]
b = filter(lambda x: re.search("[a-zA-Z\s]+",x) is not None, c)

just give an idea to you.


text:
Q: Change the image of a JSF commandbutton with DHTML event onmouseover I want to change the image of my button when the mouse goes over it.
I rode the DHTML event onmouseover, can do that for me, but how?
Do i need to create a javascript also for it?
What should i do to make it work?
This is my current code:
<h:commandButton class="btn" image="/resources/images/mainbtn1.png" onmouseover="/resources/images/mainbtn2.png"/">

A: The <h:commandButton image="foo.png"> generates a HTML <input type="image" src="foo.png">. The onmouseover attribute (like as all on* attributes) should point to JavaScript functions. However, you're putting the image path plain there. This would only result in a JavaScript error (which you would have noticed if you were using Firebug or WDT).
You need to write some JS which changes the src attribute of the image button accordingly:
onmouseover="this.src='/resources/images/mainbtn2.png'"

Don't forget to add an onmouseout which changes the image back.

Unrelated to the concrete problem, the normal practice is to use CSS background images for this. The HTML <input type="image"> has technically an entirely different purpose. It represents namely an image map which allows you to send the mouse coordinates of where you have clicked in the image map. You're apparently not interested in this information as you're not using a static image.
E.g.
<h:commandButton value="" styleClass="mybutton" />

which generates
<input type="submit" value="" class="mybutton" />

and add this CSS (kickoff example)
.mybutton {
    margin: 2px;
    padding: 0;
    border: 0;
    width: 100px;
    height: 20px;
    background-image: url('foo.png');
    cursor: pointer;
    overflow: visible;
}

.mybutton:hover {
    background-image: url('bar.png');
}

This is not only better reuseable/maintainable, but also doesn't require JS support.

A: Yes, all onXXX attributes are for JavaScript event handlers. You need to have a JavaScript function written for that. Something like this:
function changeImage() {
    this.style.backgroundImage = "url('path/to/image.png')";
}

And invoked using:
<h:commandButton class="btn" image="/resources/images/mainbtn1.png" onmouseover="changeImage()" />

Note: I can't provide you the exact JavaScript as it entirely depends on how the markup is generated by the JSF library that you're using.