小编Ale*_*Man的帖子

将Html表转换为JSON

我已经创建了一个示例应用程序,它将html表转换为JSON.问题是JSON没有重复值,我想从JSON中删除最后两列.

我生成的JSON如下所示

[
   {
      "Person Name":"Smith",
      "Score":"disqualified",
      "Price":"150",
      "Tax":"41"
   },
   {
      "Person Name":"Jackson",
      "Score":"94",
      "Price":"250",
      "Tax":"81"
   },
   {
      "Person Name":"Doe",
      "Score":"80",
      "Price":"950",
      "Tax":"412"
   },
   {
      "Person Name":"Johnson",
      "Score":"67",
      "Price":"750",
      "Tax":"941"
   }
]
Run Code Online (Sandbox Code Playgroud)

但我期望的JSON就像

[
   {
      "Person Name":"Jill",
      "Person Name":"Smith",
      "Score":"disqualified"
   },
   {
      "Person Name":"Eve",
      "Person Name":"Smith",
      "Score":"94"
   },
   {
      "Person Name":"John",
      "Person Name":"Smith",
      "Score":"80"
   },
   {
      "Person Name":"Adam",
      "Person Name":"Smith",
      "Score":"67"
   }
]
Run Code Online (Sandbox Code Playgroud)

任何人都可以告诉我如何从表中生成上述JSON

我的代码如下所示.

HTML代码

<table id='example-table'>
    <thead>
    <tr>
        <th>Person Name</th>
        <th>Person Name</th>
        <th data-override="Score">Points</th>
        <th>Price</th>
        <th>Tax</th>
    </tr>
    </thead> …
Run Code Online (Sandbox Code Playgroud)

javascript jquery json

7
推荐指数
1
解决办法
3万
查看次数

条形图顶部中间的折线图点

我使用chartjs创建了一个组合双条形图.我的代码如下.条形组合双图工作正常,但我有一个要求为绿色条形图添加一条线,连接所有顶部中间点.我有点画了一个连接绿色图的线图,但我面临的问题是线图点不在绿色条形图的顶部中间,如下所示.

任何人都可以告诉我如何在条形图的顶部中间制作线点

