问:
Spring form login, multiple roles with form issue
Ok so I have my login page on localhost/login there I have two forms with the same action which is /login (for now). I am trying to accomplish this scenario:

User is on the login page, he is offered a choice between two forms 1. offers a form which will redirect him to /employees/home 2. offers form for /administrator/home. Keep in mind that user that has ADMIN role can log to the /employees/home as well

The application has two roles ADMIN and EMP.

I want the web app to be able to grant authority correctly for each user and redirect him where it is needed. I am able to do this with a single role but as soon as i put in another one, the app starts to lose it. This is my code:

```<code>@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;

@Autowired
private DataSource dataSource;

@Value("${spring.queries.users-query}")
private String usersQuery;

@Value("${spring.queries.roles-query}")
private String rolesQuery;

@Override
protected void configure(AuthenticationManagerBuilder auth)
        throws Exception {
    auth.
        jdbcAuthentication()
            .usersByUsernameQuery(usersQuery)
            .authoritiesByUsernameQuery(rolesQuery)
            .dataSource(dataSource)
            .passwordEncoder(bCryptPasswordEncoder);
}

protected void configure(HttpSecurity http) throws Exception {
    http.
    authorizeRequests()
        .antMatchers("/").permitAll()
        .antMatchers("/login").permitAll()
        .antMatchers("/admin/**").hasAuthority("ADMIN").anyRequest()
        .authenticated().and().formLogin()
        .loginPage("/login/administrator").failureUrl("/login?error=true")
        .defaultSuccessUrl("/admin/home")
        .usernameParameter("email")
        .passwordParameter("password")
        .and().logout()
        .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
        .logoutSuccessUrl("/").and().exceptionHandling()
        .accessDeniedPage("/access-denied")
        .and()
        .authorizeRequests()
        .antMatchers("/employee/**").hasAuthority("EMP")
        .anyRequest().authenticated().and().formLogin()
        .loginPage("/login").failureUrl("/login?error=true")
        .defaultSuccessUrl("/employee/home")
        .usernameParameter("email")
        .passwordParameter("password")
        .and().logout()
        .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
        .logoutSuccessUrl("/").and().exceptionHandling()
        .accessDeniedPage("/access-denied")
        ;
/*  http.
    authorizeRequests()
        .antMatchers("/").permitAll()
        .antMatchers("/login").permitAll()
        .antMatchers("/admin/**").hasAuthority("ADMIN").anyRequest()
        .authenticated().and().csrf().disable().formLogin()
        .loginPage("/login").failureUrl("/login?error=true")
        .defaultSuccessUrl("/admin/home")
        .usernameParameter("email")
        .passwordParameter("password")
        .and().logout()
        .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
        .logoutSuccessUrl("/").and().exceptionHandling()
        .accessDeniedPage("/access-denied");*/
}

@Override
public void configure(WebSecurity web) throws Exception {
    web
       .ignoring()
       .antMatchers("/resources/**", "/static/**", "/css/**", "/js/**", "/images/**");
}
</code>```

Queries

```<code>spring.queries.users-query=select email, password, active from user where email=?
spring.queries.roles-query=select u.email, r.role from user u inner join user_role ur on(u.user_id=ur.user_id) inner join role r on(ur.role_id=r.role_id) where u.email=?
</code>```

Main login controller

```<code>@Controller
public class LoginController {

    @RequestMapping(value={"/","/login"}, method = RequestMethod.GET)
    public ModelAndView login(){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("login");
        return modelAndView;
    }
</code>```

Repositories and services work, they are tested with a single role. I figure that it is the issue with SecurityConfiguration class. NOTE*I have tried making several configuration classes with different orders, that did not work as well.

Any help would be much appreciated!! Thanks!

答:
After some digging around managed to resolve the issue as Sankar stated with custom success handler class.

```<code>public class CustomSuccessHandler
  implements AuthenticationSuccessHandler {
....
protected String determineTargetUrl(Authentication authentication) {
        boolean isEmp= false;
        boolean isAdmin = false;
        Collection<? extends GrantedAuthority> authorities
         = authentication.getAuthorities();
        for (GrantedAuthority grantedAuthority : authorities) {
            if (grantedAuthority.getAuthority().equals("EMPLOYEE")) {
                isUser = true;
                break;
            } else if (grantedAuthority.getAuthority().equals("ADMIN")) {
                isAdmin = true;
                break;
            }
        }

        if (isEmp) {
            return "/employee/home";
        } else if (isAdmin) {
            return "/admin/home";
        } else {
            throw new IllegalStateException();
        }
    }
....
}
</code>```

But at the end, decided to scrap the logic and switch to a single log in form which leads to landing page from where the user can choose where to go.

```<code>protected void configure(HttpSecurity http) throws Exception {

        http.
        authorizeRequests()
            .antMatchers("/").permitAll()
            .antMatchers("/rest/**").permitAll()
            .antMatchers("/login").permitAll()
            .antMatchers("/landing").hasAnyAuthority("ADMIN","EMPLOYEE")
            .antMatchers("/admin/**").hasAuthority("ADMIN")
            .antMatchers("/employee/**").hasAuthority("EMPLOYEE")
            .anyRequest()
            .authenticated().and()
            .formLogin()
            .loginPage("/login").failureUrl("/login?error=true")
            .defaultSuccessUrl("/landing")
            .usernameParameter("email")
            .passwordParameter("password")
            .and().logout()
            .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
            .logoutSuccessUrl("/login").and().exceptionHandling()
            .accessDeniedPage("/access-denied");

    }
</code>```

based on the user's role links to the /employee/home or /admin/home are disabled, or not.

Body:
Ok so I have my login page on localhost/login there I have two forms with the same action which is /login (for now). I am trying to accomplish this scenario:

User is on the login page, he is offered a choice between two forms 1. offers a form which will redirect him to /employees/home 2. offers form for /administrator/home. Keep in mind that user that has ADMIN role can log to the /employees/home as well

The application has two roles ADMIN and EMP.

I want the web app to be able to grant authority correctly for each user and redirect him where it is needed. I am able to do this with a single role but as soon as i put in another one, the app starts to lose it. This is my code:

@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;

@Autowired
private DataSource dataSource;

@Value("${spring.queries.users-query}")
private String usersQuery;

@Value("${spring.queries.roles-query}")
private String rolesQuery;

@Override
protected void configure(AuthenticationManagerBuilder auth)
        throws Exception {
    auth.
        jdbcAuthentication()
            .usersByUsernameQuery(usersQuery)
            .authoritiesByUsernameQuery(rolesQuery)
            .dataSource(dataSource)
            .passwordEncoder(bCryptPasswordEncoder);
}

protected void configure(HttpSecurity http) throws Exception {
    http.
    authorizeRequests()
        .antMatchers("/").permitAll()
        .antMatchers("/login").permitAll()
        .antMatchers("/admin/**").hasAuthority("ADMIN").anyRequest()
        .authenticated().and().formLogin()
        .loginPage("/login/administrator").failureUrl("/login?error=true")
        .defaultSuccessUrl("/admin/home")
        .usernameParameter("email")
        .passwordParameter("password")
        .and().logout()
        .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
        .logoutSuccessUrl("/").and().exceptionHandling()
        .accessDeniedPage("/access-denied")
        .and()
        .authorizeRequests()
        .antMatchers("/employee/**").hasAuthority("EMP")
        .anyRequest().authenticated().and().formLogin()
        .loginPage("/login").failureUrl("/login?error=true")
        .defaultSuccessUrl("/employee/home")
        .usernameParameter("email")
        .passwordParameter("password")
        .and().logout()
        .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
        .logoutSuccessUrl("/").and().exceptionHandling()
        .accessDeniedPage("/access-denied")
        ;
/*  http.
    authorizeRequests()
        .antMatchers("/").permitAll()
        .antMatchers("/login").permitAll()
        .antMatchers("/admin/**").hasAuthority("ADMIN").anyRequest()
        .authenticated().and().csrf().disable().formLogin()
        .loginPage("/login").failureUrl("/login?error=true")
        .defaultSuccessUrl("/admin/home")
        .usernameParameter("email")
        .passwordParameter("password")
        .and().logout()
        .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
        .logoutSuccessUrl("/").and().exceptionHandling()
        .accessDeniedPage("/access-denied");*/
}

@Override
public void configure(WebSecurity web) throws Exception {
    web
       .ignoring()
       .antMatchers("/resources/**", "/static/**", "/css/**", "/js/**", "/images/**");
}

Queries

spring.queries.users-query=select email, password, active from user where email=?
spring.queries.roles-query=select u.email, r.role from user u inner join user_role ur on(u.user_id=ur.user_id) inner join role r on(ur.role_id=r.role_id) where u.email=?

Main login controller

@Controller
public class LoginController {

    @RequestMapping(value={"/","/login"}, method = RequestMethod.GET)
    public ModelAndView login(){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("login");
        return modelAndView;
    }

Repositories and services work, they are tested with a single role. I figure that it is the issue with SecurityConfiguration class. NOTE*I have tried making several configuration classes with different orders, that did not work as well.

Any help would be much appreciated!! Thanks!

Body:
After some digging around managed to resolve the issue as Sankar stated with custom success handler class.

public class CustomSuccessHandler
  implements AuthenticationSuccessHandler {
....
protected String determineTargetUrl(Authentication authentication) {
        boolean isEmp= false;
        boolean isAdmin = false;
        Collection<? extends GrantedAuthority> authorities
         = authentication.getAuthorities();
        for (GrantedAuthority grantedAuthority : authorities) {
            if (grantedAuthority.getAuthority().equals("EMPLOYEE")) {
                isUser = true;
                break;
            } else if (grantedAuthority.getAuthority().equals("ADMIN")) {
                isAdmin = true;
                break;
            }
        }

        if (isEmp) {
            return "/employee/home";
        } else if (isAdmin) {
            return "/admin/home";
        } else {
            throw new IllegalStateException();
        }
    }
....
}

But at the end, decided to scrap the logic and switch to a single log in form which leads to landing page from where the user can choose where to go.

protected void configure(HttpSecurity http) throws Exception {

        http.
        authorizeRequests()
            .antMatchers("/").permitAll()
            .antMatchers("/rest/**").permitAll()
            .antMatchers("/login").permitAll()
            .antMatchers("/landing").hasAnyAuthority("ADMIN","EMPLOYEE")
            .antMatchers("/admin/**").hasAuthority("ADMIN")
            .antMatchers("/employee/**").hasAuthority("EMPLOYEE")
            .anyRequest()
            .authenticated().and()
            .formLogin()
            .loginPage("/login").failureUrl("/login?error=true")
            .defaultSuccessUrl("/landing")
            .usernameParameter("email")
            .passwordParameter("password")
            .and().logout()
            .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
            .logoutSuccessUrl("/login").and().exceptionHandling()
            .accessDeniedPage("/access-denied");

    }

based on the user's role links to the /employee/home or /admin/home are disabled, or not.


来源: stackexchange

问:
Removing data outside country map boundary in R
I know this is simple but couldn't get this working. I want to remove the excess data points on the map below. How do i do it?
Below code gave me the results.

```<code>ggplot() +
geom_polygon(data = rwa2, aes(x = long, y = lat, group= group),
             colour = "black", size = 0.5, fill = "white") +
geom_tile(data = df, aes(x = Lon, y = Lat, z = z, fill = z), alpha = 0.8) +
ggtitle("State Data") +
xlab("Longitude") +
ylab("Latitude") +
scale_fill_distiller(type = "div", palette = "Spectral")+
theme_bw() +
theme(plot.title = element_text(size = 25, face = "bold"),
      legend.title = element_text(size = 15),
      axis.text = element_text(size = 15),
      axis.title.x = element_text(size = 20, vjust = -0.5),
      axis.title.y = element_text(size = 20, vjust = 0.2),
      legend.text = element_text(size = 10)) +
coord_map()
</code>```

I want to remove all data that are outside the state boundary.
Boundary coordinates are obtained from a Rdata file using readRDS, with ID_2 for states and ID_3 for districts so are the names. Guide me here, please.

答:
Since we do not have your data, it is hard to work on your case. But, I'd like to leave a method for you. As long as I can see from your code, you have a data frame called df. You want to create a temporary SpatialPointsDataFrame. Let's call it spdf. You also have polygon data called rwa2, which is also a data frame. If rwa2 comes from a spatial class object (i.e., SpatialPolygonsDataFrame), you want to use it to subset data points staying within the polygons. Let's imagine you have the spatial object called sp.rwa2.

```<code>library(sp)
library(ggplot2)
</code>```

Step1 : Create a SpatialPointsDataFrame using df
Make sure that you assign proj4string of sp.rwa2 to spdf. I just have a sample proj4string in this code.

```<code>spdf <- SpatialPointsDataFrame(coords = df[, c("Lon", "Lat")], data = df,
                               proj4string = CRS("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"))
</code>```

Step 2: Subset data points that are staying within sf.rwa2.

```<code>whatever <- spdf[!is.na(over(spdf, as(sp.rwa2, "SpatialPolygons"))), ]
</code>```

Step 3: Convert spdf to a data frame

```<code>whatever <- as.data.frame(whatever)
</code>```

Then, you would run your code for ggplot. rwa2 is a data frame.

```<code>ggplot() +
geom_polygon(data = rwa2, aes(x = long, y = lat, group = group),
             colour = "black", size = 0.5, fill = "white") +
geom_tile(data = whatever, aes(x = Lon, y = Lat, fill = z), alpha = 0.8) +
labs(title = "State Data", x = "Longitude", y = "Latitude") +
scale_fill_distiller(type = "div", palette = "Spectral") +
theme_bw() +
theme(plot.title = element_text(size = 25, face = "bold"),
      legend.title = element_text(size = 15),
      axis.text = element_text(size = 15),
      axis.title.x = element_text(size = 20, vjust = -0.5),
      axis.title.y = element_text(size = 20, vjust = 0.2),
      legend.text = element_text(size = 10)) +
coord_map()
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I know this is simple but couldn't get this working. I want to remove the excess data points on the map below. How do i do it?
Below code gave me the results.

ggplot() +
geom_polygon(data = rwa2, aes(x = long, y = lat, group= group),
             colour = "black", size = 0.5, fill = "white") +
geom_tile(data = df, aes(x = Lon, y = Lat, z = z, fill = z), alpha = 0.8) +
ggtitle("State Data") +
xlab("Longitude") +
ylab("Latitude") +
scale_fill_distiller(type = "div", palette = "Spectral")+
theme_bw() +
theme(plot.title = element_text(size = 25, face = "bold"),
      legend.title = element_text(size = 15),
      axis.text = element_text(size = 15),
      axis.title.x = element_text(size = 20, vjust = -0.5),
      axis.title.y = element_text(size = 20, vjust = 0.2),
      legend.text = element_text(size = 10)) +
coord_map()

I want to remove all data that are outside the state boundary.
Boundary coordinates are obtained from a Rdata file using readRDS, with ID_2 for states and ID_3 for districts so are the names. Guide me here, please.

Body:
Since we do not have your data, it is hard to work on your case. But, I'd like to leave a method for you. As long as I can see from your code, you have a data frame called df. You want to create a temporary SpatialPointsDataFrame. Let's call it spdf. You also have polygon data called rwa2, which is also a data frame. If rwa2 comes from a spatial class object (i.e., SpatialPolygonsDataFrame), you want to use it to subset data points staying within the polygons. Let's imagine you have the spatial object called sp.rwa2.

library(sp)
library(ggplot2)

Step1 : Create a SpatialPointsDataFrame using df
Make sure that you assign proj4string of sp.rwa2 to spdf. I just have a sample proj4string in this code.

spdf <- SpatialPointsDataFrame(coords = df[, c("Lon", "Lat")], data = df,
                               proj4string = CRS("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"))

Step 2: Subset data points that are staying within sf.rwa2.

whatever <- spdf[!is.na(over(spdf, as(sp.rwa2, "SpatialPolygons"))), ]

Step 3: Convert spdf to a data frame

whatever <- as.data.frame(whatever)

Then, you would run your code for ggplot. rwa2 is a data frame.

ggplot() +
geom_polygon(data = rwa2, aes(x = long, y = lat, group = group),
             colour = "black", size = 0.5, fill = "white") +
geom_tile(data = whatever, aes(x = Lon, y = Lat, fill = z), alpha = 0.8) +
labs(title = "State Data", x = "Longitude", y = "Latitude") +
scale_fill_distiller(type = "div", palette = "Spectral") +
theme_bw() +
theme(plot.title = element_text(size = 25, face = "bold"),
      legend.title = element_text(size = 15),
      axis.text = element_text(size = 15),
      axis.title.x = element_text(size = 20, vjust = -0.5),
      axis.title.y = element_text(size = 20, vjust = 0.2),
      legend.text = element_text(size = 10)) +
coord_map()

ContentLicense: CC BY-SA 3.0


问:
Sql query on xml data
I have to get an information from a field where is there xml data only, like this ("Content" field):

i don't know how to use XQuery or other Xpath and i didn't find any beginner tutorial.
i find a Property Name (named "FormId" with a value which is the Id from an other table)in the xml which can be used for my web application i develop today.

How can i make a query so as to get this Id and use this on my ASP.Net application (SqlCommand).

I hope to be understood, because i'm a little frenchy who needs help on that technical issue :'(

The complete code here :

Example of a complete xml data

答:
It is a very bad design to place a fully blown XML as escaped text into an attribute's value... If this is under your control, you should change this!

Nevertheless this can be done:

First of all you have to read the Property "ObjectContent" and cast it to XML. In the next step you need to call CROSS APPL ... .nodes() as the needed value seems to be embedded multiple times.

```<code>DECLARE @x XML=N'Place on of your XMLs here':
WITH PropertyObjectContent(AsXml) AS
(
    SELECT CAST(@x.value(N'(/Root/StorageObject/Properties/Property[@Name="ObjectContent"]/@Value)[1]',N'nvarchar(max)') AS XML)
)
SELECT AllFormIds.val.value(N'@Value',N'uniqueidentifier') AS FormId
FROM PropertyObjectContent
CROSS APPLY PropertyObjectContent.AsXml.nodes(N'//Property[@Name="FormId"]') AS AllFormIds(val);
</code>```

If you need this for the whole table I hope you can modify this code to your acutal needs...

Title: Sql query on xml data

Body:
It is a very bad design to place a fully blown XML as escaped text into an attribute's value... If this is under your control, you should change this!

Nevertheless this can be done:

First of all you have to read the Property "ObjectContent" and cast it to XML. In the next step you need to call CROSS APPL ... .nodes() as the needed value seems to be embedded multiple times.

DECLARE @x XML=N'Place on of your XMLs here':
WITH PropertyObjectContent(AsXml) AS
(
    SELECT CAST(@x.value(N'(/Root/StorageObject/Properties/Property[@Name="ObjectContent"]/@Value)[1]',N'nvarchar(max)') AS XML)
)
SELECT AllFormIds.val.value(N'@Value',N'uniqueidentifier') AS FormId
FROM PropertyObjectContent
CROSS APPLY PropertyObjectContent.AsXml.nodes(N'//Property[@Name="FormId"]') AS AllFormIds(val);

If you need this for the whole table I hope you can modify this code to your acutal needs...


问:
Post request from AEM JCR event handler Servlet to Spring boot servlet
I have created a jcr Event handler Servlet by implementing EventListener interface.

```<code>@Component(immediate = true, metatype = true)
@Service(EventListener.class)
public class JcrEventListener implements EventListener
</code>```

in onEvent function i am just capturing the path which is modified. and sending to spring boot service with httppost request. exp. as given below:--

```<code>{
HttpClient httpClient = HttpClients.createDefault();
String url = devJboss + "brandcenter/deleteEventService";
HttpPost httppost = new HttpPost(url);
httppost.setHeader("Content-type", "application/json");
JSONObject jsonObject = new JSONObject();
JSONArray jsonArr = new JSONArray();
jsonArr.put(path);
jsonObject.put("paths", jsonArr);
StringEntity entity = new StringEntity(jsonObject.toString());
httppost.setEntity(entity);
HttpResponse res = httpClient.execute(httppost);
int status = res.getStatusLine().getStatusCode();
}
</code>```

i am not saving any node. not using any repos as well.till HttpResponse res = httpClient.execute(httppost); is working perfectly fine but on the execute of httppost request i am getting following error:--

```<code>POST /brandcenter/deleteEventService HTTP/1.1] org.apache.sling.servlets.post.impl.operations.ModifyOperation Exception during response processing.
org.apache.sling.api.resource.PersistenceException: Unable to commit changes to session.
    at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.commit(JcrResourceProvider.java:482)
    at org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider.commit(AuthenticatedResourceProvider.java:215)
    at org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.commit(ResourceResolverControl.java:411)
    at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.commit(ResourceResolverImpl.java:1262)
    at org.apache.sling.servlets.post.AbstractPostOperation.run(AbstractPostOperation.java:129)
    at org.apache.sling.servlets.post.impl.SlingPostServlet.doPost(SlingPostServlet.java:202)
    at org.apache.sling.api.servlets.SlingAllMethodsServlet.mayService(SlingAllMethodsServlet.java:149)
    at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:345)
    at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:376)
    at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:546)
    at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)
    at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:138)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.core.impl.WCMComponentFilter.filterRootInclude(WCMComponentFilter.java:362)
    at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:177)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:96)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:282)
    at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:49)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)
    at com.adobe.cq.social.ugcbase.security.impl.SaferSlingPostServlet.doFilter(SaferSlingPostServlet.java:126)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.dam.core.impl.assetlinkshare.AdhocAssetShareAuthHandler.doFilter(AdhocAssetShareAuthHandler.java:389)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.dam.core.impl.servlet.ActivityRecordHandler.doFilter(ActivityRecordHandler.java:155)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:73)
    at com.adobe.granite.requests.logging.impl.RequestLoggerImpl.doFilter(RequestLoggerImpl.java:114)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.granite.csrf.impl.CSRFFilter.doFilter(CSRFFilter.java:220)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.security.impl.ContentDispositionFilter.doFilter(ContentDispositionFilter.java:181)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.core.impl.AuthoringUIModeServiceImpl.doFilter(AuthoringUIModeServiceImpl.java:292)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.core.impl.warp.TimeWarpFilter.doFilter(TimeWarpFilter.java:106)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter.doFilter(RedirectFilter.java:248)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.att.core.filters.GtmCookieFilter.doFilter(GtmCookieFilter.java:156)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgressTrackerLogFilter.java:95)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.analytics.provisioning.impl.UserAuthenticationRequestFilter.doFilter(UserAuthenticationRequestFilter.java:119)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.cq.social.commons.cors.CORSAuthenticationFilter.doFilter(CORSAuthenticationFilter.java:91)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet.doFilter(FormsHandlingServlet.java:285)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.granite.optout.impl.OptOutFilter.doFilter(OptOutFilter.java:74)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.core.impl.WCMRequestFilter.doFilter(WCMRequestFilter.java:90)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.cq.mcm.campaign.servlets.CampaignCopyTracker.doFilter(CampaignCopyTracker.java:100)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.rewriter.impl.RewriterFilter.doFilter(RewriterFilter.java:83)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.granite.httpcache.impl.InnerCacheFilter.doFilter(InnerCacheFilter.java:77)
    at com.adobe.granite.httpcache.impl.InnerCacheFilter.doFilter(InnerCacheFilter.java:56)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:129)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.granite.rest.impl.servlet.ApiResourceFilter.doFilter(ApiResourceFilter.java:68)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter.doFilter(BackgroundServletStarterFilter.java:169)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.granite.resourceresolverhelper.impl.ResourceResolverHelperImpl.doFilter(ResourceResolverHelperImpl.java:84)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:73)
    at org.apache.sling.engine.impl.SlingRequestProcessorImpl.doProcessRequest(SlingRequestProcessorImpl.java:151)
    at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:216)
    at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:85)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:79)
    at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:89)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:290)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:129)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.sling.featureflags.impl.FeatureManager.doFilter(FeatureManager.java:116)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.sling.engine.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:75)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:124)
    at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:61)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)
