Tested with angular@5.
npm i @angular/platform-server @nguniversal/express-engine @nguniversal/module-map-ngfactory-loader express @types/express ts-loader@3 rimraf --save-dev
| self.setFocusPolicy(Qt.StrongFocus) |
| #!/usr/bin/python | |
| # -*- coding: UTF-8 -*- | |
| import win32api | |
| import win32con | |
| class AutoRun(): | |
| def __init__(self): | |
| name = 'translate' # 要添加的项值名称 | |
| path = 'D:\\python_work\\work\dist\\translate.exe' # 要添加的exe路径 | |
| # 注册表项名 |
| /*布隆过滤器(Bloom Filter)是1970年由Burton Howard Bloom提出的。 | |
| *它实际上是一个很长的二进制向量和一系列随机映射函数。 | |
| *布隆过滤器可以用于检索一个元素是否在一个集合中。 | |
| *它的优点是空间效率和查询时间都远远超过一般的算法,缺点是有一定的误识别率和删除困难。 | |
| */ | |
| import java.util.BitSet; | |
| public class SimpleBloomFilter { |
| public class ExecuteSHFile { | |
| private static Logger logger = LoggerFactory.getLogger(ExecuteSHFile.class); | |
| public static String executeSHFile(String shutdown_path) throws Exception { | |
| //执行XXX.sh脚本 | |
| Process ps = Runtime.getRuntime().exec("sh "+shutdown_path); | |
| //阻塞,直到上述命令执行完成,当返回值为0时表示执行成功 | |
| int resultCode = ps.waitFor(); | |
| String result=null; | |
| logger.info("resultCode"+resultCode); |
| /** | |
| * 描述:雪花算法 | |
| * User: 曾远征 | |
| * Date: 2018-09-17 | |
| * Time: 15:51 | |
| */ | |
| public class SnowflakesTools { | |
| //开始时间截 (2015-01-01) | |
| private final long twepoch = 1489111610226L; |
| import java.util.LinkedList; | |
| import java.util.List; | |
| /** | |
| * 描述:红包算法 | |
| * User: 曾远征 | |
| * Date: 2018-09-17 | |
| * Time: 14:09 | |
| */ | |
| public class RedPacketTools { |
| package com.empireminecraft.util; | |
| import org.bukkit.Bukkit; | |
| import java.util.concurrent.ConcurrentLinkedQueue; | |
| public class TaskChain { | |
| // Tells a task it will perform call back later. | |
| public static final Object WAIT = new Object(); |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.beans.factory.annotation.Value; | |
| import org.springframework.core.io.Resource; | |
| import org.springframework.core.io.ResourceLoader; | |
| import org.springframework.http.ResponseEntity; | |
| import org.springframework.web.bind.annotation.*; | |
| import Java.nio.file.Paths; | |
| /** |
| public List<?> findAllGameStateByUnitIdAndUserId(int unitId, int userId) { | |
| Query query = entityManager.createNativeQuery("SELECT b.*, IF(c.id > 0, 1, 0) as is_finish FROM `wx_unit_game` a" + | |
| " left join `wx_catalog` b on a.game_id = b.id" + | |
| " left join `wx_unit_game_progress` c on c.game_id = a.game_id and c.user_id = :userId" + | |
| " WHERE a.unit_id = :unitId and b.game_is_lock = 1"); | |
| query.unwrap(SQLQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP); | |
| query.setParameter("userId", userId); | |
| query.setParameter("unitId", unitId); | |
| List result = query.getResultList(); |