Devin Blog

走在当下 梦想未来

Python装饰器的前世今生

"python decorator "

一、史前故事 先看一个简单例子,实际可能会复杂很多: def today(): print('2018-05-25') 现在有一个新的需求,希望可以记录下函数的执行日志,于是在代码中添加日志代码: def today(): print('2018-05-25') logging.info('today is running...') 如果函数 yesterday()、tomorro...

钉钉群自定义机器人消息Python封装

"自定义聊天机器人 "

一、钉钉群自定义机器人介绍 钉钉群机器人是钉钉群的一个高级扩展功能,然而使用起来却非常简单,只有注册一个钉钉账号即可,就可以将第三方服务的信息聚合到钉钉群中,实现信息的自动化同步,例如:通过聚合Github、Gitlab等源码管理服务,实现源码更新同步;通过聚合Trello、JIRA等项目协调服务,实现项目信息同步;同事,支持Webhook协议的自定义接入,支持更多可能性,例如:将运维报警提...

Java 注解深入理解

"Java注解 "

内容概要 Annotation的概念 Annotation的作用 Annotation的分类 系统内置注解 元注解 自定义注解 解析注解信息 JDK8注解新特性 附:项目源码地址 一、Annotation的概念 Annot...

JUnit4.12 入门实例

"Java单元测试 "

内容概要: 为什么要做单元测试 JUnit简介 单元测试规范 JUnit4常用注解 JUnit4异常和超时测试 JUnit4常用断言方法 JUnit4参数化测试 JUnit4测试套件 附:项目源码 项目工程基于Idea ID...

[LeetCode 383] Ransom Note

"喜刷刷 "

问题描述 Given
 an 
arbitrary
 ransom
 note
 string 
and 
another 
string 
containing 
letters from
 all 
the 
magazines,
 write 
a 
function 
that 
will 
return 
true 
if 
the 
ransom 
 note 
can 
be...

[LeetCode 13] Roman To Integer

"喜刷刷 "

问题描述 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 知识准备: 题意很简单, 就是将罗马数字转换为整型, 那么何为罗马数字呢? 请看: 百科:罗马数字 从百科上我们可知罗马数字的特点: 相同的...

[LeetCode 389] Find the Difference

"喜刷刷"

问题描述 Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find the letter that...

[LeetCode 387] First Unique Character in a String

"喜刷刷"

问题描述 Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1. Examples: s = "leetcode" return 0. s = "loveleetcode", return 2. Note:...

[LeetCode 9] Palindrome Number

"喜刷刷"

Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1) If you are thinking of converting the integer to string, n...

[LeetCode 8] String to Integer(atoi)

"喜刷刷"

问题描述 Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible i...