laravel 5.8 blade模板里的 @extends 和@push 标签,编辑页面没有解析成功,但是列表页却能够正常解析,新手求大佬解答 200C

create 页面

@extends('back.app')
@push('X-CSRF-TOKEN')
<meta name="csrf-token" content="{{ csrf_token() }}">
@endpush
@push('remodal_css')
<!-- remodal-->
<link rel="stylesheet" href="{{asset('/remodal/remodal-default-theme.css')}}">
<link rel="stylesheet" href="{{asset('/remodal/remodal.css')}}">
@endpush
@section('content')
<style>
    .skin-blue .sidebar-form input[type="text"], .skin-blue .sidebar-form .btn{
        background-color: #fff;
    }
</style>
<div class="row">
    <form action="{{route('menu.store')}}" method="post" class="form_single">
        @csrf
        <div class="box">
            <div class="box-body">
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label>{{trans('common.list_name')}}</label>
                            <input class="form-control" name="name" placeholder="{{trans('common.menu_name')}}" value="{{get_fit_val($data,'name')}}" type="text">
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="form-group">
                            <label>{{trans('common.sort')}}</label>
                            <input class="form-control" name="sort" placeholder="{{trans('common.sort')}}" value="{{get_fit_val($data,'sort')}}" type="text">
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="form-group">
                            <label>{{trans('common.route')}}</label>
                            <input class="form-control" name="route" placeholder="{{trans('common.menu_route')}}" value="{{get_fit_val($data,'route')}}" type="text">

                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="form-group">
                            <label>{{trans('common.up_menu')}}</label>
                            <select name="pid" class="form-control">
                                <option value="0">{{trans('common.top_menu')}}</option>
                                @foreach ($data['sel_menu'] as $v)
                                <option value="{{$v['id']}}" @if (get_fit_val($data,'pid') == $v['id']) selected @endif>{!!$v['name']!!}</option>
                                @endforeach
                            </select>
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="form-group">
                            <label>{{trans('common.icon')}}</label>
                            @include('back.layouts.icon')
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="form-group">
                            <label>{{trans('common.is_show')}}</label>
                            <div style="height:34px;line-height: 34px;">
                                <label class="margin-r-5"><input type="radio" name="is_show" value="1" @if(get_fit_val($data,'is_show')==1 or get_fit_val($data,'status')=='') checked @endif> {{trans('common.yes')}}</label>
                                <label><input type="radio" name="is_show"  value="2" @if(get_fit_val($data,'is_show')==2) checked @endif> {{trans('common.no')}}</label>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="form-group">
                            <label>{{trans('common.status')}}</label>
                            <div>
                                <label class="margin-r-5"><input type="radio" name="status" value="1" @if(get_fit_val($data,'status')==1 or get_fit_val($data,'status')=='') checked @endif> {{trans('common.enable')}}</label>
                                <label><input type="radio" name="status"  value="2" @if(get_fit_val($data,'status')==2) checked @endif> {{trans('common.forbidden')}}</label>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
            <div class="box-footer">

                <input type="hidden" name="id" value="{{get_fit_val($data,'id')}}"/>

                <button  type="submit" class="btn btn-primary margin" data-style="slide-up" target-form="form_single">
                    <span class="ladda-label"><i class="fa fa-send"></i> {{trans('common.comfirm_space')}}</span>
                </button>

                <a class="btn btn-primary margin" href="{{go_back()}}"><i class="fa fa-history"></i> {{trans('common.back_space')}}</a>

            </div>
        </div>
    </form>
</div>
@endsection
@push('remodal_scripts')
<script src="{{asset('/remodal/remodal.min.js')}}"></script>
@endpush

继承的模板