![在此处输入图像说明

工作演示

HTML

<canvas id="canvas"></canvas>
Run Code Online (Sandbox Code Playgroud)

JS

var barChartData = {
        labels: ["January", "February", "March", "April", "May", "June", "July"],
        datasets: [{
            type: 'bar',
              label: "Visitor",
                data: [10, 59, 340, 521, 450, 200, 195],
                fill: false,
                backgroundColor: "rgba(220,220,220,0.5)",
                borderColor: '#71B37C',
                hoverBackgroundColor: '#71B37C',
                hoverBorderColor: '#71B37C'

        }, {
            type: 'bar',
              label: "Visitor",
                data: [200, 185, 590, 621, 250, 400, 95],
                fill: false,
                backgroundColor: '#71B37C',
                borderColor: '#71B37C',
                hoverBackgroundColor: '#71B37C',
                hoverBorderColor: '#71B37C'

        }, {

                type:'line',
                data: [200, 185, 590, 621, 250, 400, 95],
                fill: false, …
Run Code Online (Sandbox Code Playgroud)

javascript bar-chart chart.js

7
推荐指数
1
解决办法
626
查看次数

Liferay api/jsonws页面只能供管理员用户访问

任何人都可以告诉我如何限制普通用户访问Liferay api/jsonws页面.api/jsonws页面只能供管理员用户访问.

我们在Liferay中有任何选择吗?

任何人都可以帮我这个

java rest web-services liferay-6 liferay-6.2

7
推荐指数
1
解决办法
573
查看次数

Spring Boot2 Oauth2隐式流 - http:// localhost:8080/oauth/authorize获取访问被拒绝

我创建了一个Spring Boot 2应用程序,集成了SpringFox Swagger 2.8.0和Implicit Oauth2 Grant,用于身份验证和授权.

该代码工作正常,但当我单击授权按钮时,它重定向到

HTTP://本地主机:8080 /的OAuth /授权RESPONSE_TYPE =令牌的client_id =测试应用程式内用户-id&REDIRECT_URI = HTTP%3A%2F%2Flocalhost%3A8080%2Fwebjars%2Fspringfox-招摇的UI%2Foauth2-将redirect.html&范围=读&状态= U3VuIE9jdCAxNCAyMDE4IDIwOjQyOjUwIEdNVCswNTMwIChJbmRpYSBTdGFuZGFyZCBUaW1lKQ%3D%3D

但是显示Access Denied,如下所示.

我的完整项目在GitHub可用

MainApplication.java

@EnableSwagger2
@SpringBootApplication
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
@RestController
public class MainApplication /*extends WebMvcConfigurerAdapter*/
{

    public static void main(String[] args)
    {
        SpringApplication.run(MainApplication.class, args);
    }

    @RequestMapping("/user")
    public Principal user(Principal user) {
        return user;
    }

    @Bean
    SecurityConfiguration security() {
      return SecurityConfigurationBuilder.builder()//<19>
          .clientId("test-app-client-id")
          .build();
    }

    @Bean
    SecurityScheme oauth() {
          List<GrantType> grantTypes = new ArrayList<>();
          ImplicitGrant implicitGrant = new ImplicitGrant(new LoginEndpoint("http://localhost:8080/oauth/authorize"),"access_code"); …
Run Code Online (Sandbox Code Playgroud)

java oauth-2.0 spring-boot swagger-2.0 springfox

7
推荐指数
1
解决办法
1697
查看次数

AngularJS - 在jasmine测试用例中模拟ngTableParams

我已经使用ng-table创建了一个应用程序,该应用程序工作正常,但当我写一个茉莉花测试用例时,我得到了.

Error: [$injector:unpr] Unknown provider: TableParamsProvider
Run Code Online (Sandbox Code Playgroud)

任何人都可以告诉我如何模拟ngTableParams和测试其功能

我的代码如下所示

茉莉花测试案例

describe('Testing Controllers', function() {
    describe('Testing WorkController Controller', function() {
        var WorkController, $scope;

        beforeEach(module('wsd.workstations'));

        beforeEach(inject(function($controller, $rootScope) {
            $scope = $rootScope.$new();
            WorkController = $controller('WorkController', {
                $rootScope: $rootScope,
                $scope: $scope
            });
        }));

        it('should searchDocuments when searchDocuments() is called', function() {
            $scope.searchDocuments();
        });
    });
});
Run Code Online (Sandbox Code Playgroud)

脚本

angular.module('wsd', ['restangular', 'ngTable', 'wsd.models', 'wsd.workstations', 'wsd.workperiods', 'ngRoute'])

.config(function(RestangularProvider, $routeProvider) {
    RestangularProvider.setBaseUrl('/rest/myuser');

    $routeProvider.when('/wd', {
        templateUrl: 'main/workstation/main.tpl.html',
        controller: 'WorkController',
        resolve: {
            myWorkDocuments: function(Documents) {
                return Documents.getWorkDocuments();
            }
        }
    }).when('/wp', …
Run Code Online (Sandbox Code Playgroud)

javascript jasmine angularjs ngtable karma-jasmine

6
推荐指数
1
解决办法
2292
查看次数

我们在bootstrap中有任何Group框吗?

在我的一个应用程序中,我们需要一个类似于功能的组合框,如下图所示,我们正在使用Twitter Bootstrap 3 css.我已经搜索过Bootstrap 3中是否有任何类似的功能,但找不到任何功能,我不知道我是否遗漏了任何功能,因为我已经创建了自己的css来创建这样的结构,但似乎没那么好.

任何人都可以在Bootstrap 3中告诉我任何这样的组件

CSS

table {
    border-collapse:separate;
    border:solid #2e6da4 1px;
    border-radius:6px;
    -moz-border-radius:6px;
}

td, th {

    border-left:solid #2e6da4 1px;
    border-top:solid #2e6da4 1px;
}

th {
    background-color: #337ab7;
    border-top: none;
}

td:first-child {
     border-left: none;
}
Run Code Online (Sandbox Code Playgroud)

的jsfiddle

在此输入图像描述

html css groupbox twitter-bootstrap

6
推荐指数
1
解决办法
2万
查看次数

如何使用Spring4 Java配置转换站点管理器xml配置

我正在将基于旧版本的Spring应用程序转换为基于注释的Spring4应用程序.作为第一步,我将所有xmls转换为基于java配置的注释.应用程序运行正常,但唯一的问题是站点管理器xml配置.我不知道如何将web.xml中的以下siteminder配置转换为基于java的.

<login-config>
   <auth-method>CLIENT-CERT</auth-method>
   <realm-name>SiteMinderRealm</realm-name>
</login-config>
Run Code Online (Sandbox Code Playgroud)

上面的siteminder配置在web.xml中,

谁能告诉我如何在AppInitializer.java中为上面的xml编写基于java的配置

我的web.xml及其相应的替代AppInitializer.java代码如下所示

web.xml中

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
        http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="WebApp_ID" version="3.0">

    <display-name>SpringWebMVCApp</display-name>
    <context-param>
        <param-name>contextClass</param-name>
        <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
    </context-param>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>com.helloworld.config.AppConfig</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <servlet>
        <servlet-name>DispatcherServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextClass</param-name>
            <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>DispatcherServlet</servlet-name>
        <url-pattern>/rest/</url-pattern>
    </servlet-mapping>

    <login-config>
        <auth-method>CLIENT-CERT</auth-method>
        <realm-name>SiteMinderRealm</realm-name>
    </login-config>
</web-app>
Run Code Online (Sandbox Code Playgroud)

AppInitializer.java

public class AppInitializer implements WebApplicationInitializer {
    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        WebApplicationContext context = getContext();
        servletContext.addListener(new ContextLoaderListener(context));
        ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet", new …
Run Code Online (Sandbox Code Playgroud)

java spring annotations siteminder spring-4

6
推荐指数
1
解决办法
557
查看次数

基于条件的列数

我已经创建了一个oracle查询,如下所示,查询工作正常,但问题是我想要一个更多列,这是名称的计数,其中类别应为A,id应为1

SELECT name, velocity, COUNT(*) AS count, category FROM section GROUP BY name, velocity
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

任何人都可以告诉我一些解决方案

oracle count

6
推荐指数
1
解决办法
2万
查看次数

单击复选框时,可扩展和可折叠功能正在运行

我用了创建了一个表jquery datatable.我也使用响应功能,datatable使其响应.代码工作正常,但我面临的问题是表的第一列有一个复选框,当我们将表宽度调整为较小宽度时,可折叠选项将如下所示

在此输入图像描述

现在,当我们点击checkbox可折叠功能正在运行时.

我的代码如下所示

工作演示

<table id="example" class="table table-striped table-hover dt-responsive display nowrap" cellspacing="0"> 
        <thead>
            <tr>
                <th></th>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td><input type="checkbox"></td>
                <td>Tiger Nixon</td>
                <td>System Architect</td>
                <td>Edinburgh</td>
                <td>61</td>
                <td>2011/04/25</td>
                <td>$320,800</td>
            </tr>
            <tr>
                <td><input type="checkbox"></td>
                <td>Garrett Winters</td>
                <td>Accountant</td>
                <td>Tokyo</td>
                <td>63</td>
                <td>2011/07/25</td>
                <td>$170,750</td>
            </tr>
            :
        </tbody>
   </table>

<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/plug-ins/a5734b29083/integration/bootstrap/3/dataTables.bootstrap.js"></script>
<script src="dataTables.responsive.js" type="text/javascript"></script>
<script>
    $(document).ready(function () {
        $('#example')
                .DataTable({
                    "responsive": true, …
Run Code Online (Sandbox Code Playgroud)

html html-table datatables responsive-design

6
推荐指数
2
解决办法
1706
查看次数

如何禁用 dev 和 stg 环境的 Quartz 调度程序

我有三个环境 dev、stg 和 prod 服务器。我有一个微服务项目,它有石英调度程序,用于以电子邮件形式发送每日报告。石英配置如下:

现在的问题是我希望用于发送每日报告邮件的石英调度程序仅在产品环境服务器上注册和运行。我不希望调度程序在 stg 和开发环境服务器下执行。

我正在使用 AWS ec2 实例作为环境服务器

谁能告诉我该怎么做。我们是否有任何简单的配置可以实现此目的

自动装配SpringBeanJobFactory.java

public final class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory implements ApplicationContextAware {

    private transient AutowireCapableBeanFactory beanFactory;

    @Override
    public void setApplicationContext(final ApplicationContext context) {
        beanFactory = context.getAutowireCapableBeanFactory();
    }

    @Override
    protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception {
        final Object job = super.createJobInstance(bundle);
        beanFactory.autowireBean(job);
        return job;
    }
}
Run Code Online (Sandbox Code Playgroud)

QuartzConfiguration.java

@Configuration
@ConditionalOnProperty(name = "quartz.enabled")
public class QuartzConfiguration {

    @Autowired
    List<Trigger> listOfTrigger;

    @Bean
    public JobFactory jobFactory(ApplicationContext applicationContext) {
        AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory(); …
Run Code Online (Sandbox Code Playgroud)

java quartz-scheduler spring-boot

6
推荐指数
2
解决办法
2万
查看次数