巴以问题
巴以冲突
如何清理 git 历史
下载 下载BFG Repo-Cleaner工具,如 bfg-1.14.0.jar。
把敏感信息在当前最新版本里都删除。
使用mirror标志克隆一个裸仓库(普通文件将处于不可见):git clone --mirror git@git.woa.com:aaa/myproject myproject_rmhistory。
生成一个 rule 文件,如 rule.txt:testpass。每一行一个敏感词。
java -jar bfg-1.14.0.jar --replace-text rule.txt myproject_rmhistory。
cd myproject_rmhistory。
git reflog expire --expire=now --all && git gc --prune=now --aggressive。
关闭对 master 的写保护:git push -f。
Spring Boot 相关
启动基于 loader 的启动命令1java(可以重命名为应用名) -Denv=test -Dspring.profiles.active=test -Dn=appName(可以对 ENV 求值) -Xmx4096m -Xms4096m -XX:MetaspaceSize=128M -XX:+CMSClassUnloadingEnabled -DapplicationMode=spring -Dlogger.file=conf/logback.xml -Dconfig.file=conf/application-test.conf -javaagent:/usr/local/services/appName/libs/opentelemetry-javaagent-1.19.2.jar -XX:+CMSPermGenSweepingEnabled -XX:+PrintGCDetails -Xloggc:./logs/gc-%t.log -XX:+PrintGCDateStamps -XX:+HeapDumpOnOutOfMemoryError -XX:+UseContainerSupp ...
宇宙探索编辑部
《宇宙探索编辑部》的预告片是很有90年代的特色的。国外讲科幻电影有蒸汽朋克、赛博朋克、柴油朋克,中国也有自己的朋克科幻类型,就是二极管朋克,或者真空管朋克。在二极管朋克的低科技世界里面,主人公可以使用信号解读这个世界,但对这个世界的解读,又仅止于信号。这个基础设定构成了这个戏的前提,给一个低成本科幻片做好了世界观构建。
杨皓宇扮演的唐志军是一个类似堂吉诃德式的人物,而艾丽娅扮演的秦彩蓉恰好是一个桑丘式的人物。在《堂吉诃德》的原著故事里,堂吉诃德是一个看到风车,能够当做巨人与之搏斗的精神病患者,而桑丘是一个能够看到“风车是风车”的人。唐志军在年轻的时候就朝气蓬勃地入了迷,到老了理想成了天空中星星,自己依然在荒芜的人间孤独地游荡;秦彩蓉对唐志军不离不弃,既参与堂吉诃德的冒险,又用桑丘式的冷言冷语,为冒险加上“常识性”的注解。他俩的不同性质的观点的碰撞,从影片的开头,一直持续到近乎结尾,为这个戏带来了节奏。但是这个节奏是很让观众难熬的,我不是没有看过这种晃镜头的伪纪录片的片子,但这个片子仍然是这些年来我在电影院看得最绞尽脑汁的一部。男主角轻轻的语气、瘦弱的身躯和潦草的头发一直在散发敏感脆弱和 ...
Spring Web
Spring MVC把 httprequest 放入线程的过程1234567891011public class ServletRequestAttributes extends AbstractRequestAttributes { /** * Create a new ServletRequestAttributes instance for the given request. * @param request current HTTP request */ public ServletRequestAttributes(HttpServletRequest request) { Assert.notNull(request, "Request must not be null"); this.request = request; }}
在 RequestContextFilter 的子类 OrderedRequestContextFilter:
1234567891011121314151617181920@ ...
推荐系统相关
新闻的推荐系统是为了给信息流的用户推荐资讯 feed。接口返回的信息不一定会被外显曝光。
在瀑布流式的外显曝光场景下,重排能够减少用户的疲劳度。
这就涉及到推荐系统的设计,流量要经过什么样的链路呢?
接入层、推荐中控、画像、召回、粗排、精排、重排。这些系统会形成星型架构和树形架构。
不同的架构之间有一个典型的优缺点需要取舍:链路长度会影响网络传输的最终效率,也会影响推荐系统的性能。
feeds推荐引擎典型架构.drawio
Java 原生 API
java.langSystem这个类看起来是 JavaLangAccess 的实现(虽然没有做过 implements 声明),所以注册钩子也可以用这个方法:
sun.misc.SharedSecrets.getJavaLangAccess().registerShutdownHook
identityHashCode123456789101112131415public static void main(String[] args) { Map map = new HashMap(); map.put(1, 2); map.put(3, 4); // 10 // 1746572565 System.out.println(map.hashCode()); System.out.println(System.identityHashCode(map));; // 989110044 // 989110044 Object object = ...
Guava 解析
前言Guava 本身适配不同的环境,Jdk 1.8 以上使用 jre flavor,Jdk 1.7 和 android 使用 android flavor。
类库的作者,不要使用 @Beta 成员,以后它们不会是 source-compatible。但我们可以使用其他成员,它们会是 binary-compatible,Guava 现在不会再因为非安全原因删除成员了,即使是 @Deprecated 的。
可用的功能见这个 User Guide。
commonCollectMultimap这个数据结构首先是一个接口,有以下子接口: ListMultimap、SetMultimap。不同的子接口的 Get 方法返回不同的数据结构。
有两种方法可以理解这个数据结构:
1234<ul> <li>a → 1, 2 <li>b → 3</ul>
第一种形式同 Stream 的 groupingBy 的操作结果类似:
1234Map<MapKey, List<Object>> map = actionAggregates. ...
RESTful 资料归集
资料归集Google Cloud API Design Guidegithub的 restful apirestcookbook.com
REST 十诫FROM:https://www.infoq.cn/article/oJ3FX8MtAER4UubZgAt9
本文最初发表于 Treblle 网站,经原作者 Vedran Cindrić 授权,InfoQ 中文站翻译并分享。
我在过去十年里,一直在研究的核心内容之一就是 API:从单一客户端使用的简单 API,到多种设备和多种用途的 API。在过去这些年来,我也有机会与很多第三方 API 一起工作,比如 Stripe、Twilio,以及其他一些不太流行但很有吸引力的 API。这些 API 几乎都以 REST 为基础,有些地方是独一无二的。
REST 之所以流行,有许多理由可以解释。它易于理解、灵活、适用于各种规模,拥有庞大的社区,以及围绕其构建的各种工具。但是,除此之外,我还要说,许多流行的理由都是源于其最老的竞争对手——SOAP,它实在是太可怕了。如果你曾经使用过或与 SOAP 一起工作过,你就会明白我为什么这样说!它的客户端非常糟糕 ...
一秒钟
在台下起冲突的时候,范电影拿着话筒,对台下说了一句台词,看电影是让你们学好的。
但范电影所处的世界,并没有几件好事,更没几个好人:普通的老百姓,物质文化生活极度贫乏。他们两个月才有一次娱乐,即使是看过无数次的《英雄儿女》,也要聚在一起,一遍遍地把电影看到天亮。保卫科的干事,虽然看电影对王芳和父亲的别离感动不已,却对没有父母的刘闺女、失去了女儿的张九声视若无睹。张九声只是打了一场架,就被关了六年(加上电影结尾的两年,一共八年)。他为了看一场电影,要逃出农场,挟持范电影。因为被欺负得狠了,刘闺女不惜当窃贼、打闷棍,也要把胶片抢到手。而范电影享受着电影放映员带来的虚荣和权力,是个精致的利己主义者(或者说乡愿)。
生活在这样的世界里面,高道德水平是无用的,或者不存在的-全片没有出场一个这样的人物,低道德水平有时候是管用的。如果骗没有用,就用偷袭的方法(不知道刘闺女是不是练过泰拳)。如果不幸举止泄漏,外部惩罚就异常严厉。烧坏一个灯罩,就从此再也不能看电影;看了几次女儿的电影,就先被打个头破血流。
这种苦况,让主要人物的心理扭曲得非常厉害。张九声的人生很苦,没有出路,这种没有出路体现在行动上-他没 ...