<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>AdminLTE 2 | Starter</title>
        <!-- Tell the browser to be responsive to screen width -->
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        @stack('X-CSRF-TOKEN')
        <link rel="stylesheet" href="{{asset('/adminlte/bower_components/bootstrap/dist/css/bootstrap.min.css')}}">
        <!-- Font Awesome -->
        <link rel="stylesheet" href="{{asset('/adminlte/bower_components/font-awesome/css/font-awesome.min.css')}}">
        @stack('datepicker_css')
        @stack('datatable_css')
        @stack('remodal_css')
        <!-- Ionicons -->
        <link rel="stylesheet" href="{{asset('/adminlte/bower_components/Ionicons/css/ionicons.min.css')}}">
        <!-- Theme style -->
        <link rel="stylesheet" href="{{asset('/adminlte/dist/css/AdminLTE.min.css')}}">
        <!-- AdminLTE Skins. We have chosen the skin-blue for this starter
              page. However, you can choose any other skin. Make sure you
              apply the skin class to the body tag so the changes take effect. -->
        <link rel="stylesheet" href="{{asset('/adminlte/dist/css/skins/skin-blue.min.css')}}">

        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->

        <!-- Google Font -->
        <link rel="stylesheet"
              href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
        <!-- jQuery 3 -->
        <script src="{{asset('/adminlte/bower_components/jquery/dist/jquery.min.js')}}"></script>
        <!-- Bootstrap 3.3.7 -->
        <script src="{{asset('/adminlte/bower_components/bootstrap/dist/js/bootstrap.min.js')}}"></script>
        <!-- AdminLTE App -->
        <script src="{{asset('/adminlte/dist/js/adminlte.min.js')}}"></script>
    </head>
    <!--
    BODY TAG OPTIONS:
    =================
    Apply one or more of the following classes to get the
    desired effect
    |---------------------------------------------------------|
    | SKINS         | skin-blue                               |
    |               | skin-black                              |
    |               | skin-purple                             |
    |               | skin-yellow                             |
    |               | skin-red                                |
    |               | skin-green                              |
    |---------------------------------------------------------|
    |LAYOUT OPTIONS | fixed                                   |
    |               | layout-boxed                            |
    |               | layout-top-nav                          |
    |               | sidebar-collapse                        |
    |               | sidebar-mini                            |
    |---------------------------------------------------------|
    -->
    <body class="hold-transition skin-blue sidebar-mini">
        <div class="wrapper">


            @include('back.layouts.header')

            @include('back.layouts.sidebar')

            <!-- Content Wrapper. Contains page content -->
            <div class="content-wrapper">

                <!-- Content Header (Page header) -->
                <section class="content-header">
                    @include('back.layouts.tip')
                    <h1>
                        Page Header
                        <small>Optional description</small>
                    </h1>
                    <!--                    <ol class="breadcrumb">
                                            <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li>
                                            <li class="active">Here</li>
                                        </ol>-->
                </section>

                <!-- Main content -->
                <section class="content container-fluid">

                    @yield('content')

                </section>
                <!-- /.content -->
            </div>
            <!-- /.content-wrapper -->


            @include('back.layouts.footer')

            <!-- Control Sidebar -->
            <aside class="control-sidebar control-sidebar-dark">
                <!-- Create the tabs -->
                <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
                    <li class="active"><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
                    <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
                </ul>
                <!-- Tab panes -->
                <div class="tab-content">
                    <!-- Home tab content -->
                    <div class="tab-pane active" id="control-sidebar-home-tab">
                        <h3 class="control-sidebar-heading">Recent Activity</h3>
                        <ul class="control-sidebar-menu">
                            <li>
                                <a href="javascript:;">
                                    <i class="menu-icon fa fa-birthday-cake bg-red"></i>

                                    <div class="menu-info">
                                        <h4 class="control-sidebar-subheading">Langdon's Birthday</h4>

                                        <p>Will be 23 on April 24th</p>
                                    </div>
                                </a>
                            </li>
                        </ul>
                        <!-- /.control-sidebar-menu -->

                        <h3 class="control-sidebar-heading">Tasks Progress</h3>
                        <ul class="control-sidebar-menu">
                            <li>
                                <a href="javascript:;">
                                    <h4 class="control-sidebar-subheading">
                                        Custom Template Design
                                        <span class="pull-right-container">
                                            <span class="label label-danger pull-right">70%</span>
                                        </span>
                                    </h4>

                                    <div class="progress progress-xxs">
                                        <div class="progress-bar progress-bar-danger" style="width: 70%"></div>
                                    </div>
                                </a>
                            </li>
                        </ul>
                        <!-- /.control-sidebar-menu -->

                    </div>
                    <!-- /.tab-pane -->
                    <!-- Stats tab content -->
                    <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
                    <!-- /.tab-pane -->
                    <!-- Settings tab content -->
                    <div class="tab-pane" id="control-sidebar-settings-tab">
                        <form method="post">
                            <h3 class="control-sidebar-heading">General Settings</h3>

                            <div class="form-group">
                                <label class="control-sidebar-subheading">
                                    Report panel usage
                                    <input type="checkbox" class="pull-right" checked>
                                </label>

                                <p>
                                    Some information about this general settings option
                                </p>
                            </div>
                            <!-- /.form-group -->
                        </form>
                    </div>
                    <!-- /.tab-pane -->
                </div>
            </aside>
            <!-- /.control-sidebar -->
            <!-- Add the sidebar's background. This div must be placed
            immediately after the control sidebar -->
            <div class="control-sidebar-bg"></div>
        </div>
        <!-- ./wrapper -->

        <!-- REQUIRED JS SCRIPTS -->



        @stack('datepicker_scripts')        

        @stack('datatable_scripts') 

        @stack('remodal_scripts') 
        <script src="{{asset('/admin/js/common.js')}}"></script>
        <!-- Optionally, you can add Slimscroll and FastClick plugins.
             Both of these plugins are recommended to enhance the
             user experience. -->
    </body>
</html>

create 页面效果

list 页面效果
图片说明

m0_37389701
宇宙无敌大大 我已经知道问题原因了,原来是因为我在编辑页面里的返回按钮 go_back函数里 echo javascript:history.back(-1) 之后加了exit 所导致的
3 个月之前 回复

2个回答

试试将create 页面的html标签加上呢