Caused by: javax.jcr.AccessDeniedException: OakAccess0000: Access denied
    at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:231)
    at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:212)
    at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:670)
    at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:496)
    at org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.performVoid(SessionImpl.java:419)
    at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:274)
    at org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:416)
    at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.sling.jcr.base.SessionProxyHandler$SessionProxyInvocationHandler.invoke(SessionProxyHandler.java:116)
    at com.sun.proxy.$Proxy7.save(Unknown Source)
    at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.commit(JcrResourceProvider.java:480)
    ... 112 common frames omitted
Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: OakAccess0000: Access denied
    at org.apache.jackrabbit.oak.security.authorization.permission.PermissionValidator.checkPermissions(PermissionValidator.java:212)
    at org.apache.jackrabbit.oak.security.authorization.permission.PermissionValidator.childNodeAdded(PermissionValidator.java:150)
    at org.apache.jackrabbit.oak.security.authorization.permission.PermissionValidator.childNodeAdded(PermissionValidator.java:56)
    at org.apache.jackrabbit.oak.spi.commit.CompositeEditor.childNodeAdded(CompositeEditor.java:108)
    at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeAdded(EditorDiff.java:116)
    at org.apache.jackrabbit.oak.plugins.segment.MapRecord.compare(MapRecord.java:493)
    at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:583)
    at org.apache.jackrabbit.oak.spi.commit.EditorDiff.process(EditorDiff.java:52)
    at org.apache.jackrabbit.oak.spi.commit.EditorHook.processCommit(EditorHook.java:54)
    at org.apache.jackrabbit.oak.spi.commit.CompositeHook.processCommit(CompositeHook.java:61)
    at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore$Commit.prepare(SegmentNodeStore.java:496)
    at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore$Commit.optimisticMerge(SegmentNodeStore.java:519)
    at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore$Commit.execute(SegmentNodeStore.java:575)
    at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore.merge(SegmentNodeStore.java:238)
    at org.apache.jackrabbit.oak.spi.state.ProxyNodeStore.merge(ProxyNodeStore.java:43)
    at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:247)
    at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.commit(SessionDelegate.java:347)
    at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:494)
    ... 121 common frames omitted
</code>```

答:
POST /brandcenter/deleteEventService HTTP/1.1]

Your request is not going to spring boot app, somehow devJboss is blank so the request is going to AEM itself. It is invoking SlingPostServlet which is trying to save data into jcr and failing with access denied exception.

Body:
I have created a jcr Event handler Servlet by implementing EventListener interface.

@Component(immediate = true, metatype = true)
@Service(EventListener.class)
public class JcrEventListener implements EventListener

in onEvent function i am just capturing the path which is modified. and sending to spring boot service with httppost request. exp. as given below:--

{
HttpClient httpClient = HttpClients.createDefault();
String url = devJboss + "brandcenter/deleteEventService";
HttpPost httppost = new HttpPost(url);
httppost.setHeader("Content-type", "application/json");
JSONObject jsonObject = new JSONObject();
JSONArray jsonArr = new JSONArray();
jsonArr.put(path);
jsonObject.put("paths", jsonArr);
StringEntity entity = new StringEntity(jsonObject.toString());
httppost.setEntity(entity);
HttpResponse res = httpClient.execute(httppost);
int status = res.getStatusLine().getStatusCode();
}

i am not saving any node. not using any repos as well.till HttpResponse res = httpClient.execute(httppost); is working perfectly fine but on the execute of httppost request i am getting following error:--

POST /brandcenter/deleteEventService HTTP/1.1] org.apache.sling.servlets.post.impl.operations.ModifyOperation Exception during response processing.
org.apache.sling.api.resource.PersistenceException: Unable to commit changes to session.
    at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.commit(JcrResourceProvider.java:482)
    at org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider.commit(AuthenticatedResourceProvider.java:215)
    at org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.commit(ResourceResolverControl.java:411)
    at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.commit(ResourceResolverImpl.java:1262)
    at org.apache.sling.servlets.post.AbstractPostOperation.run(AbstractPostOperation.java:129)
    at org.apache.sling.servlets.post.impl.SlingPostServlet.doPost(SlingPostServlet.java:202)
    at org.apache.sling.api.servlets.SlingAllMethodsServlet.mayService(SlingAllMethodsServlet.java:149)
    at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:345)
    at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:376)
    at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:546)
    at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)
    at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:138)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.core.impl.WCMComponentFilter.filterRootInclude(WCMComponentFilter.java:362)
    at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:177)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:96)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:282)
    at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:49)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)
    at com.adobe.cq.social.ugcbase.security.impl.SaferSlingPostServlet.doFilter(SaferSlingPostServlet.java:126)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.dam.core.impl.assetlinkshare.AdhocAssetShareAuthHandler.doFilter(AdhocAssetShareAuthHandler.java:389)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.dam.core.impl.servlet.ActivityRecordHandler.doFilter(ActivityRecordHandler.java:155)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:73)
    at com.adobe.granite.requests.logging.impl.RequestLoggerImpl.doFilter(RequestLoggerImpl.java:114)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.granite.csrf.impl.CSRFFilter.doFilter(CSRFFilter.java:220)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.security.impl.ContentDispositionFilter.doFilter(ContentDispositionFilter.java:181)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.core.impl.AuthoringUIModeServiceImpl.doFilter(AuthoringUIModeServiceImpl.java:292)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.core.impl.warp.TimeWarpFilter.doFilter(TimeWarpFilter.java:106)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter.doFilter(RedirectFilter.java:248)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.att.core.filters.GtmCookieFilter.doFilter(GtmCookieFilter.java:156)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgressTrackerLogFilter.java:95)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.analytics.provisioning.impl.UserAuthenticationRequestFilter.doFilter(UserAuthenticationRequestFilter.java:119)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.cq.social.commons.cors.CORSAuthenticationFilter.doFilter(CORSAuthenticationFilter.java:91)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet.doFilter(FormsHandlingServlet.java:285)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.granite.optout.impl.OptOutFilter.doFilter(OptOutFilter.java:74)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.day.cq.wcm.core.impl.WCMRequestFilter.doFilter(WCMRequestFilter.java:90)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.cq.mcm.campaign.servlets.CampaignCopyTracker.doFilter(CampaignCopyTracker.java:100)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.rewriter.impl.RewriterFilter.doFilter(RewriterFilter.java:83)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.granite.httpcache.impl.InnerCacheFilter.doFilter(InnerCacheFilter.java:77)
    at com.adobe.granite.httpcache.impl.InnerCacheFilter.doFilter(InnerCacheFilter.java:56)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:129)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.granite.rest.impl.servlet.ApiResourceFilter.doFilter(ApiResourceFilter.java:68)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter.doFilter(BackgroundServletStarterFilter.java:169)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at com.adobe.granite.resourceresolverhelper.impl.ResourceResolverHelperImpl.doFilter(ResourceResolverHelperImpl.java:84)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:73)
    at org.apache.sling.engine.impl.SlingRequestProcessorImpl.doProcessRequest(SlingRequestProcessorImpl.java:151)
    at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:216)
    at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:85)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:79)
    at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:89)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:290)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:129)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.sling.featureflags.impl.FeatureManager.doFilter(FeatureManager.java:116)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.sling.engine.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:75)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
    at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
    at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:124)
    at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:61)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)
Caused by: javax.jcr.AccessDeniedException: OakAccess0000: Access denied
    at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:231)
    at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:212)
    at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:670)
    at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:496)
    at org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.performVoid(SessionImpl.java:419)
    at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:274)
    at org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:416)
    at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.sling.jcr.base.SessionProxyHandler$SessionProxyInvocationHandler.invoke(SessionProxyHandler.java:116)
    at com.sun.proxy.$Proxy7.save(Unknown Source)
    at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.commit(JcrResourceProvider.java:480)
    ... 112 common frames omitted
Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: OakAccess0000: Access denied
    at org.apache.jackrabbit.oak.security.authorization.permission.PermissionValidator.checkPermissions(PermissionValidator.java:212)
    at org.apache.jackrabbit.oak.security.authorization.permission.PermissionValidator.childNodeAdded(PermissionValidator.java:150)
    at org.apache.jackrabbit.oak.security.authorization.permission.PermissionValidator.childNodeAdded(PermissionValidator.java:56)
    at org.apache.jackrabbit.oak.spi.commit.CompositeEditor.childNodeAdded(CompositeEditor.java:108)
    at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeAdded(EditorDiff.java:116)
    at org.apache.jackrabbit.oak.plugins.segment.MapRecord.compare(MapRecord.java:493)
    at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:583)
    at org.apache.jackrabbit.oak.spi.commit.EditorDiff.process(EditorDiff.java:52)
    at org.apache.jackrabbit.oak.spi.commit.EditorHook.processCommit(EditorHook.java:54)
    at org.apache.jackrabbit.oak.spi.commit.CompositeHook.processCommit(CompositeHook.java:61)
    at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore$Commit.prepare(SegmentNodeStore.java:496)
    at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore$Commit.optimisticMerge(SegmentNodeStore.java:519)
    at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore$Commit.execute(SegmentNodeStore.java:575)
    at org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore.merge(SegmentNodeStore.java:238)
    at org.apache.jackrabbit.oak.spi.state.ProxyNodeStore.merge(ProxyNodeStore.java:43)
    at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:247)
    at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.commit(SessionDelegate.java:347)
    at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:494)
    ... 121 common frames omitted


问:
List element pattern matching in Mathematica
The following pattern matches only the first element

```<code>{a, b, c, d, e} /. {start : ___, x_, stop : ___} :> {start, 1, stop}
</code>```

How do I make it match all of the list elements?

UPDATE:

The slightly more extended version of my goal is to have a set of three transformation rules for different elements of the list. One rule should apply to the first element, one for the last element, and another rule for every element in the middle. Here's an example:

```<code>{a, b, c, d, e} /. {most : Repeated[_], x_} ->
   {most, "Last"} /. {x_, rest : Repeated[_]} -> {"First", rest}
</code>```

These are the rules for the first and the last element. Now I need the rule for all the elements in the middle. Hence my original question.

I've probably chosen a wrong approach, because I cannot find a straightforward way to do this. Is it possible to do this with rules?

答:
Your question is a bit unclear. Just guessing what you meant - this will force the longest match:

```<code>In[2]:= {a, b, c, d,  e} /. {start : Longest[___], x_, stop : ___} :> {start, 1, stop}

Out[2]= {a, b, c, d, 1}
</code>```

While this will give all possible outcomes of rule application, not just the first that matches:

```<code>In[3]:= ReplaceList[{a, b, c, d, e}, {start : ___, x_, stop : ___} :> {start, 1, stop}]

Out[3]= {{1, b, c, d, e}, {a, 1, c, d, e}, {a, b, 1, d, e}, {a, b, c, 1, e}, {a, b, c, d, 1}}
</code>```

HTH

Edit:

Responding to a more refined version of the question, a generic answer would be

```<code>{a, b, c, d, e} /. {start_, x__, end_} :> {f[start], g[x], h[end]},
</code>```

Where, by specifying  the functions f,g,h one can do any kind of transformations separately on the first, last, and middle elements. Sometimes you can use rules inside rules to make it more concise, for instance:

```<code>In[7]:= {a, b, c, d, e} /. {start_, x__, end_} :> {start /. _ -> "First",
                   Sequence @@ Replace[{x}, _ -> 1, 1], end /. _ -> "Last"}

Out[7]= {"First", 1, 1, 1, "Last"}
</code>```

But the main point is that once you have destructured the list, it does not matter what you use to transform the different parts - rules again, or functions, etc - you are not confined to only use rules at that point.

Body:
The following pattern matches only the first element

{a, b, c, d, e} /. {start : ___, x_, stop : ___} :> {start, 1, stop}

How do I make it match all of the list elements?

UPDATE:

The slightly more extended version of my goal is to have a set of three transformation rules for different elements of the list. One rule should apply to the first element, one for the last element, and another rule for every element in the middle. Here's an example:

{a, b, c, d, e} /. {most : Repeated[_], x_} ->
   {most, "Last"} /. {x_, rest : Repeated[_]} -> {"First", rest}

These are the rules for the first and the last element. Now I need the rule for all the elements in the middle. Hence my original question.

I've probably chosen a wrong approach, because I cannot find a straightforward way to do this. Is it possible to do this with rules?

Body:
Your question is a bit unclear. Just guessing what you meant - this will force the longest match:

In[2]:= {a, b, c, d,  e} /. {start : Longest[___], x_, stop : ___} :> {start, 1, stop}

Out[2]= {a, b, c, d, 1}

While this will give all possible outcomes of rule application, not just the first that matches:

In[3]:= ReplaceList[{a, b, c, d, e}, {start : ___, x_, stop : ___} :> {start, 1, stop}]

Out[3]= {{1, b, c, d, e}, {a, 1, c, d, e}, {a, b, 1, d, e}, {a, b, c, 1, e}, {a, b, c, d, 1}}

HTH

Edit:

Responding to a more refined version of the question, a generic answer would be

{a, b, c, d, e} /. {start_, x__, end_} :> {f[start], g[x], h[end]},

Where, by specifying  the functions f,g,h one can do any kind of transformations separately on the first, last, and middle elements. Sometimes you can use rules inside rules to make it more concise, for instance:

In[7]:= {a, b, c, d, e} /. {start_, x__, end_} :> {start /. _ -> "First",
                   Sequence @@ Replace[{x}, _ -> 1, 1], end /. _ -> "Last"}

Out[7]= {"First", 1, 1, 1, "Last"}

But the main point is that once you have destructured the list, it does not matter what you use to transform the different parts - rules again, or functions, etc - you are not confined to only use rules at that point.

ContentLicense: CC BY-SA 2.5


问:
Non blocking streaming on Flink

Hi, I'm trying to run a Flink job that it should process incoming data as below. In the process operator right after keyBy(), there should be a case that takes too much time according to some property in data. Even though incoming data have different ids (which is used to keyBy() the stream), long processing code in process function blocks other incoming data. I mean the entire stream.

```<code>SingleOutputStreamOperator<Envelope> processingStream = deviceStream
    .map(e -> (Envelope) e)
    .keyBy((KeySelector<Envelope, String>) value -> value.eventId) // key by scenarios
    .process(new RuleProcessFunction());
