joy keeps flowin’ - 什么都想写点
Cow and Hprof
COW(copy on write) # Linux通过fork()和exec()函数族创建新进程。 为什么通过这种方式,而不是从头开始创建新进程? # Of course, one big question you might have: why would we build such an odd interface to what should be the simple act of creating a new process? Well, as it turns out, the separation of fork() and exec() is essential in building a UNIX shell, because it lets the shell run code after the call to fork() but before the call to exec(); this code can alter the environment of the about-to-be-run program, and thus enables a variety of interesting features to be readily built. The shell is just a user program4 . It shows you a prompt and then waits for you to type something into it. You then type a command (i.e., the name of an executable program, plus any arguments) into it; in most cases, the shell then figures out where in the file system the executable resides, calls fork() to create a new child process to run the command, calls some variant of exec() to run the command, and then waits for the command to complete by calling wait(). When the child completes, the shell returns from wait() and prints out a prompt again, ready for your next command. The separation of fork() and exec() allows the shell to do a whole bunch of useful things rather easily. For example: prompt> wc p3.c > newfile.txt In the example above, the output of the program wc is redirected into the output file newfile.txt (the greater-than sign is how said redirection is indicated). The way the shell accomplishes this task is quite simple: when the child is created, before calling exec(), the shell (specifically, the code executed in the child process) closes standard output and opens the file newfile.txt. By doing so, any output from the soonto-be-running program wc is sent to the file instead of the screen (open file descriptors are kept open across the exec() call, thus enabling this behavior [SR05]).
查身份证的权力
查身份的权力 # 今日周五, 回家路上心情尚可. 快到小区门口时见到红蓝灯交互闪动, 心想不妙: 又他妈要查身份证. 走到门口时, 果不其然. 心中即使有不甘心仍报上身份证号码. 从小区门口走到卧室的途中越想越气. 遂查阅一番查阅身份相关规定.如下:
删除.gitignore中的文件
.gitignore文件中可以列举出哪些文件不希望提交到git中, 只对还没有提交的文件生效, 如果已经有文件提交了, 即使添加到.gitignore也不会起作用.这时候可以用命令: 1 git rm -r --cached file/directory 参数含义 # rm: Remove files from the working tree and from the index.
京东 杨笠 梁文道
从我开始听"八分"这个播客节目开始就很喜欢梁文道, 原因是因为梁文道有学识, 谦虚, 又经常在节目中讨论一些观点, 绝大多数时清况下, 我对讨论的事件和观点都很感兴趣, 有许多是我没有想到过的角度.
国籍和文化
在这之前粗浅的认为一个人国籍就是一个人的符号,因此常常对“美籍华人、日籍华人”这样类似的说法感到厌恶,[ENG SUB] 曾经的“猪仔”,马来西亚华人现在过得怎么样?【食贫道】触动了我一下。 除了一个人在法律上的身份(也就是国籍)之外,背后认同的文化也是这个人的一部分。一个是法律上的定义,一个是思想上的归属。文化甚至是可以与国籍分庭抗礼的。
扩大点击区域
Android中常用扩大点击区域的方式是为View添加padding, 并重新计算View的尺寸. Android中提供了另一种方式: TouchDelegate TouchDelegate # Android TouchDelegate is a powerful tool that helps developers create a custom touch region for a View. This allows developers to extend the area of the View that responds to touch events. For example, if a View is small, developers can use TouchDelegate to increase the area that responds to touch events. This makes it easier to interact with the View and makes the user experience more seamless. The TouchDelegate class also helps developers create custom touch feedback, such as a ripple effect, when the user interacts with a View. This can make the user experience more intuitive and engaging.
Android Shortcut
Android 快捷方式 # 在Android系统中,快捷方式是一种非常方便的工具,可以帮助用户更快速地访问他们经常使用的应用程序或功能。用户可以在主屏幕或应用程序抽屉中创建快捷方式,并可自定义快捷方式的名称和图标。
为Android编译ffmpeg
近来学习音视频, ffmpeg又是音视频中绕不开的,于是编译ffmpeg. 试了好多天, 总算摸出点规律, 记录下来给需要的朋友提供一点线索. 编译 # 从ffmpeg仓库克隆源码 安装ndk 执行编译脚本 sysroot # sysroot被称为逻辑根目录,只在链接过程中起作用,作为交叉编译工具链搜索库文件的根路径,如配置--sysroot=dir,则dir作为逻辑根目录,链接器将在dir/usr/lib中搜索库文件。
关掉Android Studio默认复制富文本(rich text)
富文本(rich text)和 纯文本(plain text) plain text format contains no formatting information, rich text format includes formatting details such as font size, style, color, and other elements like images, tables, and links. Android Studio(Idea)中复制代码默认复制的是富文本(rich text),需要从 Android Studio 中复制出代码整理文档时不胜其烦.
面向过程和面向对象
小弟以为差别已经体现在了名字上,顾名思义,面向过程即关注点在过程上,通过组合不同的函数(方法)实现某种功能;而面向对象关注点在对象(实例)上,由一个或多个对象的方法,借助属性,共同实现。 至于其他的都是上面的差异更具体的表现,而不是原因。