Feb 12, 2017


前段时间某厂被曝清理34岁以上的员工,虽说有标题党的嫌疑,但是反映出来的现象还是值得深思的。看过一个被离职员工的文章,过久了安逸的日子,被离职之后,居然找不到合适的工作,然后还要还高额的房贷,小孩还要上学,不得不卖房来还贷。在这件事情之前,我听到“程序员都是青春饭”这种说法,都是嗤之以鼻的,一方面是觉得,这是得过且过的人安慰自己的托辞,另一方面是因为真的没考虑过10年之后会怎么样。随着时间的流逝,我觉得也应该好好思考一下这个问题了。 概括了一下平行宇宙知乎上的讨论,大致有这么几种论调: 公司卸磨杀驴,不想跟员工签终生合同,所以变相裁掉这些人。 程序员这一行,如果34岁没有管理岗,还在纯粹写代码,就会混得很艰难,薪资也会到上限,这些人机遇不好 这些人活该,不合理的事情一直没有人说,

Jan 17, 2017

Activity Leak Detection

Prior Knowledge Reference and ReferenceQueue Begin with Java 1.2, the java.lang.ref package give us limited degree of interaction with garbage collector. The subclasses of Reference and ReferenceQueue are quite useful

Dec 21, 2016

Efficient Thread-safe Singleton in Java

Single-threaded Version class Foo { private static Helper helper; public static Helper getHelper() { if (helper == null) { helper = new Helper(); } return helper; } } The code works fine in single thread case. If multiple threads access getHelper(

Dec 18, 2016


前言 前天晚上和一个朋友吃了个饭,走回去的路上刚好路过徐家汇的百脑汇,就聊了一下这些卖场的套路,在这里记下来,不少朋友都是吃过套路的亏的。 这里假定各位读者都是对电脑的配置有基本了解的,如果对于硬件一无所知,我还是建议直接去京东买个合适价位的,就不要去趟卖场这滩浑水了。卖场虽然坑比较多,但是好处也是很明显的,如果能避开商家挖好的坑,最后的成交价会比京东要便宜。废话不多说了,下面来列举一下商家常用的套路。 洗脑转型 这是各大卖场最常见的套路。一般去逛电脑城的,大部分人都是看好了某个型号,目的性很强。卖场门口拉客的自然也知道这一点,所以不管你问他们什么型号,他们都会说有,然后报一个低于市场价500~2000的价格(视总价而定),先把你拉进店。接下来会给你看一台样机,如果没什么问题就让你交钱了,他们去仓库取机器。过一会会有人来告知你,这个区的仓库没货了,

Dec 8, 2016

Avoid Memory Leaks in Android

Java is a garbage-collecting-language, the garbage collector deals with memory properly on most cases. But we may still encounter memory leaks due to some logical bugs. I'll list some common cases that cause

Dec 2, 2016

Monitor Android Looper

As I write in the previous post Android Message Handling Mechanism, all messages dispatched to main thread will be handled in the looper of main thread. If a message cost a long time,

Nov 22, 2016

Android Message Handling Mechanism

I've been working on a performance monitor library for some time. While I'm implementing the looper-monitor feature, I found it's necessary to get clear on the Android message handling mechanism. In this article,

Aug 25, 2016

Android SQLite Insertion Optimization

Preface Recently, I've been working on a technical story which inserts more than 100,000 records at startup. The whole application relies on these data, so I have to make the insertion synchronous,

Jul 21, 2016

Object Initialization in Java

Preface Before we get started, let's see a snippet first. public class Foo { { bar = 1; } private int bar = 3; private static int baz = 4; static { baz = 2; } public Foo() { bar = 5; } public static

May 12, 2016

Analyzing Multidex Source Code

Recently I read the source code of Google's multidex library due to some reasons. I'll focus on how to load multiple dex files rather than how to split classes into multiple dex files

Apr 7, 2016

Android GOT Hook

Preface In this post, I assumed the readers have basic knowledge of ELF file format. I'm gonna talk about the dynamic linking and relocation in this post. Although it's the beginner level, basic