</code>```

In RuleProcessFunction.java:

```<code>...
@Override
public void processElement(Envelope value, Context ctx, Collector<Envelope> out) throws Exception {
    //handleEvent(value, ctx, out);
    if (value.getEventId().equals("I")) {
        System.out.println("hello i");
        for (long i = 0; i < 10000000000L; i++) {

        }
    }
    out.collect(value);
}
</code>```

I expect the long-running code block should not block the entire stream. I know there is AsyncFunction for blocking IO situations but I don't know that it's correct solution for this.

答:
Since you aren't pulling data from an external database like Cassandra, I don't think you need to use an AsyncFunction.

What it could be that you are running the flink job with a single parallelism. Try increasing the parallelism so one core isn't responsible for all of the processing as well as receiving data. Granted, there can still be back pressure if you do this. Since if the core responsible for ingesting data from the source is reading in data faster than the core(s) that are running the processFunction Flink's back pressure handling will slow the rate of ingestion.

Title: Non blocking streaming on Flink

Body:
Hi, I'm trying to run a Flink job that it should process incoming data as below. In the process operator right after keyBy(), there should be a case that takes too much time according to some property in data. Even though incoming data have different ids (which is used to keyBy() the stream), long processing code in process function blocks other incoming data. I mean the entire stream.

SingleOutputStreamOperator<Envelope> processingStream = deviceStream
    .map(e -> (Envelope) e)
    .keyBy((KeySelector<Envelope, String>) value -> value.eventId) // key by scenarios
    .process(new RuleProcessFunction());

In RuleProcessFunction.java:

...
@Override
public void processElement(Envelope value, Context ctx, Collector<Envelope> out) throws Exception {
    //handleEvent(value, ctx, out);
    if (value.getEventId().equals("I")) {
        System.out.println("hello i");
        for (long i = 0; i < 10000000000L; i++) {

        }
    }
    out.collect(value);
}

I expect the long-running code block should not block the entire stream. I know there is AsyncFunction for blocking IO situations but I don't know that it's correct solution for this.


问:
OBIEE Impact analysis (using SQL or PL/SQL)
I have been using Oracle Catalog Manager to determine which reports are being affected by RPD columns. I'm wondering if there is any ORACLE table where all these data is kept.

For example, by using SQL, am I able to get these data:

How are the report columns defined back in metadata?

What are the OBIEE objects (Analysis, BIP Reports, Prompts and filters etc.) that are being referenced by a column(s)?

How are columns mapped through metadata?

Who are the owners of reports?

答:
Presentation Catalog objects are not stored in a database. They are XML files on the file system in the folder structure holding your catalog!

What you want to get you get through Catalog Manager the fat client tool or through the command line runcat.sh/cmd which is basically Catalog Manager wihtout a GUI


问:
How can I target the src attribute of the img element using jQuery?
You can target an id with jQuery using $("#yourId"), but how can I target the src attribute of the img element since it's not an id. I want to link the api's images link directly.

I have a

var ico = data.weather[0].icon

I want ico in src"" using jquery.

答:
Try this

var y = $("img[src$='img.png'][name='img']");
console.log(y.attr("src"));```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<img src="img.png" name="img" /></code>```

Body:
Try this

var y = $("img[src$='img.png'][name='img']");
console.log(y.attr("src"));

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<img src="img.png" name="img" />


问:
CMake: Run-time error (dyld: Library not loaded) for dynamically linked resources on MacOS

Problem

On MacOS, I get linking problems at runtime for a CMake project that depends on dynamically linked resources – but only after installing the project! The problem does not occur when I only build the binary without installing it.

```<code>$ ./testapp
Hello world!
$ $INSTALLDIR/testapp
dyld: Library not loaded: @rpath/libvtkDomainsChemistryOpenGL2-7.1.1.dylib
  Referenced from: /Users/normanius/workspace/installdir/testapp
  Reason: image not found
[1]    76964 trace trap  /Users/normanius/workspace/installdir/testapp
</code>```

Minimum example

I am able to reproduce the problem in a minimal setup consisting of CMakeLists.txt and main.cpp. The library I am linking to is called VTK (v7.1.1) which has been built with shared libs (see below for further details).

```<code># CMakeLists.txt
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(test)

# Test application.
add_executable(testapp
               main.cpp)

# Find vtk (library that has to be linked to dynamically).
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
target_link_libraries(testapp ${VTK_LIBRARIES}) # <---- this causes the problem

# Install instructions.
install(TARGETS testapp DESTINATION "${CMAKE_INSTALL_PREFIX}")
</code>```

The main.cpp not even makes use of any VTK objects.

```<code>// main.cpp
#include <iostream>

int main (int argc, char* argv[])
{
    std::cout << "Hello world!" << std::endl;
    return 0;
}
</code>```

I build the project with the following commands. The flag CMAKE_PREFIX_PATH I set to give CMake a hint about where to find the VTK library.

```<code>$ INSTALLDIR="path/to/installation"
$ mkdir build && cd build
$ cmake .. -DCMAKE_PREFIX_PATH="$DEVPATH/lib/vtk/cmake" \
           -DCMAKE_BUILD_TYPE=Release \
           -DCMAKE_INSTALL_PREFIX="$INSTALLDIR"
$ make
$ make install
</code>```

When executing the testapp in the build folder, everything looks fine:

```<code>$ ./testapp
Hello world!
$ cp testapp $INSTALLDIR/testapp
$ $INSTALLDIR/testapp
Hello world!
</code>```

However, if I run the executable in the INSTALLDIR I get a run-time error:

```<code>$ $INSTALLDIR/testapp
dyld: Library not loaded: @rpath/libvtkDomainsChemistryOpenGL2-7.1.1.dylib
  Referenced from: /Users/normanius/workspace/installdir/testapp
  Reason: image not found
[1]    76964 trace trap  /Users/normanius/workspace/installdir/testapp
</code>```

Naturally, the problem goes away if I remove the target_link_libraries() instruction in the CMakeLists.txt.

So what exactly happens when installing a CMake project? And what goes wrong in my case? I tested different CMake versions (3.5, 3.9 and 3.10) - but the behaviour is the same.

Details

Apparently, the RPATH mechanism on MacOS is not properly set up for the example.

This is an excerpt of the linking structure of the testapp binary:

```<code>$ otool -L testapp
testapp:
    @rpath/libvtkDomainsChemistryOpenGL2-7.1.1.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libvtkFiltersFlowPaths-7.1.1.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libvtkFiltersGeneric-7.1.1.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libvtkFiltersHyperTree-7.1.1.dylib (compatibility version 0.0.0, current version 0.0.0)
...
</code>```

Because it may play a role how the VTK library (another CMake project) was built: For python support, one has to set the project flags VTK_WRAP_PYTHON=ON and BUILD_SHARED_LIBS=ON. The installation prefix was set to CMAKE_INSTALL_PREFIX="$VTK_INSTALL_DIR". To make sure that the resources are found at runtime, one has to additionally enable RPATH support via CMAKE_MACOSX_RPATH=ON and CMAKE_INSTALL_RPATH="$VTK_INSTALL_DIR/lib".

Wrap-up

What do I conceptually get wrong? What happens when installing the project with make install? Can this problem be solved within CMake? Or is it related only to VTK and how the shared libs were built?

答:
CMake changes the RPATH for all installed targets upon running make install.

Imagine building both a shared library and an executable as part of the same CMake project. In order to be able to run the executable, it has to be able to dynamically load the shared library at runtime. Therefore, CMake by default adds the full (absolute) path to the dynamic library in the build tree to the executable's rpath. This is very convenient for developing, as we can run the executable straight from the build tree, but we probably would not want to ship the executable that way.

That's why CMake will change the rpath upon install to only contain portable paths (ie. remove the entry pointing to the build tree). That is, unless you put your shared library into one of the system default locations, the executable won't find it anymore after installing.

CMake does allow you though to specify an install rpath that will replace the removed build tree entry with your specified one. See the INSTALL_RPATH and INSTALL_RPATH_USE_LINK_PATH target properties for details.

Since all of this rpath stuff is 100% platform-dependent, OSX comes with its own, special rules. A pretty comprehensive explanation can be found on the (unfortunately rather outdated) CMake wiki:

Unlike other UNIXes, the Darwin linker, dyld, locates dependent
dynamic libraries using the full path to each dylib. For example, in
an executable "foo", the full paths recorded are the install names for
each dependent dylib. And the library "/usr/lib/libSystem.dylib" has
an install name of "/usr/lib/libSystem.B.dylib" as given by "otool
-D". When linked into "foo", "foo" has a dependency on "/usr/lib/libSystem.B.dylib". This dependency can be seen with "otool
-L foo". For relocatable binaries, @executable_path, @loader_path and @rpath are available to use. In the "foo" example, @executable_path
and @loader_path are substituted for the location of "foo". @rpath is
substituted with the RPATHs in "foo" to locate dependent dylibs. Thus
the RPATH mechanism comes into play. The linker will search for
@rpath/ dependencies in the following order:

DYLD_LIBRARY_PATH - an
environment variable which holds a list of directories

RPATH - a list
of directories which is linked into the executable. These can contain
@loader_path and @executable_path.

builtin directories - /lib /usr/lib

DYLD_FALLBACK_LIBRARY_PATH - an environment variable which holds a
list of directories

You should be able to solve this by tuning the respective target properties, but it is rather fiddly and can be quite a pain to get right.

Body:
Problem

On MacOS, I get linking problems at runtime for a CMake project that depends on dynamically linked resources – but only after installing the project! The problem does not occur when I only build the binary without installing it.

$ ./testapp
Hello world!
$ $INSTALLDIR/testapp
dyld: Library not loaded: @rpath/libvtkDomainsChemistryOpenGL2-7.1.1.dylib
  Referenced from: /Users/normanius/workspace/installdir/testapp
  Reason: image not found
[1]    76964 trace trap  /Users/normanius/workspace/installdir/testapp

Minimum example

I am able to reproduce the problem in a minimal setup consisting of CMakeLists.txt and main.cpp. The library I am linking to is called VTK (v7.1.1) which has been built with shared libs (see below for further details).

# CMakeLists.txt
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(test)

# Test application.
add_executable(testapp
               main.cpp)

# Find vtk (library that has to be linked to dynamically).
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
target_link_libraries(testapp ${VTK_LIBRARIES}) # <---- this causes the problem

# Install instructions.
install(TARGETS testapp DESTINATION "${CMAKE_INSTALL_PREFIX}")

The main.cpp not even makes use of any VTK objects.

// main.cpp
#include <iostream>

int main (int argc, char* argv[])
{
    std::cout << "Hello world!" << std::endl;
    return 0;
}

I build the project with the following commands. The flag CMAKE_PREFIX_PATH I set to give CMake a hint about where to find the VTK library.

$ INSTALLDIR="path/to/installation"
$ mkdir build && cd build
$ cmake .. -DCMAKE_PREFIX_PATH="$DEVPATH/lib/vtk/cmake" \
           -DCMAKE_BUILD_TYPE=Release \
           -DCMAKE_INSTALL_PREFIX="$INSTALLDIR"
$ make
$ make install

When executing the testapp in the build folder, everything looks fine:

$ ./testapp
Hello world!
$ cp testapp $INSTALLDIR/testapp
$ $INSTALLDIR/testapp
Hello world!

However, if I run the executable in the INSTALLDIR I get a run-time error:

$ $INSTALLDIR/testapp
dyld: Library not loaded: @rpath/libvtkDomainsChemistryOpenGL2-7.1.1.dylib
  Referenced from: /Users/normanius/workspace/installdir/testapp
  Reason: image not found
[1]    76964 trace trap  /Users/normanius/workspace/installdir/testapp

Naturally, the problem goes away if I remove the target_link_libraries() instruction in the CMakeLists.txt.

So what exactly happens when installing a CMake project? And what goes wrong in my case? I tested different CMake versions (3.5, 3.9 and 3.10) - but the behaviour is the same.

Details

Apparently, the RPATH mechanism on MacOS is not properly set up for the example.

This is an excerpt of the linking structure of the testapp binary:

$ otool -L testapp
testapp:
    @rpath/libvtkDomainsChemistryOpenGL2-7.1.1.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libvtkFiltersFlowPaths-7.1.1.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libvtkFiltersGeneric-7.1.1.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libvtkFiltersHyperTree-7.1.1.dylib (compatibility version 0.0.0, current version 0.0.0)
...

Because it may play a role how the VTK library (another CMake project) was built: For python support, one has to set the project flags VTK_WRAP_PYTHON=ON and BUILD_SHARED_LIBS=ON. The installation prefix was set to CMAKE_INSTALL_PREFIX="$VTK_INSTALL_DIR". To make sure that the resources are found at runtime, one has to additionally enable RPATH support via CMAKE_MACOSX_RPATH=ON and CMAKE_INSTALL_RPATH="$VTK_INSTALL_DIR/lib".

Wrap-up

What do I conceptually get wrong? What happens when installing the project with make install? Can this problem be solved within CMake? Or is it related only to VTK and how the shared libs were built?


问:
TSQL Pivot Switch
I am trying to pivot the DataDescription rows into columns, and unpivot the Number* columns into rows aliased into a new column.

The desired columns would be:

```<code>Location, 2016-01-01, 2016-01-02, 2016-01-03, 2016-01-04, 2016-01-05,CountType
</code>```

Below is the code to setup the scenario.  Would this be done more cleanly in C# or TSQL?  Any suggestions?

```<code>if (object_id('tempdb..#data') is not null)
    begin
        drop table #data
    end

    create table #data
    (
        DateDescription VARCHAR(50),
        Location VARCHAR(50),
        NumberOfVisits INT,
        NumberOfPositiveVisits INT,
        NumberOfNegativeVisits INT
    )

    insert into #data
    SELECT '2016-01-01', 'SiteA', 100, 80, 20
    union all
    SELECT '2016-01-02', 'SiteA', 95, 81, 21
    union all
    SELECT '2016-01-03', 'SiteA', 95, 81, 21
    union all
    SELECT '2016-01-04', 'SiteA', 95, 81, 21
    union all
    SELECT '2016-01-05', 'SiteA', 95, 81, 21
    union all
    SELECT '2016-01-01', 'SiteB', 95, 81, 21
    union all
    SELECT '2016-01-02', 'SiteB', 95, 81, 21
    union all
    SELECT '2016-01-03', 'SiteB', 95, 81, 21
    union all
    SELECT '2016-01-04', 'SiteB', 95, 81, 21
    union all
    SELECT '2016-01-05', 'SiteB', 95, 81, 21

    select * from #data
</code>```

答:
Something like this will work:</p>

```<code>SELECT
    Location
    , [2016-01-01]
    , [2016-01-02]
    , [2016-01-03]
    , [2016-01-04]
    , [2016-01-05]
    , CountType
FROM
    (
        SELECT
            DateDescription
            , Location
            , [Count]
            , CountType
        FROM
            (
                SELECT
                    DateDescription
                    , Location
                    , NumberOfVisits
                    , NumberOfPositiveVisits
                    , NumberOfNegativeVisits
                FROM #data
            ) Q
            UNPIVOT
            (
                [Count]
                FOR CountType IN ([NumberOfVisits], [NumberOfPositiveVisits], [NumberOfNegativeVisits])
            ) U
    ) Q
    PIVOT
    (
        MAX([Count])
        FOR DateDescription IN ([2016-01-01], [2016-01-02], [2016-01-03], [2016-01-04], [2016-01-05])
    ) P
ORDER BY
    Location
    , CountType DESC
</code>```

Title: TSQL Pivot Switch

Body:
I am trying to pivot the DataDescription rows into columns, and unpivot the Number* columns into rows aliased into a new column.

The desired columns would be:

Location, 2016-01-01, 2016-01-02, 2016-01-03, 2016-01-04, 2016-01-05,CountType

Below is the code to setup the scenario.  Would this be done more cleanly in C# or TSQL?  Any suggestions?

if (object_id('tempdb..#data') is not null)
    begin
        drop table #data
    end

    create table #data
    (
        DateDescription VARCHAR(50),
        Location VARCHAR(50),
        NumberOfVisits INT,
        NumberOfPositiveVisits INT,
        NumberOfNegativeVisits INT
    )

    insert into #data
    SELECT '2016-01-01', 'SiteA', 100, 80, 20
    union all
    SELECT '2016-01-02', 'SiteA', 95, 81, 21
    union all
    SELECT '2016-01-03', 'SiteA', 95, 81, 21
    union all
    SELECT '2016-01-04', 'SiteA', 95, 81, 21
    union all
    SELECT '2016-01-05', 'SiteA', 95, 81, 21
    union all
    SELECT '2016-01-01', 'SiteB', 95, 81, 21
    union all
    SELECT '2016-01-02', 'SiteB', 95, 81, 21
    union all
    SELECT '2016-01-03', 'SiteB', 95, 81, 21
    union all
    SELECT '2016-01-04', 'SiteB', 95, 81, 21
    union all
    SELECT '2016-01-05', 'SiteB', 95, 81, 21

    select * from #data

Body:
Something like this will work:

SELECT
    Location
    , [2016-01-01]
    , [2016-01-02]
    , [2016-01-03]
    , [2016-01-04]
    , [2016-01-05]
    , CountType
FROM
    (
        SELECT
            DateDescription
            , Location
            , [Count]
            , CountType
        FROM
            (
                SELECT
                    DateDescription
                    , Location
                    , NumberOfVisits
                    , NumberOfPositiveVisits
                    , NumberOfNegativeVisits
                FROM #data
            ) Q
            UNPIVOT
            (
                [Count]
                FOR CountType IN ([NumberOfVisits], [NumberOfPositiveVisits], [NumberOfNegativeVisits])
            ) U
    ) Q
    PIVOT
    (
        MAX([Count])
        FOR DateDescription IN ([2016-01-01], [2016-01-02], [2016-01-03], [2016-01-04], [2016-01-05])
    ) P
ORDER BY
    Location
    , CountType DESC


问:
Netlogo: How to assign a value to a variable from an existing (string) list
I have a problem as I am trying to a assign a location to a (franchisee) supermarket. I have a list per supermarket brand, which has cities that are repeated as many times as the amount of outlets that supermarket brand has in the given city.

However, with the code I've been using, I cannot get to assign the exact amount of cities I have in my list, it is randomly changing every time.

```<code>;to create coop franchisees
  create-Fs 32 [
    set HQ-brand "Coop"
    set fcoop-location-outlet ["Zuidlaren" "Zuidlaren" "Nijmegen"   "Nijmegen"  "Nijmegen"  "Nijmegen"  "Nijmegen"  "Nijmegen"  "Nijmegen"  "Nijmegen"  "Nijmegen"  "Nijmegen"  "Ba neveld" "Barneveld" "Doetinchem"    "Doetinchem"    "Doetinchem"    "Zutphen"   "Huissen" "Amstelveen" "Amstelveen" "Amstelveen"    "Zwolle"    "Zwolle" "Rotterdam" "Rotterdam" "Rotterdam"    "Rotterdam" "Rotterdam" "Rotterdam" "Rotterdam" "Rotterdam"]
]
</code>```

once I have the list above, I have tried the following, to assign a city outlet to each franchisee (per brand)

trial 1

```<code>ask Fs with [(HQ-brand = "Coop") and (location-outlet = 0)] [ set location-outlet one-of fcoop-location-outlet ]
</code>```

trial 2

```<code>ask Fs with [(HQ-brand = "Coop") and (location-outlet = 0)] [ foreach fcoop-location-outlet [set location-outlet one-of fcoop-location-outlet] ]
</code>```

trial 3

```<code>ask Fs with [(HQ-brand = "Coop") and (location-outlet = 0)] [ set location-outlet n-of 32 fcoop-location-outlet ]
</code>```

I thought that with one-of I would assign one item of the Coop location list to each one of my 32 Coop outlets, but it is random. With the n-of it didn't work and I thought that maybe foreach would work, but it is the same as with the one-of the way I am coding it.

How can I code this so that every time I will have all the items of the list with the cities assigned to one of my Coop outlets? There must be a simple way to do this, but I have been googling it and can't figure it out.

(I am doing this for 8 other supermarkets).

答:
You don't have enough of your code for me to write something that will actually work. I didn't want to get into modifying the list, so create an iterator. Something like this should work. It takes advantage of the fact that ask is in random order so you don't need to randomise the list order. I started from -1 so I could increment before assigning (so it doesn't go off the end of the list on the last turtle).

```<code>to assign-locations
  let iterator -1
  ask turtles
  [ set iterator iterator + 1
    set my-location item iterator fcoop-location-outlet
  ]
