days

LeetCode 983. Minimum Cost For Tickets

风格不统一 提交于 2019-11-29 03:36:14
原题链接在这里: https://leetcode.com/problems/minimum-cost-for-tickets/ 题目: In a country popular for train travel, you have planned some train travelling one year in advance. The days of the year that you will travel is given as an array days . Each day is an integer from 1 to 365 . Train tickets are sold in 3 different ways: a 1-day pass is sold for costs[0] dollars; a 7-day pass is sold for costs[1] dollars; a 30-day pass is sold for costs[2] dollars. The passes allow that many days of consecutive travel. For example, if we get a 7-day pass on day 2, then we can travel for 7 days: day 2, 3, 4, 5, 6

Kubernetes之POD

左心房为你撑大大i 提交于 2019-11-29 03:05:54
什么是Pod Pod是可以创建和管理Kubernetes计算的最小可部署单元。一个Pod代表着集群中运行的一个进程。 Pod就像是豌豆荚一样,它由一个或者多个容器组成(例如Docker容器),它们共享容器存储、网络和容器运行配置项。Pod中的容器总是被同时调度,有共同的运行环境。你可以把单个Pod想象成是运行独立应用的“逻辑主机”——其中运行着一个或者多个紧密耦合的应用容器——在有容器之前,这些应用都是运行在几个相同的物理机或者虚拟机上。 尽管kubernetes支持多种容器运行时,但是Docker依然是最常用的运行时环境,我们可以使用Docker的术语和规则来定义Pod。 Pod中共享的环境包括Linux的namespace,cgroup和其他可能的隔绝环境,这一点跟Docker容器一致。在Pod的环境中,每个容器中可能还有更小的子隔离环境。 Pod中的容器共享IP地址和端口号,它们之间可以通过 localhost 互相发现。它们之间可以通过进程间通信,例如 SystemV 信号或者POSIX共享内存。不同Pod之间的容器具有不同的IP地址,不能直接通过IPC通信。 Pod中的容器也有访问共享volume的权限,这些volume会被定义成pod的一部分并挂载到应用容器的文件系统中。 就像每个应用容器,pod被认为是临时实体。在Pod的生命周期中,pod被创建后

Docker零基础

夙愿已清 提交于 2019-11-29 01:33:19
从Docker零基础到懂一点实践教程 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本文链接: https://blog.csdn.net/sch0120/article/details/53219220 Docker镜像与仓库(一) 查看和删除镜像 Docker镜像是一种使用联合加载技术实现的层叠的只读文件系统,它是容器构建的基石。Docker的镜像存储在 /var/lib/docker 目录下。通过 docker info 命令可以查看到Docker使用的存储驱动和存储的位置。 schen@scvmu01:~$ docker info Containers: 7 Running: 0 Paused: 0 Stopped: 7 Images: 1 Server Version: 1.12.1 Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs Dirs: 19 Dirperm1 Supported: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: null overlay host bridge

Python之DataFrame按照规则批量修改某列的数据

耗尽温柔 提交于 2019-11-29 00:47:06
在使用Python进行数据分析时,我们经常会看一个数据的分布,然后对数据进行处理。比如说有一个场景: 以下数据是某个产品的提前预定期: import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import seaborn as sns import numpy as np %matplotlib inline data = (pd.read_csv('D:/Users/Merchants_portrait.csv')).astype('int') avg_days_befor = (data['avg_days_befor'].value_counts()).reset_index() sns.barplot(x = avg_days_befor.index, y = avg_days_befor['avg_days_befor']) plt.show() # 图3 这个图看起来比较丑,因为天数比较多,所以横坐标密密麻麻 我们看下提前预定天数和每个预定天数的产品的情况 avg_days_befor.head() 看下分布情况 #观察下提前预定天数的分布 avg_days_befor.describe() 从下面表格可以看出,提前预定天数在0-633之间,75%的分布在200以内 index

iOS 获取N天前或N天后日期中的坑

落花浮王杯 提交于 2019-11-29 00:40:41
最常见获取N天前后的日期的方法是: //获取N天后日期 + (NSDate *)getDate:(NSDate *)currentDate day:(NSInteger)day { NSInteger days = day; // n天后的天数 days = (days == 0 ? 2.f : days);//未指定天数则默认为两天 NSDate *appointDate; // 指定日期声明 NSTimeInterval oneDay = 24 * 60 * 60; // 一天一共有多少秒 appointDate = [currentDate initWithTimeIntervalSinceNow: +(oneDay * days)]; return appointDate; } 而获取N天前的日期 //改为负的天数即可 appointDate = [currentDate initWithTimeIntervalSinceNow: -(oneDay * days)]; 大都是这样的方法,该方法也确实能计算出距离《当前》时间的N天前或N天后的时间;但是在最近使用时,发现这样计算却无法算出《指定日期》的N天前/后时间,为此还试了很多次,却都没有计算出… 感觉 initWithTimeIntervalSinceNow 方法始终是用《当前》时间来计算N天前/后的时间;即使传入一个