m0_37389701
宇宙无敌大大 我用的是资源路由 Route::resource('admin/menu', 'Back\MenuController', ['only' => [ 'index', 'create', 'store','edit', 'update', 'destroy' ]]);
3 个月之前 回复
m0_37389701
宇宙无敌大大 加上html 就会报错 The GET method is not supported for this route. Supported methods: PUT, PATCH, DELETE.
3 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
spring boot mybatis 枚举错误,无法映射
spring boot mybatis 枚举错误 * 今天遇到一个问题,解决了好几个小时,没有搞定,搞到现在,有大佬可以帮我看下吗?万分感谢,没有分了,枚举映射,在idea中可以使用, 部署使用java -jar 方式就报错 * jdk1.8 * mybatis3.0.7.1 * application.yml环境为prod * ``` mybatis-plus: #枚举 typeHandlersPackage: com.xxx.common.module.handler ``` 1. Enum代码 ``` /** * Enum - 状态 * * @author xxx * @version 1.0.0 */ @JSONType(serializeEnumAsJavaBean = true) @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum StatusEnum implements BaseEnum<StatusEnum, Integer> { /** 删除 */ 删除(-1, "删除"), /** 无效 */ 无效(0, "无效"), /** 有效 */ 有效(1, "有效"); /** * 值. */ private Integer value; /** * 名称. */ private String name ; static { subClass.add(StatusEnum.class); } StatusEnum(Integer value, String name) { this.value = value; this.name = name; } @Override public Integer getValue() { return value; } public void setValue(Integer value) { this.value = value; } @Override public String getName() { return name; } public void setName(String name) { this.name = name; } //根据key获取枚举 public static StatusEnum getEnumByValue(Integer value){ if (null == value){ return null; } for(StatusEnum e: StatusEnum.values()){ if(e.getValue().equals(value)){ return e; } } return null; } } ``` 2. 枚举转换处理器 ``` package com.xxx.common.module.handler; import com.xxx.common.module.enums.*; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.type.BaseTypeHandler; import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.MappedTypes; import java.sql.CallableStatement; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; /** * 枚举转换处理器 * * @author xxx * @version 1.0.0 */ @Slf4j @MappedTypes(value = {StatusEnum.class}) public final class BaseEnumTypeHandler<E extends BaseEnum> extends BaseTypeHandler<E> { private Class<E> type; private E[] enums; public BaseEnumTypeHandler() { } public BaseEnumTypeHandler(Class<E> type) { if (type == null) { throw new IllegalArgumentException("Type argument cannot be null"); } this.type = type; this.enums = this.type.getEnumConstants(); if (this.enums == null) { throw new IllegalArgumentException(type.getSimpleName() + " does not represent an enum type."); } } @Override public void setNonNullParameter(PreparedStatement ps, int i, E parameter, JdbcType jdbcType) throws SQLException { //BaseTypeHandler 进行非空校验 log.debug("index : {}, parameter : {},jdbcType : {} ", i, parameter.getValue(), jdbcType); if (jdbcType == null) { ps.setObject(i, parameter.getValue()); } else { ps.setObject(i, parameter.getValue(), jdbcType.TYPE_CODE); } } @Override public E getNullableResult(ResultSet rs, String columnName) throws SQLException { Object code = rs.getObject(columnName); if (rs.wasNull()) { return null; } return getEnmByCode(code); } @Override public E getNullableResult(ResultSet rs, int columnIndex) throws SQLException { Object code = rs.getObject(columnIndex); if (rs.wasNull()) { return null; } return getEnmByCode(code); } @Override public E getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { Object code = cs.getObject(columnIndex); if (cs.wasNull()) { return null; } return getEnmByCode(code); } private E getEnmByCode(Object code) { if (code == null) { throw new NullPointerException("the result code is null " + code); } if (code instanceof Integer) { for (E e : enums) { if (e.getValue() == code) { return e; } } throw new IllegalArgumentException("Unknown enumeration type , please check the enumeration code : " + code); } if (code instanceof String) { for (E e : enums) { if (code.equals(e.getValue())) { return e; } } throw new IllegalArgumentException("Unknown enumeration type , please check the enumeration code : " + code); } throw new IllegalArgumentException("Unknown enumeration type , please check the enumeration code : " + code); } } ``` 3. 报错信息 2020-01-20 02:45:35.879 ERROR 2472 --- [nio-8081-exec-1] c.l.exception.RRExceptionHandler : nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'status' from result set. Cause: java.lang.IllegalArgumentException: No enum constant com.xxx.common.module.enums.StatusEnum.1 * org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'status' from result set. Cause: java.lang.IllegalArgumentException: No enum constant com.xxx.common.module.enums.StatusEnum.1 * at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77) * at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) * at com.sun.proxy.$Proxy132.selectList(Unknown Source) * at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230) * at com.baomidou.mybatisplus.core.override.PageMapperMethod.executeForMany(PageMapperMethod.java:173) * at com.baomidou.mybatisplus.core.override.PageMapperMethod.execute(PageMapperMethod.java:86) * at com.baomidou.mybatisplus.core.override.PageMapperProxy.invoke(PageMapperProxy.java:64) * at com.sun.proxy.$Proxy137.selectList(Unknown Source) * at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.getOne(ServiceImpl.java:259) * at com.baomidou.mybatisplus.extension.service.IService.getOne(IService.java:230) * at com.xxx.common.module.service.impl.AppServiceImpl.queryByAppKey(AppServiceImpl.java:100) * at com.xxx.common.module.service.impl.AppServiceImpl$$FastClassBySpringCGLIB$$9380a940.invoke(<generated>) * at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) * at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684) * at com.xxx.common.module.service.impl.AppServiceImpl$$EnhancerBySpringCGLIB$$307b01.queryByAppKey(<generated>) * at com.xxx.common.module.service.impl.AppInfoServiceImpl.validateBaseApi(AppInfoServiceImpl.java:141) * at com.xxx.common.module.service.impl.AppInfoServiceImpl.appInfo(AppInfoServiceImpl.java:157) * at com.xxx.common.module.service.impl.AppInfoServiceImpl$$FastClassBySpringCGLIB$$2bb67632.invoke(<generated>) * at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) * at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684) * at com.xxx.common.module.service.impl.AppInfoServiceImpl$$EnhancerBySpringCGLIB$$8bd88917.appInfo(<generated>) * at com.xxx.controller.ApiAppProductController.list(ApiAppProductController.java:79) * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) * at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) * at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) * at java.lang.reflect.Method.invoke(Method.java:483) * at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) * at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) * at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) * at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) * at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) * at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) * at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) * at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) * at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) * at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908) * at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) * at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) * at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at com.xxx.common.xss.XssFilter.doFilter(XssFilter.java:24) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) * at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) * at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) * at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) * at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) * at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) * at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) * at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) * at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) * at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) * at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) * at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) * at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) * at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) * at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) * at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) * at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) * at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417) * at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) * at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) * at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) * at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) * at java.lang.Thread.run(Thread.java:745) * Caused by: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'status' from result set. Cause: java.lang.IllegalArgumentException: No enum constant com.xxx.common.module.enums.StatusEnum.1 * at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:68) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyAutomaticMappings(DefaultResultSetHandler.java:520) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:401) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:355) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:330) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:303) * at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:196) * at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64) * at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) * at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) * at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) * at java.lang.reflect.Method.invoke(Method.java:483) * at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) * at com.sun.proxy.$Proxy200.query(Unknown Source) * at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) * at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326) * at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) * at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:136) * at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) * at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) * at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) * at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) * at java.lang.reflect.Method.invoke(Method.java:483) * at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) * ... 77 common frames omitted * Caused by: java.lang.IllegalArgumentException: No enum constant com.xxx.common.module.enums.StatusEnum.1 * at java.lang.Enum.valueOf(Enum.java:238) * at org.apache.ibatis.type.EnumTypeHandler.getNullableResult(EnumTypeHandler.java:49) * at org.apache.ibatis.type.EnumTypeHandler.getNullableResult(EnumTypeHandler.java:26) * at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:66) * ... 102 common frames omitted
大佬们 菜鸟问两个php的问题(继承方面)
1·extends和use有什么区别? 比如我这个4继承1 ``` use think\Controller; use think\Request; use app\test1\Controller\Ctrl1; class Ctrl4 extends Ctrl1 { public function index(){ //some code here... } } ``` 2·不实例化怎么操作父类的属性和非静态方法
将mybatis的mapper作为参数传递,通过反射调用,请问该如何处理了?
我必须得将mapper作为参数来进行传递,在进行反射调用方法的时候,就会报错。请问这种情况我该如何处理,才能够实现这一要求了? ``` @Configuration @EnableScheduling public class aaa { // Mapper是个接口 @Autowired private TestMapper testpMapper; @Scheduled(cron = "0/5 * * * * ?") private void createOrderTableTime() { // try { // determineCreateTable((Class<? extends BaseMapper>) Class.forName(testMapper.getClass().getName())); determineCreateTable(testMapper.getClass()); // } catch (ClassNotFoundException e) { // e.printStackTrace(); // } } // public void determineCreateTable(Class<? extends BaseMapper> tableMapper) { public void determineCreateTable(Class tableMapper) { try { Method method = tableMapper.getDeclaredMethod("count", String.class); // 这种是可行的 // int count = (int) method.invoke(testMapper, "100001"); // int count = (int) method.invoke(tableMapper, "100001"); // 在进行实例化的时候会产生错误 int count = (int) method.invoke(tableMapper.newInstance(), "100001"); System.out.println(count); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) { e.printStackTrace(); } } } 报错信息如下: java.lang.IllegalArgumentException: object is not an instance of declaring class java.lang.InstantiationException: com.sun.proxy.$Proxy88 ```
求大神 android搜索Mysql的内容,int java.util.List.size()错误
安卓开发初学者,本想做一个能搜索数据的小程序, 但是就各种不顺利,帮忙看看哪里出现了错误。 开发环境 Android Studio 3.5.2+XAMPP 3.2.4(Mysql+Apache)+PHP 错误信息 ``` 2019-11-29 14:04:26.591 1398-1398/com.uchiyama.livesearch E/AndroidRuntime: FATAL EXCEPTION: main Process: com.uchiyama.livesearch, PID: 1398 java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference at com.uchiyama.livesearch.Adapter.getItemCount(Adapter.java:39) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:4044) at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:3534) at android.view.View.measure(View.java:19785) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure(View.java:19785) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6120) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143) at android.view.View.measure(View.java:19785) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6120) at androidx.appcompat.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:403) at android.view.View.measure(View.java:19785) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6120) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure(View.java:19785) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6120) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:758) at android.widget.LinearLayout.onMeasure(LinearLayout.java:640) at android.view.View.measure(View.java:19785) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6120) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:690) at android.view.View.measure(View.java:19785) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2275) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1362) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1611) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1250) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6311) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:871) at android.view.Choreographer.doCallbacks(Choreographer.java:683) at android.view.Choreographer.doFrame(Choreographer.java:619) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:241) at android.app.ActivityThread.main(ActivityThread.java:6217) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) ``` 我的代码 ``` package com.uchiyama.livesearch; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import java.util.List; public class Adapter extends RecyclerView.Adapter<Adapter.MyViewHolder> { private List<Users> users; private Context context; public Adapter(List<Users> users, Context context) { this.users = users; this.context = context; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.item,parent,false); return new MyViewHolder(view); } @Override public void onBindViewHolder(MyViewHolder holder, int position) { holder.name.setText(users.get(position).getName()); holder.email.setText(users.get(position).getEmail()); } @Override public int getItemCount() { return users.size(); //在这里报错 } public static class MyViewHolder extends RecyclerView.ViewHolder { TextView name,email; public MyViewHolder(View itemView) { super(itemView); name=itemView.findViewById(R.id.name); email=itemView.findViewById(R.id.email); } } } ```
这个是关于定位的,在最后那里无法重写onConnectHotSpotMessage(String var1, int var2)运行结果如图
![图片说明](https://img-ask.csdn.net/upload/202001/11/1578739174_745938.png) 代码如下:package com.example.lbstest; import android.Manifest; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.location.Location; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; import android.widget.Toast; import com.baidu.location.BDLocation; import com.baidu.location.BDLocationListener; import com.baidu.location.LocationClient; import com.baidu.mapapi.map.BaiduMap; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { public LocationClient mLocationClient; private TextView positionText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mLocationClient = new LocationClient(getApplicationContext()); mLocationClient.registerLocationListener(new MyLocationListener()); setContentView(R.layout.activity_main); positionText = (TextView) findViewById(R.id.position_text_view); List<String> permissionList = new ArrayList<>(); if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { permissionList.add(Manifest.permission.ACCESS_FINE_LOCATION); } if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { permissionList.add(Manifest.permission.READ_PHONE_STATE); } if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { permissionList.add(Manifest.permission.WRITE_EXTERNAL_STORAGE); } if (!permissionList.isEmpty()) { String[] permissions = permissionList.toArray(new String[permissionList.size()]); ActivityCompat.requestPermissions(MainActivity.this, permissions, 1); mLocationClient.start(); } else { requestLocation(); } } private void requestLocation() { mLocationClient.start(); } @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { switch (requestCode){ case 1:if (grantResults.length>0){ for (int result:grantResults){ if (result!=PackageManager.PERMISSION_GRANTED){ Toast.makeText(this,"必须同意所有权限才能使用本程序",Toast.LENGTH_SHORT).show(); finish(); return; } } requestLocation(); }else { Toast.makeText(this,"发生未知错误",Toast.LENGTH_SHORT).show(); finish(); } break; default: } } public class MyLocationListener implements BDLocationListener { @Override public void onReceiveLocation( final BDLocation bdLocation) { runOnUiThread(new Runnable() { @Override public void run() { StringBuilder currentPosition = new StringBuilder(); currentPosition.append("纬度:").append(bdLocation.getLatitude()).append("/n"); currentPosition.append("经度:").append(bdLocation.getLongitude()).append("/n"); currentPosition.append("定位方式:"); if (bdLocation.getLocType() == BDLocation.TypeGpsLocation) { currentPosition.append("GPS"); } else if (bdLocation.getLocType() == BDLocation.TypeNetWorkLocation) { currentPosition.append("网络"); } positionText.setText(currentPosition); } }); } } }
SpringBoot Security 在用了动态权限配置后权限继承(RoleHierarchy)失效
在使用hasRole("admin")这种方式配置权限时使用RoleHierarchy实现权限继承 是可以的,但是使用了数据库动态配置权限后继承失效,amdin不能访问user 下的接口了 ``` @Configuration @Slf4j public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired SysUserServiceImpl sysUserService; @Bean PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { log.info("run custom user service"); auth.userDetailsService(sysUserService); } @Override protected void configure(HttpSecurity http) throws Exception { log.info("run security configuation"); http.authorizeRequests() // .antMatchers("/admin/**").hasRole("admin") // .antMatchers("/menu/**").hasRole("user") // .antMatchers("/user/**").hasRole("user") .withObjectPostProcessor(new ObjectPostProcessor<FilterSecurityInterceptor>() { @Override public <O extends FilterSecurityInterceptor> O postProcess(O object) { object.setSecurityMetadataSource(cfisms()); object.setAccessDecisionManager(cadm()); return object; } }) .and() .formLogin() .loginProcessingUrl("/login").permitAll() .and() .csrf().disable(); } @Bean RoleHierarchy roeHierarchy() { RoleHierarchyImpl roeImpl = new RoleHierarchyImpl(); String hierarchy = "ROLE_admin > ROLE_user"; roeImpl.setHierarchy(hierarchy); return roeImpl; } @Bean CustomFilterInvocationSecurityMetadataSource cfisms() { return new CustomFilterInvocationSecurityMetadataSource(); } @Bean CustomAccessDecisionManager cadm() { return new CustomAccessDecisionManager(); } } ``` user ``` @Component @Slf4j public class SysUser implements Serializable,UserDetails{ /** * */ private static final long serialVersionUID = 1L; private String id; private String username; private String password; private String trueName; private String note; private String avator; private String tel; private String address; private Integer pageNo; private Integer pageSize; private List<Role> roles; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { log.info("password:"+password); return password; } public void setPassword(String password) { this.password = password; } public String getTrueName() { return trueName; } public void setTrueName(String trueName) { this.trueName = trueName; } public String getNote() { return note; } public void setNote(String note) { this.note = note; } public String getAvator() { return avator; } public void setAvator(String avator) { this.avator = avator; } public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public Integer getPageNo() { return pageNo; } public void setPageNo(Integer pageNo) { this.pageNo = pageNo; } public Integer getPageSize() { return pageSize; } public void setPageSize(Integer pageSize) { this.pageSize = pageSize; } public List<Role> getRoles() { return roles; } public void setRoles(List<Role> roles) { this.roles = roles; } public static long getSerialversionuid() { return serialVersionUID; } @Override public String toString() { // TODO Auto-generated method stub return SysUser.class.getName().toString(); } // security getter and setter @Override public Collection<? extends GrantedAuthority> getAuthorities() { // get user permissions that already have List<SimpleGrantedAuthority> authorities = new ArrayList<>(); for(Role role : roles) { authorities.add(new SimpleGrantedAuthority(role.getRole())); log.info(role.getRole()); } return authorities; } @Override public boolean isAccountNonExpired() { // TODO Auto-generated method stub return true; } @Override public boolean isAccountNonLocked() { // TODO Auto-generated method stub return true; } @Override public boolean isCredentialsNonExpired() { // TODO Auto-generated method stub return true; } @Override public boolean isEnabled() { // TODO Auto-generated method stub return true; } } ``` 自定义FilterInvocationMetadataSource ``` @Component @Slf4j public class CustomFilterInvocationSecurityMetadataSource implements FilterInvocationSecurityMetadataSource { AntPathMatcher antPathMatcher = new AntPathMatcher(); @Autowired ServiceUrlMapper serviceUrlMapper; @Override public Collection<ConfigAttribute> getAttributes(Object object) throws IllegalArgumentException { //use AntPathMatcher matching rule String requestUrl = ((FilterInvocation)object).getRequestUrl(); log.info("request url:"+requestUrl); //select all service url List<ServiceUrl> urls = serviceUrlMapper.select(); for(ServiceUrl url : urls) { if(antPathMatcher.match(url.getUrl(), requestUrl)) { List<Role>roles = url.getRoles(); String[]roleArr = new String[roles.size()]; for(int i=0; i<roleArr.length; i++) { roleArr[i] = roles.get(i).getRole(); log.info("role:"+roleArr[i]); } //return role info return SecurityConfig.createList(roleArr); } } return SecurityConfig.createList("ROLE_LOGIN"); } @Override public Collection<ConfigAttribute> getAllConfigAttributes() { return null; } @Override public boolean supports(Class<?> clazz) { return FilterInvocation.class.isAssignableFrom(clazz); } } ``` 自定义AccessDecisionManager ``` @Component @Slf4j public class CustomAccessDecisionManager implements AccessDecisionManager { /** * decide current user permissions * @param authentication user login info * @param object FilterInvacation , it can obtain request info * @param configAttributes FilterInvocationSecurityMetadataSource return by getAttributes */ @Override public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes) throws AccessDeniedException, InsufficientAuthenticationException { Collection<? extends GrantedAuthority> auths = authentication.getAuthorities(); for(ConfigAttribute configAttribute : configAttributes) { //configAttributes from customFilterInvocationMetadataSource if("ROLE_LOGIN".equals(configAttribute.getAttribute())&&auths instanceof UsernamePasswordAuthenticationToken) { log.info("current user:ROLE_LOGIN"); return; } for(GrantedAuthority authority : auths) { log.info("authority:"+authority.getAuthority()); if(configAttribute.getAttribute().equals(authority.getAuthority())) { return; } } } throw new AccessDeniedException("权限不足"); } @Override public boolean supports(ConfigAttribute attribute) { // TODO Auto-generated method stub return true; } @Override public boolean supports(Class<?> clazz) { // TODO Auto-generated method stub return true; } } ``` 请问该怎么解决?
java引用jar包时指定版本号
例如一个.java文件,也就是一个类中 ``` package com.ceshi.action.base; import java.util.Map; import org.apache.struts2.interceptor.ApplicationAware; import org.apache.struts2.interceptor.RequestAware; import org.apache.struts2.interceptor.SessionAware; import com.opensymphony.xwork2.ActionSupport; public class StandardAction extends ActionSupport implements SessionAware, ApplicationAware, RequestAware { ``` 在import java.util.Map时可以指定个版本号,好比说这样: ``` import java.util.Map 2.5.18; ``` 这样就好了,如果每个.jar包文件里的类都这么写就没有版本问题了,多好.
java中super在什么情况下会表示自己本类或者起到this的作用??
在一般情况下我们知道super是指代超类(父类),但是在某些情况下,它又会代表自己本类起到this的作用 例如以下代码 ``` package test; import java.util.Date; public class Test extends Date{ public static void main(String[] args) { new Test().testq(); } public void testq() { System.out.println(this.getClass().getName()); System.out.println(super.getClass().getName()); System.out.println(getClass().getName()); System.out.println(getClass().getSuperclass().getName()); } } ``` 输出的结果为: ``` test.test test.test test.test java.util.Date ``` 从结果可见,在上方的super调用相当于this的作用,这是super遇上了某种特殊的情况,还是super得一些特例?? 我想请问一下各位大佬们,这种特殊情况该如何区分呢?还是只是有一些比较特定的方法??蟹蟹各位~~·
一个DaoImpl类,既想通过实现IDao接口达到通过接口调用的目的,又想通过继承抽象类,使用父类的通用方法。应该怎么做?
1、IDao.java ``` package cn.test; public interface IDao { public void Query(); } ``` 2、GeneralDao.java ``` package cn.test; public abstract class GeneralDao { public void generalDaoMethod() { System.out.println("调用generalDaoMethod方法"); } } ``` 3、DaoImpl.java ``` package cn.test; public class DaoImpl extends GeneralDao implements IDao { @Override public void Query() { System.out.println("调用接口的个性化查询方法"); } } ``` 4、我能想到的就是强转,但觉得不好。 App.java ``` package cn.test; public class App { public static void main(String[] args) { IDao dao=new DaoImpl(); dao.Query(); ((GeneralDao)dao).generalDaoMethod(); } } ``` 5、输出 ``` 调用接口的个性化查询方法 调用generalDaoMethod方法 ``` 有没有其他更好的方法可以实现既可通过接口调用,又可以使用父类的方法?
Java的死循环里的代码不执行
死循环里的代码不执行,但是在死循环里加个输出就执行,并且线程也没有退出 ``` package shendi.utils; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; /** * -问题 代码原封不动运行,two函数里的死循环感觉像是挂了一样 但是线程没有结束 不执行 * -但是在循环内加个输出,函数就没有问题,Why? */ public class Test extends JFrame implements Runnable { private String type; private static int i = 0; public Test() { JButton button = new JButton("i+1"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { i++; System.out.println("two函数的死循环就是不会被执行 + i现在是:"+i); } }); this.add(button); this.setBounds(10, 10,100,100); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setVisible(true); new Thread(new Test("1")).start(); new Thread(new Test("2")).start(); } public Test(String type) {this.type = type;} public static void main(String[] args) { new Test(); } private void one() { while (true) { // System.out.println(i); } } private void two() { System.out.println("two被调用了,线程 "); while (true) { if (1 == 2) break; // if (i == 0) System.out.println("i=0 two函数"); if (i > 1) System.out.println("我是活的"); } System.out.println("two挂了"); } public void run() { switch (type) { case "1": one(); break; case "2": two(); break; } } } ```
Django中静态文件的加载及模板中{% static %}标签的使用问题
本人用Django1.11,在模板中用{% static %}标签加载静态文件时遇到问题: ![index.html](https://img-ask.csdn.net/upload/201908/07/1565189787_945837.jpg) 如果把{% extends %}标签那行去掉,浏览器中访问这个主页时可以正常显示图片,js文件也能正常加载,不过一旦有{% extends %}标签继承模板,图片就不显示,js文件不加载,但是服务器也没报404。 项目设置如下: ![settings.py](https://img-ask.csdn.net/upload/201908/07/1565190482_335160.jpg) 有关于在开发环境中静态文件的设置都做了,静态文件放在了app名文件夹/static文件夹/app名文件夹下 ![图片说明](https://img-ask.csdn.net/upload/201908/07/1565190708_577727.jpg) 请问大神是哪里出了问题导致静态文件没有加载,谢谢!
无法通过 SlingHttpServletRequest.getParts() 获取文件的 parts 在 junit test
在进行这段代码的单元测试时, 这则 java method 但无法在测试的时候成功获取到文件的 parts. 在运行代码的时候,我却能通过 SlingHttpServletRequest.getParts()。提前感谢任何网友诺有遇过这样的问题能分享解决方式。 以下是我的 java 的代码示例: ``` @Model(adaptables = SlingHttpServletRequest.class) public class Comment { @Inject private CommentService service @PostConstruct public void setup() { requestData = new JSONObject(); for (String item : request.getRequestParameterMap().keySet()) { try { requestData.put(item, request.getParameter(item)); } catch (Exception e) { Throw error message } } //Upload attachment to server try {hang for (Part part : request.getParts()) { 《=在这行得到 error } catch (Exception e) { Throw error message } } } ``` 以下是测试过后得到的错误信息: ``` 14:53:04.918 [main] ERROR de.com.adsl.sightly.model.Comment - Error Message: null java.lang.UnsupportedOperationException: null at org.apache.sling.servlethelpers.MockSlingHttpServletRequest.getParts(MockSlingHttpServletRequest.java:882) ~[org.apache.sling.servlet-helpers-1.1.10.jar:?] at de.com.adsl.sightly.model.Comment.uploadFile(Feedback.java:137) ~[classes/:?] at de.com.adsl.sightly.model.Comment.setup(Feedback.java:82) [classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_201] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_201] at org.apache.sling.models.impl.ModelAdapterFactory.invokePostConstruct(ModelAdapterFactory.java:792) [org.apache.sling.models.impl-1.3.8.jar:?] at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:607) [org.apache.sling.models.impl-1.3.8.jar:?] at org.apache.sling.models.impl.ModelAdapterFactory.internalCreateModel(ModelAdapterFactory.java:335) [org.apache.sling.models.impl-1.3.8.jar:?] at org.apache.sling.models.impl.ModelAdapterFactory.getAdapter(ModelAdapterFactory.java:211) [org.apache.sling.models.impl-1.3.8.jar:?] ... ``` 以下是我的单元测试代码示例: ``` public class CommentTest { public final AemContext context = new AemContext(); private CommentService commentService = mock(CommentService.class); @InjectMocks private Comment comment; private static String PATH = "/content/testproject/en/page/sub-page"; @Before public void setUp() throws Exception { context.addModelsForPackage("de.com.adsl.sightly.model"); context.load().json("/components/textrte.json", PATH); context.currentPage(PATH); } @Test public void testSetup() throws IOException, ServletException { //before context.request().setParameterMap(getRequestCat1()); context.registerService(CommentService.class, commentService); Resource resource = context.resourceResolver().getResource(PATH + "/jcr:content/root/responsivegrid/textrte"); assertNotNull(resource); //when comment = new CustomRequest(context.request()).adaptTo(Comment.class); //then comment.setup(); } private class CustomRequest extends SlingHttpServletRequestWrapper { public CustomRequest(SlingHttpServletRequest request) { super(request); } @Override public Collection<Part> getParts() { final String mockContent = "------WebKitFormBoundarycTqA2AimXQHBAJbZ\n" + "Content-Disposition: form-data; name=\"key\"\n" + "\n" + "myvalue1\n" + "------WebKitFormBoundarycTqA2AimXQHBAJbZ"; final List<Part> parts = MockPart.parseAll(mockContent); assertNotNull(parts); return parts; } }; } } ```
Android studio 点击登录,提示停止运行,代码无报错
就只有点击按钮跳转activity功能,之前成功跳转,然后今天在跳转后的 界面添加了fragment功能,实现导航栏,然后就跳转不成功了,代码业务错误 点击按钮就停止运行 bt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent1=new Intent(MainActivity.this,actionActivity.class); startActivity(intent1); } }); 上面是点击跳转 下面是跳转后的界面代码 package com.example.denglujiemian; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import android.os.Bundle; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; import java.io.FileInputStream; public class actionActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_action); ImageView imageView1=(ImageView) findViewById(R.id.xl); ImageView imageView2=(ImageView) findViewById(R.id.lt); ImageView imageView3=(ImageView) findViewById(R.id.hy); ImageView imageView4=(ImageView) findViewById(R.id.wd); imageView1.setOnClickListener(l); imageView2.setOnClickListener(l); imageView3.setOnClickListener(l); imageView4.setOnClickListener(l); } View.OnClickListener l=new View.OnClickListener() { @Override public void onClick(View v) { FragmentManager fragmentManager=getSupportFragmentManager(); FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction(); Fragment fxian=null; switch (v.getId()){ case R.id.xl: fxian=new keep_Fragment(); break; case R.id.lt: fxian=new liaotianfrag_Fragment(); break; case R.id.hy: fxian=new haoyou_Fragment(); break; case R.id.wd: fxian=new shezhi_Fragment(); break; default: break; } fragmentTransaction.replace(R.id.frameyongqi,fxian); fragmentTransaction.commit(); } };
关于JavaFX Button 报错求助
我用idea创建了一个JavaFX项目,创建的项目里面自带一个Main类我在里面写以下代码: ``` package sample; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.stage.Stage; public class M extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { Button button=new Button("按钮"); button.setPrefHeight(200); button.setPrefWidth(200); Group group=new Group(); group.getChildren().add(button); Scene scene=new Scene(group); primaryStage.setScene(scene); primaryStage.setTitle("JavaFX"); primaryStage.setWidth(800); primaryStage.setHeight(800); primaryStage.show(); } } ``` 运行没有任何问题,但是我自己新建了一个JavaFX文件 TestButton.class同样使用上面的代码结果却在Button button=new Button("按钮");这里一直报错,网上也百度不到,求帮助。 下面是报错截图:![图片说明](https://img-ask.csdn.net/upload/201912/24/1577193788_186337.png)
JavaFX代码运行之后报错找不到或无法加载主类?
出现报错 错误: 找不到或无法加载主类 com.Test.MyJavaFX 原因: java.lang.NoClassDefFoundError: javafx/application/Application 附上代码 package com.Test; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.stage.Stage; public class MyJavaFX extends Application{ @Override public void start(Stage primaryStage) { Button btOK = new Button("OK"); Scene scene = new Scene(btOK, 200, 250); primaryStage.setTitle("MyJavaFX"); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { Application.launch(args); } }
运行mapredurce出现Method threw 'java.lang.IllegalStateException' exception. Cannot evaluate org.apache.hadoop.mapreduce.Job.toString()
执行下述代码后在,创建job后会有上述异常,但是可以执行到最后,但是job没有提交上去执行,在历史里也看不到有执行记录求帮助新手o(╥﹏╥)o。 package MapReducer; import com.sun.org.apache.bcel.internal.generic.RETURN; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.util.StringTokenizer; /** * @Describe MapReducer第一个读取文档并计数 * @Author zhanglei * @Date 2019/11/18 22:53 **/ public class WordCountApp extends Configured implements Tool { public int run(String[] strings) throws Exception { String input_path="hdfs://192.168.91.130:8020/data/wc.txt"; String output_path="hdfs://192.168.91.130:8020/data/outputwc"; Configuration configuration = getConf(); final FileSystem fileSystem = FileSystem.get(new URI(input_path),configuration); if(fileSystem.exists(new Path(output_path))){ fileSystem.delete(new Path(output_path),true); } Job job = Job.getInstance(configuration,"WordCountApp"); job.setJarByClass(WordCountApp.class); job.setMapperClass(WordCountMapper.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); job.setReducerClass(WordCountReducer.class); job.setInputFormatClass(TextInputFormat.class); Path inpath = new Path(input_path); FileInputFormat.addInputPath(job,inpath); job.setOutputFormatClass(TextOutputFormat.class); Path outpath = new Path(output_path); FileOutputFormat.setOutputPath(job,outpath); return job.waitForCompletion(true) ? 0:1; } //继承 public static class WordCountMapper extends Mapper<Object,Text,Text,IntWritable>{ private final static IntWritable one= new IntWritable(1); private Text word = new Text(); public void map(Object key,Text value,Context context) throws IOException, InterruptedException { Text t = value; StringTokenizer itr = new StringTokenizer(value.toString()); while(itr.hasMoreTokens()){ word.set(itr.nextToken()); context.write(word,one); } } } public static class WordCountReducer extends Reducer<Object,Text,Text,IntWritable>{ private final static IntWritable res= new IntWritable(1); public void reduce(Text key,Iterable<IntWritable> values,Context context) throws IOException, InterruptedException { int sum = 0; for(IntWritable val:values){ sum+=val.get(); } res.set(sum); context.write(key,res); } } public static void main(String[] args) throws Exception { int exitCode = ToolRunner.run(new WordCountApp(), args); System.exit(exitCode); } }
导入javascript模块后浏览器报错:net::ERR_ABORTED 404 (Not Found)
AFlowView.js: ``` export default class AFlowView extends HTMLElement { // ... } ``` index.html: ``` <script type="module" src="./core/AFlowView.js"></script> ``` 运行时报错: ![图片说明](https://img-ask.csdn.net/upload/202001/03/1578066093_573593.jpg)
idea部署Tomcat时servlet运行多次问题
在使用在部署Tomcat的时候,Servlet会运行三次(原来是两次,瞎鼓捣之后又变成3次了),具体代码如下: ``` package com.shop.C; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class Servlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException { System.out.println("post"); response.setContentType("text/html"); response.setCharacterEncoding("UTF-8"); } } ``` 然后这是控制台输出结果: ![图片说明](https://img-ask.csdn.net/upload/201912/10/1575949110_572415.png) 可以看到明显是运行了三次doPost。 因为需要使用servlet读取数据库数据并传递给jsp页面并刷新,第一次读取之后关闭了和数据库的连接,导致后面两次读取不到数据,在jsp页面便没有数据显示。 ps:这里想要解决的问题是Servlet为什么运行了三次,怎么解决,不是数据传递问题。
请问大神,java面向对象如何实现CompositeShape类,实现在控制台上绘制综合复杂图,该类中有一个成员变量为ArrayList类型的变量; 该变量用于保存复合形状的各种图形?
其他的类和接口都已经写好 不知道如何实现CompositeShape类来重写draw方法画图 ![图片说明](https://img-ask.csdn.net/upload/201911/23/1574498098_923795.png)![图片说明](https://img-ask.csdn.net/upload/201911/23/1574498109_903389.png) ```package cn.edu.swun.www.model; import cn.edu.swun.www.action.Drawable; import java.util.ArrayList; import java.util.Iterator; public class CompositeShape extends Shape implements Drawable { private ArrayList<Shape> shapes; public CompositeShape(String color,ArrayList<Shape> shapes){ this.color=color; this.shapes=shapes; } @Override public void draw(String penType) { } } @Override public double getArea() { return 0; } } ```
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
使用 Docker 部署 Spring Boot 项目
Docker 技术发展为微服务落地提供了更加便利的环境,使用 Docker 部署 Spring Boot 其实非常简单,这篇文章我们就来简单学习下。首先构建一个简单的 S...
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
刷了几千道算法题,这些我私藏的刷题网站都在这里了!
遥想当年,机缘巧合入了 ACM 的坑,周边巨擘林立,从此过上了"天天被虐似死狗"的生活… 然而我是谁,我可是死狗中的战斗鸡,智力不够那刷题来凑,开始了夜以继日哼哧哼哧刷题的日子,从此"读题与提交齐飞, AC 与 WA 一色 ",我惊喜的发现被题虐既刺激又有快感,那一刻我泪流满面。这么好的事儿作为一个正直的人绝不能自己独享,经过激烈的颅内斗争,我决定把我私藏的十几个 T 的,阿不,十几个刷题网...
白话阿里巴巴Java开发手册高级篇
不久前,阿里巴巴发布了《阿里巴巴Java开发手册》,总结了阿里巴巴内部实际项目开发过程中开发人员应该遵守的研发流程规范,这些流程规范在一定程度上能够保证最终的项目交付质量,通过在时间中总结模式,并推广给广大开发人员,来避免研发人员在实践中容易犯的错误,确保最终在大规模协作的项目中达成既定目标。 无独有偶,笔者去年在公司里负责升级和制定研发流程、设计模板、设计标准、代码标准等规范,并在实际工作中进行...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
redis分布式锁,面试官请随便问,我都会
文章有点长并且绕,先来个图片缓冲下! 前言 现在的业务场景越来越复杂,使用的架构也就越来越复杂,分布式、高并发已经是业务要求的常态。像腾讯系的不少服务,还有CDN优化、异地多备份等处理。 说到分布式,就必然涉及到分布式锁的概念,如何保证不同机器不同线程的分布式锁同步呢? 实现要点 互斥性,同一时刻,智能有一个客户端持有锁。 防止死锁发生,如果持有锁的客户端崩溃没有主动释放锁,也要保证锁可以正常释...
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
Java世界最常用的工具类库
Apache Commons Apache Commons有很多子项目 Google Guava 参考博客
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员...
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC...
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下...
为什么要学数据结构?
一、前言 在可视化化程序设计的今天,借助于集成开发环境可以很快地生成程序,程序设计不再是计算机专业人员的专利。很多人认为,只要掌握几种开发工具就可以成为编程高手,其实,这是一种误解。要想成为一个专业的开发人员,至少需要以下三个条件: 1) 能够熟练地选择和设计各种数据结构和算法 2) 至少要能够熟练地掌握一门程序设计语言 3) 熟知所涉及的相关应用领域的知识 其中,后两个条件比较容易实现,而第一个...
Android 9.0 init 启动流程
阅读五分钟,每日十点,和您一起终身学习,这里是程序员Android本篇文章主要介绍Android开发中的部分知识点,通过阅读本篇文章,您将收获以下内容:一、启动流程概述一、 启动流程概述Android启动流程跟Linux启动类似,大致分为如下五个阶段。1.开机上电,加载固化的ROM。2.加载BootLoader,拉起Android OS。3.加载Uboot,初始外设,引导Kernel启动等。...
相关热词 c# clr dll c# 如何orm c# 固定大小的字符数组 c#框架设计 c# 删除数据库 c# 中文文字 图片转 c# 成员属性 接口 c#如何将程序封装 16进制负数转换 c# c#练手项目
立即提问

相似问题

1
react-router如何像vue-router通过this.$router.push的方式编程实现路由跳转
2
在intellij中创建的webapp无法访问到注解的servlet,但是能访问到index.jsp和使用web.xml配置的servlet。
1
RMI调用的java.rmi.NoSuchObjectException: no such object exception
3
安卓点击按钮不能实现跳转 模拟器运行软件点按钮就闪退
1
《Java并发编程实践》一书-2.3.2重入机制树上问题
2
为什么我在springboot2.0上面整合quartz做的定时任务,移到springboot1.5上面启动没有反应?
1
Django中静态文件的加载及模板中{% static %}标签的使用问题
3
安卓运行报错android.content.ActivityNotFoundException: Unable to find explicit activity class
4
jpaRepository 的繼承
2
子類可以繼承父類的注解嗎?
1
AS上写了一个聊天室客户端报错java.lang.String java.io.BufferedReader.readLine()
3
安卓简易登陆界面一直提示账号密码错误
3
爲何JPA無法自動生成表?
1
struts 报错 “java.lang.NoSuchFieldException: loaderRef” 网页加载出404 求大神解决
2
protected 修饰符与继承
2
Recyclerview嵌套recyclerview的深坑,我坐在Recyclerview这个坑里很久了,仰望天空希望能把我拉上去。
1
spring-ws发布的webservice默认url是http://xx:xx/xxx.wsdl,不符合常规的http://xx:xx/xxx?wsdl格式,利用urlrewritefilter去做一下转发没有效果
1
notification无法显示
0
从python入门到实践19.2.2运行后登录界面没有出现注册页面,出现下面的错误
0
Error:(16, 32) 错误: 不兼容的类型: View无法转换为TextView,这是怎么回事?