end
</code>```

Body:
I have a problem as I am trying to a assign a location to a (franchisee) supermarket. I have a list per supermarket brand, which has cities that are repeated as many times as the amount of outlets that supermarket brand has in the given city.

However, with the code I've been using, I cannot get to assign the exact amount of cities I have in my list, it is randomly changing every time.

;to create coop franchisees
  create-Fs 32 [
    set HQ-brand "Coop"
    set fcoop-location-outlet ["Zuidlaren" "Zuidlaren" "Nijmegen"   "Nijmegen"  "Nijmegen"  "Nijmegen"  "Nijmegen"  "Nijmegen"  "Nijmegen"  "Nijmegen"  "Nijmegen"  "Nijmegen"  "Ba neveld" "Barneveld" "Doetinchem"    "Doetinchem"    "Doetinchem"    "Zutphen"   "Huissen" "Amstelveen" "Amstelveen" "Amstelveen"    "Zwolle"    "Zwolle" "Rotterdam" "Rotterdam" "Rotterdam"    "Rotterdam" "Rotterdam" "Rotterdam" "Rotterdam" "Rotterdam"]
]

once I have the list above, I have tried the following, to assign a city outlet to each franchisee (per brand)

trial 1

ask Fs with [(HQ-brand = "Coop") and (location-outlet = 0)] [ set location-outlet one-of fcoop-location-outlet ]

trial 2

ask Fs with [(HQ-brand = "Coop") and (location-outlet = 0)] [ foreach fcoop-location-outlet [set location-outlet one-of fcoop-location-outlet] ]

trial 3

ask Fs with [(HQ-brand = "Coop") and (location-outlet = 0)] [ set location-outlet n-of 32 fcoop-location-outlet ]

I thought that with one-of I would assign one item of the Coop location list to each one of my 32 Coop outlets, but it is random. With the n-of it didn't work and I thought that maybe foreach would work, but it is the same as with the one-of the way I am coding it.

How can I code this so that every time I will have all the items of the list with the cities assigned to one of my Coop outlets? There must be a simple way to do this, but I have been googling it and can't figure it out.

(I am doing this for 8 other supermarkets).

Body:
You don't have enough of your code for me to write something that will actually work. I didn't want to get into modifying the list, so create an iterator. Something like this should work. It takes advantage of the fact that ask is in random order so you don't need to randomise the list order. I started from -1 so I could increment before assigning (so it doesn't go off the end of the list on the last turtle).

to assign-locations
  let iterator -1
  ask turtles
  [ set iterator iterator + 1
    set my-location item iterator fcoop-location-outlet
  ]
end


问:
MVC Model, CodeIgniter and auth
i am starting to get the hang on the MVC Model, but I still have some questions. This is one of them

I have a website with 6 or 7 main pages. They all share the header view where the logo is, the top menu, the search and, most importantly, a login form consisting of a user and a password text fields, and a submit button.

I want the user to be able to login in any page of the site, and return to the page he was if successful.

What is the best way to call the auth controller to login and make sure the user comes back to the same page (call the correct controller)?

答: Point login form to the script that handles login process. There, you check login/password against your database for example. If login is successful, redirect user to the page he/she came from with this php call header("Location: {$_SERVER['HTTP_REFERER']}");

Title: MVC Model, CodeIgniter and auth


问:
C - Matrix Main and Anti Diagonals (Replace)
I have a task and i need help from pros.

My task is: User inputs number of rows and columns for matrix[8][8], with some prohibitions using IF. Later user enters all the elements for this matrix, using loops and outputting this matrix.

Here is the code :

```<code>#include <stdio.h>

int main ()
{
    int matrix[10][10];
    int nrows, ncols, i, j;

    printf("Enter number of rows: "); //user enters number of rows
    scanf("%d", &nrows);
    if(nrows < 4){
        printf("\n Out of range, please try again");
        exit(5);
    }
    printf("Enter number of columns: "); //user enters number of columns
    scanf("%d", &ncols);
    if(ncols < 4){
        printf("\n Out of range, please try again");
        exit(5);
    }
    printf("Enter matrix elements: "); //user enters all the elements for Matrix

    for(i = 0; i < nrows; i++){
        for(j = 0; j < ncols; j++){
            scanf("%d",&matrix[i][j]);
    }

    printf("\n");
}
    printf("This is your matrix: \n");
    for(i = 0; i < nrows; i++){
        for(j = 0; j < ncols; j++){
            printf("%d \t",matrix[i][j]);}

    printf("\n");}

    return 0;
}
</code>```

Now i need to add one thing, i want to take diagonal and anti-diagonal of this matrix and replace all the elements there with capital X.
As i don't know, what kind of matrix it will be, like it can be matrix[4][6] or matrix[7][4], so i need to do something that will work with any kind of matrix that user can enter in this program.

Example of this task (In this program i can't enter less than [4][4], but for the example i'll do it):

```<code>User enters rows - 3
User enters columns - 3
User enters elements : 1 2 3 4 5 6 7 8 9
Output :

    1 2 3
    4 5 6
    7 8 9
</code>```

Here i need to do something like this :

```<code>X 2 X
4 X 6
X 8 X
</code>```

If user enters not square matrix, for example:

```<code>User enters rows: 3
User enters rows: 4
User enters elements: 1 2 3 4 5 6 7 8 9

Out matrix:

1 2 3 4
5 6 7 8
9 0 1 2

After replacing with X:

X 2 3 X
5 X X 8
9 X X 2
</code>```

Replaced diagonal and anti-diagonal with capital Xs.

Please any help ?

答:
You can do something like this:

```<code>    printf("This is your matrix: \n");
for(i = 0; i < nrows; i++){
    for(j = 0; j < ncols; j++){
        if (i == j)
            printf("X \t");
        else if (i == ncols - j - 1)
            printf("X \t");
        else
            printf("%d \t", matrix[i][j]);
    }

    printf("\n");}
</code>```

Example:

```<code>Enter number of rows: 4
Enter number of columns: 5
Enter matrix elements: 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4

This is your matrix:
X   1   1   1   X
2   X   2   X   2
3   3   X   3   3
4   X   4   X   4
</code>```

Body:
I have a task and i need help from pros.

My task is: User inputs number of rows and columns for matrix[8][8], with some prohibitions using IF. Later user enters all the elements for this matrix, using loops and outputting this matrix.

Here is the code :

#include <stdio.h>

int main ()
{
    int matrix[10][10];
    int nrows, ncols, i, j;

    printf("Enter number of rows: "); //user enters number of rows
    scanf("%d", &nrows);
    if(nrows < 4){
        printf("\n Out of range, please try again");
        exit(5);
    }
    printf("Enter number of columns: "); //user enters number of columns
    scanf("%d", &ncols);
    if(ncols < 4){
        printf("\n Out of range, please try again");
        exit(5);
    }
    printf("Enter matrix elements: "); //user enters all the elements for Matrix

    for(i = 0; i < nrows; i++){
        for(j = 0; j < ncols; j++){
            scanf("%d",&matrix[i][j]);
    }

    printf("\n");
}
    printf("This is your matrix: \n");
    for(i = 0; i < nrows; i++){
        for(j = 0; j < ncols; j++){
            printf("%d \t",matrix[i][j]);}

    printf("\n");}

    return 0;
}

Now i need to add one thing, i want to take diagonal and anti-diagonal of this matrix and replace all the elements there with capital X.
As i don't know, what kind of matrix it will be, like it can be matrix[4][6] or matrix[7][4], so i need to do something that will work with any kind of matrix that user can enter in this program.

Example of this task (In this program i can't enter less than [4][4], but for the example i'll do it):

User enters rows - 3
User enters columns - 3
User enters elements : 1 2 3 4 5 6 7 8 9
Output :

    1 2 3
    4 5 6
    7 8 9

Here i need to do something like this :

X 2 X
4 X 6
X 8 X

If user enters not square matrix, for example:

User enters rows: 3
User enters rows: 4
User enters elements: 1 2 3 4 5 6 7 8 9

Out matrix:

1 2 3 4
5 6 7 8
9 0 1 2

After replacing with X:

X 2 3 X
5 X X 8
9 X X 2

Replaced diagonal and anti-diagonal with capital Xs.

Please any help ?

Body:
You can do something like this:

    printf("This is your matrix: \n");
for(i = 0; i < nrows; i++){
    for(j = 0; j < ncols; j++){
        if (i == j)
            printf("X \t");
        else if (i == ncols - j - 1)
            printf("X \t");
        else
            printf("%d \t", matrix[i][j]);
    }

    printf("\n");}

Example:

Enter number of rows: 4
Enter number of columns: 5
Enter matrix elements: 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4

This is your matrix:
X   1   1   1   X
2   X   2   X   2
3   3   X   3   3
4   X   4   X   4


问:
Remove trailing zeros from a number inside AngularJS interpolation
I know there are answers for plain JavaScript code for this question but they are not available in this case.

I have a table which must be populated with data. My code looks like this:

```<code><tr ng-repeat="rows in $ctrl.matrix[0] track by $index">
    <td>{{$ctrl.labels[$index]}}</td>
    <td ng-repeat="label in $ctrl.xMatrix">{{$ctrl.matrix[$index][$parent.$index].toFixed(2)}}</td>
</tr>
</code>```

As it can be seen, it is used toFixed(2) to remove all but two digits after dot.

I want also this change:

```<code>34.90 => 34.9
 0.00 => 0
</code>```

As it says here, I parseFloat(n.toFixed(2));, so in my case it would be:

{{parseFloat($ctrl.matrix[$index][$parent.$index].toFixed(2))}} or

{{$ctrl.parseFloat(matrix[$index][$parent.$index].toFixed(2))}}

but in both cases I get no error and my table is empty.

Is there a way to  remove these zeros inside {{}}?

答:
Make sure you cast your number as a "number". Then cast as a string.

var numberstring = "1.2350000";

var number = Number(numberstring);
console.log(typeof number);

var zerodown = number.toString();
console.log(zerodown)```

To change numbers inside {{}} is unlikely. This is a placeholder for variables that are dynamically applied. You should do that server side or after the value is parsed.

Body:
I know there are answers for plain JavaScript code for this question but they are not available in this case.

I have a table which must be populated with data. My code looks like this:

    {{$ctrl.labels[$index]}}
    {{$ctrl.matrix[$index][$parent.$index].toFixed(2)}}

As it can be seen, it is used toFixed(2) to remove all but two digits after dot.

I want also this change:

34.90 => 34.9
 0.00 => 0

As it says here, I parseFloat(n.toFixed(2));, so in my case it would be:

{{parseFloat($ctrl.matrix[$index][$parent.$index].toFixed(2))}} or

{{$ctrl.parseFloat(matrix[$index][$parent.$index].toFixed(2))}}

but in both cases I get no error and my table is empty.

Is there a way to  remove these zeros inside {{}}?

Body:
Make sure you cast your number as a "number". Then cast as a string.

var numberstring = "1.2350000";

var number = Number(numberstring);
console.log(typeof number);

var zerodown = number.toString();
console.log(zerodown)

To change numbers inside {{}} is unlikely. This is a placeholder for variables that are dynamically applied. You should do that server side or after the value is parsed.


问:
Arc SVG Parameters
I've been trying to understand arc svg since it seems I need them in plotly -- my goal is to plot circle intersections.

My original idea was something like this:

for every intersection, to find the start and end coordinates as well as the height - but I am not very sure of where to go from here. It seems I am lacking the rotation and Large Arc Flag / Sweep parameters, and I am not sure how I would go about retrieving them. If anyone could point me into the right direction here, that would be great!

答:
Let's start with some terminology to clear up what is a clockwise direction (remember the y axis of SVG goes down): the first circle has radius r1, the second r2.

If the center of the first circle is lower than that of the second (cy1 > cy2), then name the intersection point with the smaller x coordinate (x1, y1), and the other (x2, y2).

If the center of the first circle is higher than that of the second (cy1 < cy2), then name the intersection point with the greater x coordinate (x1, y1), and the other (x2, y2).

Else, name the intersection point with the smaller y coordinate (x1, y1), and the other (x2, y2).

Now we will draw an arc from the first to the second intersection point with the radius of the first circle. The first two arc parameters are the horizontal and vertical radius. Since we are drawing a circle, both are identical. For the same reason, rotating the radii does not make sense and the third parameter is 0.

The intersection of two circles always uses the small arc (the large arc would be used for the union), therefore the large arc flag is 0. We are drawing the arc clockwise, therefore the sweep flag is 1.

Still unclear? The spec uses this picture for explaining the flags:

The second arc is going from the second to the first intersection point with the radius of the second circle. The flags remain the same.

The result looks like this:

```<code>M x1, y1 A r1 r1 0 0 1 x2, y2 A r2 r2 0 0 1 x1, y1 Z
</code>```

Title: Arc SVG Parameters

Body:
Let's start with some terminology to clear up what is a clockwise direction (remember the y axis of SVG goes down): the first circle has radius r1, the second r2.

If the center of the first circle is lower than that of the second (cy1 > cy2), then name the intersection point with the smaller x coordinate (x1, y1), and the other (x2, y2).

If the center of the first circle is higher than that of the second (cy1 < cy2), then name the intersection point with the greater x coordinate (x1, y1), and the other (x2, y2).

Else, name the intersection point with the smaller y coordinate (x1, y1), and the other (x2, y2).

Now we will draw an arc from the first to the second intersection point with the radius of the first circle. The first two arc parameters are the horizontal and vertical radius. Since we are drawing a circle, both are identical. For the same reason, rotating the radii does not make sense and the third parameter is 0.

The intersection of two circles always uses the small arc (the large arc would be used for the union), therefore the large arc flag is 0. We are drawing the arc clockwise, therefore the sweep flag is 1.

Still unclear? The spec uses this picture for explaining the flags:

The second arc is going from the second to the first intersection point with the radius of the second circle. The flags remain the same.

The result looks like this:

M x1, y1 A r1 r1 0 0 1 x2, y2 A r2 r2 0 0 1 x1, y1 Z


问:
"textLength" changes on hover for svg text elements in Internet Explorer
I'm using svg-text-elements for a Website Layout and i'm changing the textLength-attribute to get alle the Menu items in a Menu to have the same length. (When you change textLength the spacing is automatically adjusted and the letters keep their size)

```<code><div class="menu-item">
        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
            <text class="hover-black" lengthAdjust="spacing" fill="black">AGENDA</text>
        </svg>
</div>
</code>```

"textLength" and positioning is done in JavaScript.

It's all working fine, except that in Internet Explorer the textLength-Attributs seem to be erased when i hover over the Menu-Text, and the svg-text i'm hovering over flips back in standard spacing.

There's nothing set in CSS nor JS for the hovering...

Perhaps somebody has an idea, thanks a lot!

EDIT: Solved!
Sorry for bothering you guys. I found a:

```<code>.menu-item {
    &:hover {
        cursor: pointer
    }
}
</code>```

which i overlooked in the css. Seems to be a bug in IE.

答:
Try adding style="pointer-events:none" to the actual text tag. That should fix it in IE11 at least. I ran into a similar issue with IE acting weird while using lenghtAdjust in SVGs.

So you altogether it would look like this :

```<code><div class="menu-item">
    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
        <text class="hover-black" x="30" y="30" textLength="250" fill="black" style="pointer-events:none">AGENDA</text>
      </svg>
</div>
</code>```

I've tried doing it with a class and that doesn't work either. Only when I added it to the text tag as inline CSS.

It was still acting weird with the cursor:pointer for me. To reproduce the issue, try double-clicking on the text in IE. It'll jump to the right or left. If this is a navigation item, then you would need to do an active link (rect maybe?) below the text and pointer-events:none already allows you to click through the text.

Body:
I'm using svg-text-elements for a Website Layout and i'm changing the textLength-attribute to get alle the Menu items in a Menu to have the same length. (When you change textLength the spacing is automatically adjusted and the letters keep their size)

        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
            <text class="hover-black" lengthAdjust="spacing" fill="black">AGENDA</text>
        </svg>

"textLength" and positioning is done in JavaScript.

It's all working fine, except that in Internet Explorer the textLength-Attributs seem to be erased when i hover over the Menu-Text, and the svg-text i'm hovering over flips back in standard spacing.

There's nothing set in CSS nor JS for the hovering...

Perhaps somebody has an idea, thanks a lot!

EDIT: Solved!
Sorry for bothering you guys. I found a:

.menu-item {
    &:hover {
        cursor: pointer
    }
}

which i overlooked in the css. Seems to be a bug in IE.

Body:
Try adding style="pointer-events:none" to the actual text tag. That should fix it in IE11 at least. I ran into a similar issue with IE acting weird while using lenghtAdjust in SVGs.

So you altogether it would look like this :

<div class="menu-item">
    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
        <text class="hover-black" x="30" y="30" textLength="250" fill="black" style="pointer-events:none">AGENDA</text>
      </svg>
</div>

I've tried doing it with a class and that doesn't work either. Only when I added it to the text tag as inline CSS.

It was still acting weird with the cursor:pointer for me. To reproduce the issue, try double-clicking on the text in IE. It'll jump to the right or left. If this is a navigation item, then you would need to do an active link (rect maybe?) below the text and pointer-events:none already allows you to click through the text.