汽车租赁

心已入冬 提交于 2019-11-28 22:42:54
1 package com.lease; 2 /** 3 * 汽车类 4 * @author Administrator 5 * 2019-01-15 6 */ 7 public abstract class Car { 8 private String type; //汽车类型 9 //private double rent; //日租金 10 11 public Car() { //空参构造 12 super(); 13 } 14 15 public Car(String type) { //带参构造 16 super(); 17 this.type = type; 18 } 19 20 public String getType() { //get方法 21 return type; 22 } 23 public void setType(String type) { //set方法 24 this.type = type; 25 } 26 27 //租车方法 28 public abstract void lease(String type, String model,int days,double sumRent,int seat); 29 30 public abstract double discount(int days,double rent); //打折方法

JS 构造函数 Date

浪子不回头ぞ 提交于 2019-11-28 22:15:52
<script src="https://cdn.bootcss.com/moment.js/2.24.0/moment.js"></script> <script type="text/javascript"> var d1 = new Date(); var result = d1.toString(); console.log(result); //Wed Aug 28 2019 14:39:05 GMT+0800 (中国标准时间) var d1 = new Date(); var result = d1.toLocaleString(); console.log(result); //2019/8/28 下午2:39:05 var d1 = new Date(); var result = d1.getTime(); console.log(result); //时间戳 1566974345508 var d1 = new Date(1568974098332); var result = d1.toLocaleString(); console.log(result); //2019/9/20 下午6:08:18 //引用第三方JS资源库实现日期输出 var d1 = new Date(); //Format Dates var result1 =moment()

使用WinDbg调试程序

。_饼干妹妹 提交于 2019-11-28 18:31:57
使用WinDbg调试程序 WinDbg是微软发布的一款相当优秀的源码级(source-level)调试工具,可以用于Kernel模式调试和用户模式调试,还可以调试Dump文件。 WinDbg是微软很重要的诊断调试工具: 可以查看源代码、设置断点、查看变量, 查看调用堆栈及内存情况。  调试应用程序(用户模式 user mode)  调试操作系统及驱劢程序(内核模式 kernel mode)  调试非托管程序(native program)  调试托管程序(managed program)  实时调试 (JIT: Just in time)  事后调试 (postmortem debugging) 使用WinDbg可以解决线上.NET应用程序的如下问题: ◆ 内存高 ◆ CPU高 ◆ 程序异常 ◆ 程序Hang死 在生产环境下进行故障诊断时,为了不终止正在运行的服务或应用程序,有两种方式可以对正在运行的服务或应用程序的进程进行分析和调试。 一、用WinDbg等调试器直接attach到需要调试的进程,调试完毕之后再detach即可。但是这种方式有个缺点就是执行debugger命令时必须先break这个进程,执行完debug命令之后又得赶紧F5让他继续运 行,因为被你break住的时候意味着整个进程也已经被你挂起。另外也经常会由于First Chance

momentJS date string add 5 days

a 夏天 提交于 2019-11-28 16:54:21
问题 i have a start date string "20.03.2014" and i want to add 5 days to this with moment.js but i don't get the new date "25.03.2014" in the alert window. here my javascript Code: startdate = "20.03.2014"; var new_date = moment(startdate, "DD-MM-YYYY").add("DD-MM-YYYY", 5); alert(new_date); here my jsfiddle: http://jsfiddle.net/jbgUt/1/ How can i solve this ? I like this string format "25.03.2014" Hope someone can help me. 回答1: UPDATED: January 19, 2016 As of moment 2.8.4 - use .add(5, 'd') (or

MySQL to_days()函数的一次应用

烈酒焚心 提交于 2019-11-28 15:27:55
项目中有这样一个需求,就是查询出某一天之内的符合条件的信息 数据库中存储的数据是精确到秒的,格式就是 yyyy-MM-dd HH:mm:ss 这样的格式 但是查询时是以 “天” 为单位的,当然也不可能让用户去精确到分或者秒 MySQL的 to_days() 方法返回一个天数(年为0以来的天数) (按我的理解就是公元0000年开始) 所以SQL如下:SELECT * FROM table_name WHERE TO_DAYS(column_name) = TO_DAYS('2019-08-21') 由此可查出2019-08-21这一天内所有的信息 来源: https://www.cnblogs.com/yangwanhao/p/11412448.html