小编hon*_*onk的帖子

如何通过Spring在Controller中添加构造函数

我想初始化三个属性(companyTypescarrierLists,和cabinLevels)为全局变量:

@Controller
@RequestMapping("/backend/basic")
public class TicketRuleController {
    @Autowired
    private CarrierService carrierService;
    @Autowired
    private CabinLevelService cabinLevelService;
    @Autowired
    private CompanyTypeService companyTypeService;
    private List<DTOCompanyType> companyTypes = companyTypeService.loadAllCompanyTypes();
    private List<DTOCarrier> carrierLists = carrierService.loadAllCarriers();
    private List<DTOCabinLevel> cabinLevels = cabinLevelService.loadAllCabinLevel(); 
    ...
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

java spring

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

为什么我的导航栏在我的导航栏中没有完全伸展到左侧?

为什么我的导航栏一直伸到左边?

这就是我所说的:

产量

我的HTML:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <link href="css.css" rel="stylesheet" style="text/css">
</head>
<body>
    <div id="main">
        <nav>
            <ul>
                <li><a href="index.html">surfing 101</a></li>
                <li><a href="teknikker.html">teknikker</a></li>
                <li><a href="dønninger.html">dønninger</a></li>
                <li><a href="brettyper.html">brettyper</a></li>
                <li><a href="destinasjoner">destinasjoner</a></li>
                <li><a href="lenker.html">lenker</a></li>
            </ul>
        </nav>
        <section>
            <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate …
Run Code Online (Sandbox Code Playgroud)

html css

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

对于循环直接跳到最后

我开始学习C#,我的一个任务遇到了问题.任务是创建一个由星星组成的金字塔.高度由用户输入指定.

由于某种原因,我的第一个for循环跳到最后.在调试时,我注意到变量height接收bar到了值,但之后它跳到了最后.我不知道为什么,因为代码对我来说似乎很好.

do- while循环是有要求用户输入一个新值,如果输入的值0或更低.

using System;

namespace Viope
{
    class Vioppe
    {
        static void Main()
        {
            int bar; 

            do
            {
                Console.Write("Anna korkeus: ");
                string foo = Console.ReadLine();
                bar = int.Parse(foo);
            }
            while (bar <= 0);

            for (int height = bar; height == 0; height--)
            {
                for (int spaces = height; spaces == height - 1; spaces--)
                {
                    Console.Write(" ");
                }
                for (int stars = 1; stars >= height; stars …
Run Code Online (Sandbox Code Playgroud)

c# for-loop

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

background-attachment:修复不在chrome中工作

我正在开发一个我使用过该background-attachment:fixed 房产的网站.它在Firefox中工作正常,但图像不固定.在Chrome中,它表现正常.这是代码:

CSS:

.AboutBg
{
    background-attachment: fixed;
    background-image: url("../Images/LandingPage/smart.jpg");
    background-position: 0 0;
    background-repeat: repeat;
    background-size: cover;
    height: 90%;
    position: absolute;
    width: 100%;
}
Run Code Online (Sandbox Code Playgroud)

HTML:

<div class="AboutBg"></div>
Run Code Online (Sandbox Code Playgroud)

html google-chrome css3

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

如何在std :: map中对部分键进行二进制搜索?

我有一张数据图;关键是std::string。我想对它执行二进制搜索,但是我不能只使用std::map::find(),因为我将只提供一部分密钥。

假设我有一张带有以下按键的地图:

["abc"] -> ...
["efg"] -> ...
["ijk"] -> ...
["iik"] -> ...
Run Code Online (Sandbox Code Playgroud)

我想使用进行搜索,比如说仅提供"i",搜索应该返回:

[“ ijk”]-> ...,[“ iik”]-> ...

这可能吗?我尝试使用迭代器来执行此操作,但由于无法将它们视为索引而失败了。

注意:由于其他原因,我将数据保留在地图中,所以我不想将其更改为其他数据结构。

c++ containers dictionary binary-search c++11

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

使用c中的链接列表进行排队

在编译期间,此代码不会出错,但代码会突然停止.据我说,问题在于声明的createq函数在哪里q->front=q->rear=NULL.它必须初始化.这有什么不对吗?

#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
struct node
{
    struct node *next;
    int data;
};

struct queue
{
    struct node *front;
    struct node *rear;
};

struct queue *q;

void createq(struct queue *);
struct queue *insert(struct queue *);
struct queue *delete_q(struct queue *);
struct queue *display(struct queue *);

int main()
{
    int option;
    printf("\tMAIN MENU\n");
    printf("\n1. Create\n2. Display\n3. Insert\n4. Delete\n5. Exit\n");
    while(option!=5)
    {
        printf("\nEnter a choice:");
        scanf("%d",&option);
        switch(option)
        {
        case 1:
            createq(q);
            break;

        case 2:
            q=display(q);
            break;

        case 3: …
Run Code Online (Sandbox Code Playgroud)

c queue pointers linked-list

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

如何在MATLAB中从3个1d数组合成一个3d数组?

我的代码如下:

a = [.325 81 14; .272 105 26; .310 130 35];
b = [.305 75 18; .250 91 23; .285 126 41];
c = [.315 88 15; .265 95 21; .297 113 31];
abc(:,:,1) = a;
abc(:,:,2) = b;
abc(:,:,3) = c;
Run Code Online (Sandbox Code Playgroud)

从本质上讲,我想要做的是使abc的3D阵列a,bca第一页,b第二页上,并c在第三页上.但是,当我将其输入命令窗口时,我收到以下错误:

下标分配尺寸不匹配.

我正在做什么有什么问题?我读了很多类似的帖子,我写的是建议的,但我的代码似乎不起作用.

arrays matlab

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

如何不区分大小写地使用indexOf()?

我有字符串列表:

List<string> fnColArr = new List<string>();
fnColArr={"Punctuation,period,Space,and,yes"};
Run Code Online (Sandbox Code Playgroud)

我正在使用该IndexOf属性List在当前列表中查找字符串:

int arrayval = fnColArr.IndexOf("punctuation");
Run Code Online (Sandbox Code Playgroud)

现在的值arrayval是-1,因为该字符串不在列表中。但是这里唯一的区别是小写字母。

我还想找到字符串punctuation,无论大小写如何。

c# asp.net

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

一段时间后如何重新初始化Crashlytics?

我想使用Crashlytics.我在onCreate我的main活动中初始化了Crashlytics的功能,一切运作良好.

如果应用程序暂时不活动并且我想从状态栏通知跳转到应用程序,则问题开始.我认为它可以从Android垃圾收集中回收.所以我必须重新初始化Crashlytics.我可能会从状态栏收到几乎我应用中的每个活动的通知(我还会从状态栏触发异步任务).

我是否必须在每个活动/异步任务中初始化Crashlytics以确保它在应用程序关闭和回收后运行良好或是否有其他方法?

android crashlytics crashlytics-android

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

如果在Oracle中排序为DESC,为什么会先返回NULL值?

如果未指定NULL排序,则NULL值的处理为:

  • 如果排序是ASC,则NULL值是最后一个
  • 如果排序是DESC,则首先是NULL值

为什么会这样?

在此输入图像描述

sql database oracle oracle11g

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