Android 5.0 模拟器休眠唤醒(黑屏)

Android 5.0 模拟器默认在一分钟之内没有操作,就会关闭屏幕,出现黑屏的情况,如下图所示.android_simulator_black_screen

注意,这不是死掉了,只是休眠了而已。解除休眠的方式是按“ESC”或者“F7”按键即可。如果需要测试休眠的话,“F7”按键是个不错的选择。

Cura 15.04 实心打印

Cura 15.04 打印物体,默认是对打印对象进行部分填充,来节省打印耗材,但是打印一些中空的结构的时候,会出现边框强度不够的情况,导致边缘的强度非常差,这时候需要设置完全填充。如下设置即可。注意: 设置后,最好关闭一下软件重新打开,出现过修改无效的情况!

Cura_15_04_Fill

NDK 链接第三方静态库的方法

将NDK编译的第三方静态拷贝到JNI目录下,在Android.mk中添加如下代码

以openssl静态库(libcrypto-static.a)为例

第一种链接方法:LOCAL_LDFLAGS := libcrypto-static.a(不推荐,有编译警告

第二种链接方法:LOCAL_LDLIBS := libcrypto-static.a(不推荐,有编译警告

第三种链接方法:(推荐

Ubuntu自动备份远程服务器上WordPress的脚本

Ubuntu 自动备份远程服务器上Wordpress的脚本,分为两部分,一个是从远程服务器上面运行的"hostback.sh",一个是本地运行的 “backup.sh”,运行的时候,"hostback.sh"会被发送到服务器上面去执行,备份完成后,会自动从服务器上面删除。
运行命令为:

hostback.sh

backup.sh

Windows 10下面Android模拟器无法拖动问题的解决

Windows 10下面Android模拟器往往会顶到桌面的最上面,也就是上面的最大最小关闭按钮那一栏超过屏幕的最上面的边缘,导致无法拖动。这个时候是非常痛苦的。简单的修正这个问题的办法如下:
在底层任务栏右击,点击“层叠显示窗口”就可以了。
AndroidSimulatorShow

Windows下面Android Studio提示“Can't use Subversion command line client: svn”

Windows下面Android Studio提示

如果安装TortoiseSVN的时候没有选中Command Line Client的话,可能会导致上面的问题。

解决方法就是重新安装Tortoise SVN,在安装的时候选上“command line client tools”即可。
TortoiseSVNCommandLineInstall

Android模拟器, push文件到system下文件夹权限,空间,SO文件没有自动安装的问题

  • 只读文件系统

需要把APK Push到模拟器下面的 /system/app 目录下面,报告

解决方法

  • 内存不足

原因众说纷纭,基本上大家都没怎么深究,有些镜像没有这个问题,有些就有问题。
解决方法:
不要使用Eclipse或者Android Studio 或者 AVD Manager的图形界面去启动模拟器,而是使用下面的命令:

  • 包含SO的APK启动崩溃,日志中显示无法找到SO文件

原因,Android 设计问题,如果system/app下面的APK包含SO文件,不会自动安装,需要手工PUSH 到 "/system/lib"目录下面。

  • Android 5.0之后,最好推送到/system/priv-app目录

5.0之后的Android,最好推送到/system/priv-app目录。

  • Android 5.0之后,推送到系统目录后,没有自动安装应用

原因,Android 5.0之后,没有实时监视/system/priv-app目录的变化,只有在系统启动的时候才会扫描一下(重启系统很慢,我们可以按照如下操作节约时间),因此需要手工通知一下(有时候需要修改一下权限才可以)。

Cura 14以及Cura 15 版本如何找到Cura 13中的打印机设置Temp,Jog,Speed等页面

一直使用商家提供的Cura 13进行3D打印,前段日子看到软件已经升级到了15.04版本(注意:最新的Cura 15 提供了两个版本,一个是官方的配合最新的3D打印机的版本,一个是社区版本,我们只能使用社区版本,才有下面的界面),于是下载了一个版本使用,结果发现找不到在Cura 13中调试打印机的页面了。如下图所示是Cura 13的设置页面,其中Jog主要是用来调试打印机的。Cura_13_Jog
Cura 13 之后的版本精简了打印界面,变成了这个样子,找不到原来的调试页面了。
Cura_15_Print
其实这个页面是存在的,只是被隐藏了而已,执行如下操作即可显示出来了。

  • 在“File”菜单中选择“Perferences...”菜单

Cura_15_Preferences

  • 在“Perferences”窗口中选择“Printing window type”下拉菜单,里面选择“Pronterface UI”

Cura_15_Preferences_Window

Cura_15_Preferences_Printing_Window_Type

  • 点击OK,关闭设置窗口后,点击“Print”菜单,就可以见到更加高级的打印设置界面了。

Cura_15_After_Window_Type

Cura_15_Advance_Printing_Window

Ubuntu 15.04 Btrfs分区拷贝文件提示 “拼接文件出错:设备上没有空间” (No space left on device)

在安装Ubuntu 15.04的时候,由于机器使用的是SSD硬盘,因此在建立HOME分区的时候选择了使用Btrfs格式作为分区格式。一直都是使用正常,直到今天,在向HOME分区拷贝一个16GB的文件的时候提示 “拼接文件出错:设备上没有空间” (英文系统可能会提示 “No space left on device”)。

  • 磁盘空间真的不足了?

使用"df"命令查询分区,发现所有分区都是足够的。如下图所示,空间足够使用,尤其是HOME分区,足足有40GB的空间。df_command_when_btrfs_no_space_error

  • 单个文件的大小太大了? 超过分区限制了?

维基百科搜索“btrfs”,简介中标明,最大文件尺寸 16 EiB,显然,16GB的文件,是不会超过这个限制的。

  • 分区中的文件数目太多?超过文件数量限制?

同样是维基百科,btrfs条目,标明 最大文件数量 2^64,显然,120GB的一个硬盘,即使是全部是一个字节的小文件,也达不到这个数字的。

  • Inode耗尽?

使用"df -i"命令查询Inode信息,发现好奇怪的现象,home所在的分区信息中Inode信息,不管是已经你使用的,还是可以使用的,还是总数,都是 0. 为什么呢?
df_i_command_when_btrfs_no_space 后来才知道,btrfs格式是不能使用df命令的,btrfs有自己的单独的命令查询.

btrfs_fi_df_i_command_when_btrfs_no_space

仔细观察一下输出结果,好奇怪,使用df 命令,我们查询到分区的大小在90GB左右,但是这里显示的文件的大小仅仅是43GB,而且已经使用了42.50GB,按照这个显示,自然是空间不足了,那么,我们的空间去了哪里?

  • 产生这个问题的根本原因

这个问题的产生,本质上是btrfs设计导致的,原因归咎于btrfs所采用的COW技术,这项技术需要一个比较大的保留存储空间,但是当空间不足的时候,本应减少保留空间,而显然,默认情况下,没有正确处理这种情况。这个问题在3.18版本之后得到比较好的解决。

  • 解决方法

对于 btrfs 3.18之前的版本来说,执行如下命令即可.

从3.18版本开始,这个命令是当空间不足出现的时候,默认执行的,很遗憾,15.04的btrfs版本号是3.17.

  • Btrfs的常用命令

显示btfs文件系统信息

btrfs磁盘文件检查(需要重启进入修复模式中执行)

  • 参考链接

Btrfs Problem_FAQ
Ubuntu thinks btrfs disk is full but its not

Ubuntu thinks btrfs disk is full but its not

由于国外网站经常打不开,因此内容直接复制到这里 原文链接

Btrfs is different from traditional filesystems. It is not just a layer that translates filenames into offsets on a block device, it is more of a layer that combines a traditional filesystem with LVM and RAID. And like LVM, it has the concept of allocating space on the underlying device, but not actually using it for files.

A traditional filesystem is divided into files and free space. It is easy to calculate how much space is used or free:

Btrfs combines LVM, RAID and a filesystem. The drive is divided into subvolumes, each dynamically sized and replicated:

The diagram shows the partition being divided into two subvolumes and metadata. One of the subvolumes is duplicated (RAID1), so there are two copies of every file on the device. Now we not only have the concept of how much space is free at the filesystem layer, but also how much space is free at the block layer (drive partition) below it. Space is also taken up by metadata.

When considering free space in Btrfs, we have to clarify which free space we are talking about - the block layer, or the file layer? At the block layer, data is allocated in 1GB chunks, so the values are quite coarse, and might not bear any relation to the amount of space that the user can actually use. At the file layer, it is impossible to report the amount of free space because the amount of space depends on how it is used. In the above example, a file stored on the replicated subvolume @raid1 will take up twice as much space as the same file stored on the @homesubvolume. Snapshots only store copies of files that have been subsequently modified. There is no longer a 1-1 mapping between a file as the user sees it, and a file as stored on the drive.

You can check the free space at the block layer with btrfs filesystem show / and the free space at the subvolume layer with btrfs filesystem df /


For this mounted subvolume, df reports a drive of total size 38G, with 12G used, and 13M free. 100% of the available space has been used. Remember that the total size 38G is divided between different subvolumes and metadata - it is not exclusive to this subvolume.

Each line shows the total space and the used space for a different data type and replication type. The values shown are data stored rather than raw bytes on the drive, so if you're using RAID-1 or RAID-10 subvolumes, the amount of raw storage used is double the values you can see here.

The first column shows the type of item being stored (Data, System, Metadata). The second column shows whether a single copy of each item is stored (single), or whether two copies of each item are stored (DUP). Two copies are used for sensitive data, so there is a backup if one copy is corrupted. For DUP lines, the used value has to be doubled to get the amount of space used on the actual drive (because btrfs fs df reports data stored, not drive space used). The third and fourth columns show the total and used space. There is no free column, since the amount of "free space" is dependent on how it is used.

The thing that stands out about this drive is that you have 9.47GiB of space allocated for ordinary files of which you have used 9.46GiB - this is why you are getting No space left on device errors. You have 13.88GiB of space allocated for duplicated metadata, of which you have used 1.13GiB. Since this metadata is DUP duplicated, it means that 27.76GiB of space has been allocated on the actual drive, of which you have used 2.26GiB. Hence 25.5GiB of the drive is not being used, but at the same time is not available for files to be stored in. This is the "Btrfs huge metadata allocated"problem. To try and correct this, run btrfs balance start -m /. The -m parameter tells btrfs to only re-balance metadata.

A similar problem is running out of metadata space. If the output had shown that the metadata were actually full (used value close to total), then the solution would be to try and free up almost empty (<5% used) data blocks using the command btrfs balance start -dusage=5 /. These free blocks could then be reused to store metadata.

For more details see the Btrfs FAQs: