面向状态机编程:复杂业务逻辑应对之道
在研发项目中,经常能遇到复杂的状态流转类的业务场景,比如游戏编程中NPC的跳跃、前进、转向等状态变化,电商领域订单的状态变化等。这类情况其实可以有一种优雅的实现方法:状态机。
Stella981 Stella981
3年前
Python爬虫:抓取手机APP的数据
1、抓取APP数据包方法详细可以参考这篇博文:http://my.oschina.net/jhao104/blog/605963(http://my.oschina.net/jhao104/blog/605963)得到超级课程表登录的地址:http://120.55.151.61/V2/StudentSkip/loginCheckV4.act
Stella981 Stella981
3年前
Ruby 里的 %Q, %q, %W, %w, %x, %r, %s, %i (译)
%Q用于替代双引号的字符串.当你需要在字符串里放入很多引号时候,可以直接用下面方法而不需要在引号前逐个添加反斜杠(\\") %Q(Joe said: "Frank said: "{what_frank_said}"") "Joe said: "Frank said: "Hello!"""(...)
Stella981 Stella981
3年前
Spring Boot @ControllerAdvice+@ExceptionHandler处理controller异常
需求:  1.springboot 项目restful 风格统一放回json  2.不在controller写trycatch代码块简洁controller层  3.对异常做统一处理,同时处理@Validated校验器注解的异常方法:  @ControllerAdvice注解定义全局异常处理类@ControllerAdvice
Stella981 Stella981
3年前
CentOS定时运行脚本
要启动cron服务,使用/sbin/servicecrondstart命令。要停止该服务,使用/sbin/servicecrondstop命令。新增调度任务可用两种方法:1、在命令行输入:crontabe然后添加相应的任务,wq存盘退出。2、直接编辑/etc/crontab文件,即vi/etc/cront
Stella981 Stella981
3年前
Deepin Atom安装填坑记录
1/Atom安装插件失败!解决方法:1.找到atom的目录 !(https://static.oschina.net/uploads/space/2017/0610/182533_70Hn_1178214.png)2.该目录下的packages目录用于存放各个插件。3.到https://atom.io/packages/search?
Stella981 Stella981
3年前
Spring Boot 实现ErrorController接口处理404、500等错误页面
在项目中我们遇到404找不到的错误、或者500服务器错误都需要配置相应的页面给用户一个友好的提示,而在SpringBoot中我们需要如何设置。我们需要实现ErrorController接口,重写handleError方法。packagecom.ciyou.edu.controllerimportorg.springf
Stella981 Stella981
3年前
IOS开发网络阶段之NSURLSession
//// ViewController.m// 02NSURLSession//// Createdby鹿微微鹿on16/4/27.// Copyright(c)2016年鹿微微鹿.Allrightsreserved.////在这里总结一个方法,通过参数返回另一个页面一个消息或者其他东西//可以把
Wesley13 Wesley13
3年前
Java高级特性
Roadmap!(https://static.oschina.net/uploads/space/2017/0607/135759_MXES_1041012.png)1\.基本概念1.1什么是反射反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法;对于任
Stella981 Stella981
3年前
Map在Java 8中增加非常实用哪些函数接口?
!(https://oscimg.oschina.net/oscnet/7c38c1e26ad047b084fca9efc096a9a0.png)Map中的新方法相比 Collection(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fmp.