小编Jor*_*ijk的帖子

为excel文档设置mime类型

MS Excel具有以下观察到的MIME类型:

  • application/vnd.ms-excel (官方)
  • application/msexcel
  • application/x-msexcel
  • application/x-ms-excel
  • application/x-excel
  • application/x-dos_ms_excel
  • application/xls
  • application/x-xls
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (XLSX)

是否有任何一种适用于所有版本的类型?如果没有,我们是否需要response.setContentType()单独设置这些mime类型中的每一个?

此外,我们在应用程序中使用文件流来显示文档(不仅仅是excel - 任何类型的文档).这样做,如果用户选择保存文件,我们如何保留文件名 - 目前,呈现文件的servlet名称显示为默认名称.

excel mime content-type

340
推荐指数
5
解决办法
40万
查看次数

无法将 kubernetes-bionic main (Ubuntu 18.04) 添加到 apt 存储库

我正在尝试在我的 Ubuntu 服务器/桌面版本 18.04.1 上安装 Kubernetes。但是,当我想使用以下命令将 kubernetes 添加到 apt 存储库时:

sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-bionic main"
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease                                                                                               
Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                          
Hit:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease                                                                                       
Hit:5 http://dl.google.com/linux/chrome/deb stable Release                                                                                            
Hit:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                                     
Hit:7 https://download.docker.com/linux/ubuntu bionic InRelease                                                                                       
Ign:8 https://packages.cloud.google.com/apt kubernetes-bionic InRelease                              
Err:10 https://packages.cloud.google.com/apt kubernetes-bionic Release
  404  Not Found [IP: 216.58.211.110 443]
Reading package lists... Done
E: The repository 'http://apt.kubernetes.io kubernetes-bionic Release' does not have a Release file.
N: Updating from such a …
Run Code Online (Sandbox Code Playgroud)

apt kubernetes ubuntu-18.04

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

Quartz.net Scheduler 使用集群

我正在使用集群选项,但我遇到了一些问题:

  1. 当我使用两台机器时,我创建的作业在开始时运行,与他们的定义无关。例如:如果我将作业定义为每 10 秒运行一次,它可以在开始时每两秒运行一次,并且只有从第 2 次运行它才正确 - 每 10 秒。

  2. 两台机器在同一分钟内(但不是在同一毫秒内)执行相同的工作并一起运行两次工作,我尝试使用锁处理程序属性,但也许我没有很好地定义它..

这是我的代码:

NameValueCollection properties = new NameValueCollection();

properties["quartz.scheduler.instanceName"] = "TestSchedulerNECH";
properties["quartz.scheduler.instanceId"] = "instance_one";
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadCount"] = "200";
properties["quartz.threadPool.threadPriority"] = "Normal";
properties["quartz.jobStore.misfireThreshold"] = "60000";
properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
properties["quartz.jobStore.useProperties"] = "false";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.jobStore.tablePrefix"] = "QRTZ_";
properties["quartz.jobStore.clustered"] = "true";
properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";
properties["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz";
properties["quartz.dataSource.default.connectionString"] = "Server=localhost;Database=mydb;Trusted_Connection=False;User=admin;Password=123456";
properties["quartz.dataSource.default.provider"] = "SqlServer-20";


ISchedulerFactory sf = new StdSchedulerFactory(properties);
IScheduler sched = sf.GetScheduler();

string schedId = sched.SchedulerInstanceId;

for …
Run Code Online (Sandbox Code Playgroud)

.net c# quartz-scheduler quartz.net

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

是否可以在Windows 7上使用WP8 SDK开发Windows Phone 8应用程序

是否有任何解决方法,因此没有Windows 8的开发人员可以使用Windows Phone SDK 8.0开发Windows手机?

windows windows-phone-8

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

将名称列表转换为字典,其中每个条目对应于以某个字母开头的名称

我创建了一个方法,Dictionary<string, List<Employee>>在这个方法中返回一个循环遍历a List<Employee>并查找firstname并将其按字母顺序添加到我的Dictionary中

请看以下示例:

  • 雇员
    • Eijk,Jordy
    • 大卫,约翰
    • 能,简,简
    • 等等

其中第一部分是姓氏,第二部分是名字

我的方法创建了一个像这样的字典

  • "D",列表({Doe,John},{Doe,Jane})
  • "E",List({Eijk,Jordy})

方法:

public async Task<Dictionary<string, List<Employee>>> GetAllOrderdedByNameAsync()
    {
        var dbList = await _employeeRepository.ListAsync();
        var employees = dbList.Select(FromDb).ToList();
        var empDict = new Dictionary<string, List<Employee>>();
        for (char c = 'A'; c <= 'Z'; c++)
        {
            var list = employees.Where(employee => employee.LastName.StartsWith(c.ToString(), StringComparison.CurrentCultureIgnoreCase)).ToList();
            if (list.Count > 0)
            {
                empDict.Add(c.ToString(), list);
            }
        }
        return empDict;
    }
Run Code Online (Sandbox Code Playgroud)

现在我的问题......有更好的方法吗?我将保持List<Employee>输入并需要Dictionary<string,List<Employee>>输出,所以请不要说我需要返回其他内容.

c# dictionary list

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