zhangyihao


  • 首页

  • 归档

  • 标签

  • 分类

Android 虚拟设备检测

发表于 2017-10-18 | 分类于 Android

在做App时遇到这么一个需求:要求App在启动的时候检测当前运行设备是否为虚拟设备,如果为虚拟设备则App停止运行并退出。通过网络上搜集的资料,总结了以下检测方法。

阅读全文 »

(转)The Double-Checked Locking is Broken Declaration

发表于 2017-02-16 | 分类于 JAVA

Double-Checked Locking is widely cited and used as an efficient method for implementing lazy initialization in a multithreaded environment.

Unfortunately, it will not work reliably in a platform independent way when implemented in Java, without additional synchronization. When implemented in other languages, such as C++, it depends on the memory model of the processor, the reorderings performed by the compiler and the interaction between the compiler and the synchronization library. Since none of these are specified in a language such as C++, little can be said about the situations in which it will work. Explicit memory barriers can be used to make it work in C++, but these barriers are not available in Java.

阅读全文 »

Node.js Module -moudule.exports vs exports

发表于 2017-02-15 | 分类于 Node.js

概览

先来看下官网对module.exports和exports的描述:

The module.exports object is created by the Module system. Sometimes this is not acceptable; many want their module to be an instance of some class. To do this, assign the desired export object to module.exports. Note that assigning the desired object to exports will simply rebind the local exports variable, which is probably not what you want to do.

The exports variable is available within a module’s file-level scope, and is assigned the value of module.exports before the module is evaluated.

It allows a shortcut, so that module.exports.f = … can be written more succinctly as exports.f = …. However, be aware that like any variable, if a new value is assigned to exports, it is no longer bound to module.exports

阅读全文 »

Hello World

发表于 2015-01-01

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

123
zhangyihao

zhangyihao

24 日志
10 分类
21 标签
GitHub
© 2017 - 2021 zhangyihao
由 Hexo 强力驱动
主题 - NexT.Mist