捣鼓挂掉WD MyCloud之后,在参照 拯救死翘翘了的 WD My Cloud 恢复系统后,首页中的容量部分显示0KB,如下图:
解决方法为,进行一次"仅系统"的"系统出厂还原",如下图:
参考链接
MyCloud showing 0kb available, data and files cannot be accessed
捣鼓挂掉WD MyCloud之后,在参照 拯救死翘翘了的 WD My Cloud 恢复系统后,首页中的容量部分显示0KB,如下图:
解决方法为,进行一次"仅系统"的"系统出厂还原",如下图:
MyCloud showing 0kb available, data and files cannot be accessed
WordPress对上传的文件类型是有限制的,在这里,我们以在子主题twentyfifteen-child中增加扩展名为.bz2的文件类型为例子。
首先编辑子主题的functions.php文件
|
1 |
$ sudo vim /var/www/wordpress/wp-content/themes/twentyfifteen-child/functions.php |
在文件尾部增加如下内容:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?php /*BUG Fix for after wordpress https://core.trac.wordpress.org/ticket/21299*/ add_filter( 'wp_check_filetype_and_ext', 'upload_mimes_fix_after_47', 10, 4 ); function upload_mimes_fix_after_47($data, $file, $filename, $mimes) { global $wp_version; if( $wp_version == '4.7' || ( (float) $wp_version < 4.7 ) ) { return $data; } $filetype = wp_check_filetype( $filename, $mimes ); return [ 'ext' => $filetype['ext'], 'type' => $filetype['type'], 'proper_filename' => $data['proper_filename'] ]; } /*add upload file type*/ add_filter('upload_mimes', 'custom_upload_mimes'); function custom_upload_mimes ( $existing_mimes=array() ) { $existing_mimes['bz2'] = 'application/octet-stream'; return $existing_mimes; } ?> |
YUV420p to RGB & view
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
from PIL import Image import sys from struct import * import array if len(sys.argv) != 4: print "***** Usage syntax Error!!!! *****\n" print "Usage:" print "python <script> <.yuv file yuv420p> <width>> <height> " sys.exit(1) # exit else: pass image_name = sys.argv[1] width = int(sys.argv[2]) height = int(sys.argv[3]) y = array.array('B') u = array.array('B') v = array.array('B') f_y = open(image_name, "rb") f_uv = open(image_name, "rb") f_uv.seek(width*height, 1) image_out = Image.new("RGB", (width, height)) pix = image_out.load() print "width=", width, "height=", height for i in range(0, height/2): for j in range(0, width/2): u.append(ord(f_uv.read(1))); for i in range(0, height/2): for j in range(0, width/2): v.append(ord(f_uv.read(1))); for i in range(0,height): for j in range(0, width): y.append(ord(f_y.read(1))); #print "i=", i, "j=", j , (i*width), ((i*width) +j) #pix[j, i] = y[(i*width) +j], y[(i*width) +j], y[(i*width) +j] Y_val = y[(i*width)+j] U_val = u[((i/2)*(width/2))+(j/2)] V_val = v[((i/2)*(width/2))+(j/2)] B = 1.164 * (Y_val-16) + 2.018 * (U_val - 128) G = 1.164 * (Y_val-16) - 0.813 * (V_val - 128) - 0.391 * (U_val - 128) R = 1.164 * (Y_val-16) + 1.596*(V_val - 128) pix[j, i] = int(R), int(G), int(B) ###################################################### # B = 1.164(Y - 16) + 2.018(U - 128) # G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) # R = 1.164(Y - 16) + 1.596(V - 128) ###################################################### #image_out.save("out.bmp") image_out.show() |
UYVY/YUV422 to RGB and view:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
from PIL import Image import sys from struct import * import array if len(sys.argv) != 4: print "***** Usage syntax Error!!!! *****\n" print "Usage:" print "python <script> <.yuv file uyvy422> <width>> <height> " sys.exit(1) # exit else: pass image_name = sys.argv[1] width = int(sys.argv[2]) height = int(sys.argv[3]) y = array.array('B') u = array.array('B') v = array.array('B') f_uyvy = open(image_name, "rb") f_uv = open(image_name, "rb") f_uv.seek(width*height, 1) image_out = Image.new("RGB", (width, height)) pix = image_out.load() print "width=", width, "height=", height for i in range(0,height): for j in range(0, width/2): u = ord(f_uyvy.read(1)); y1 = ord(f_uyvy.read(1)); v = ord(f_uyvy.read(1)); y2 = ord(f_uyvy.read(1)); B = 1.164 * (y1-16) + 2.018 * (u - 128) G = 1.164 * (y1-16) - 0.813 * (v - 128) - 0.391 * (u - 128) R = 1.164 * (y1-16) + 1.596*(v - 128) pix[j*2, i] = int(R), int(G), int(B) B = 1.164 * (y2-16) + 2.018 * (u - 128) G = 1.164 * (y2-16) - 0.813 * (v - 128) - 0.391 * (u - 128) R = 1.164 * (y2-16) + 1.596*(v - 128) pix[j*2+1, i] = int(R), int(G), int(B) ###################################################### # B = 1.164(Y - 16) + 2.018(U - 128) # G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) # R = 1.164(Y - 16) + 1.596(V - 128) ###################################################### #image_out.save("out.bmp") image_out.show() |
配置Ubuntu要求允许接受restricted、universe和multiverse的软件源,可以根据下面的链接配置:
https://help.ubuntu.com/community/Repositories/Ubuntu
配置成如下图所示即可,一般情况下,这些配置都是默认的。

设置软件源的代码如下:
|
1 |
$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list' |
一旦添加了正确的软件源,操作系统就知道去哪里下载程序,并根据命令自动安装软件。
|
1 |
$ wget http://packages.ros.org/ros.key -O - | sudo apt-key add - |
首先确认你的Debian的软件包索引是最新的。Debian计划是一个致力于创建一个自由操作系统的合作组织。我们所创建的这个操作系统名为 Debian。Debian系统目前采用Linux内核或者FreeBSD内核。
|
1 |
$ sudo apt-get update |
在ROS中有许多不同的函数库和工具,建议是完全安装,也可以根据自己的要求分别安装。完全安装时的工具包括ROS、rqt、可视化环境rviz、通用机器人库robot-generic libraries、2D(如stage)和3D(如Gazebo)仿真环境2D/3D simulators、导航功能包集navigation and 2D/3D(移动、定位、地图绘制、机械臂控制)、感知库perception(如视觉、激光雷达、RGB-D摄像头等)。
|
1 |
$ sudo apt-get install ros-indigo-desktop-full |
rosdep不仅能够使你更方便的安装一些系统依赖程序包,而且ROS的一些主要部件的运行也需要rosdep。
|
1 2 |
$ sudo rosdep init $ rosdep update |
rosinstall命令是一个使用的非常频繁的命令,使用这个命令可以轻松的下载许多ROS软件包。
|
1 |
$ sudo apt-get install python-rosinstall |
添加ROS的环境变量,这样,当你打开你新的shell时,你的bash会话中会自动添加环境变量。
|
1 2 3 |
$ echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc # 使环境变量设置立即生效 $ source ~/.bashrc |
注意:当你用像apt这样的软件包安装管理器安装ROS,那么这些软件包用户是没有权利的去编辑的,当创建一个ROS package和处理一个ROS package时,你应该始终选择一个你有权限工作的目录作为工作目录。
在安装ROS的时候,你会看到提示:source(命令)几个setup.*sh文件,或者甚至添加sourcing到你的shell启动脚本中。这是必须的,因为ROS依赖于结合使用shell环境的概念上。这使得开发依赖不同版本的ROS或者不同系列的package更加容易。
如果你在寻找或者使用你的ROS package上有问题,请确定的你的ROS环境变量设置好了,检查是否有ROS_ROOT和ROS_PACKAGE_PATH这些环境变量。
|
1 |
$ export | grep ROS |
如果没有,你需要source一些setup.*sh文件。
环境设置文件是为你产生的,但是可以来自不同的地方:
注意:rosbuild和catkin是两种组织和编译ROS代码的方式,前者简单易用,后者更加复杂但是提供更多灵活性尤其是对那些需要去集成外部代码或者想发布自己软件的人。
如果你在Ubuntu 14.04上使用apt工具安装ROS,那么你会在'/opt/ros/indigo/'目录中有setup.*sh文件,你可以这样source它们:
|
1 |
$ source /opt/ros/indigo/setup.bash |
你每次打开新的shell都需要运行这个命令,如果你把source /opt/ros/indigo/setup.bash添加进.bashrc文件就不必要每次打开一个新的shell都运行这条命令才能使用ROS的命令了。
对于ROS Groovy和之后的版本可以参考以下方式建立catkin工作环境。在shell中运行:
|
1 2 3 |
$ mkdir -p ~/catkin_ws/src $ cd ~/catkin_ws/src $ catkin_init_workspace |
可以看到在src文件夹中可以看到一个CMakeLists.txt的链接文件,即使这个工作空间是空的(在src中没有package),任然可以建立一个工作空间。
|
1 2 |
$ cd ~/catkin_ws/ $ catkin_make |
catkin_make命令可以非常方便的建立一个catkin工作空间,在你的当前目录中可以看到有build和devel两个文件夹,在devel文件夹中可以看到许多个setup.*sh文件。启用这些文件都会覆盖你现在的环境变量,想了解更多,可以查看文档catkin。在继续下一步之前先启动你的新的setup.*sh 文件。
|
1 |
$ source devel/setup.bash |
为了确认你的环境变量是否被setup脚本覆盖了,可以运行一下命令确认你的当前目录是否在环境变量中:
|
1 |
$ echo $ROS_PACKAGE_PATH |
输出:
|
1 2 |
/home/youruser/catkin_ws/src:/opt/ros/indigo/share: /opt/ros/indigo/stacks |
至此,你的环境已经建立好了,可以继续学习ROS文件系统了!
ubuntu 16.04/ubuntu 17.10下使用wireshark可能会遇到如下权限问题:
|
1 |
Couldn’t run /usr/bin/dumpcap in child process: Permission denied |
也有可能列表中找不到我们抓包的网卡。
可以使用如下方法解决:
1.添加wireshark用户组
|
1 |
$ sudo groupadd wireshark |
2.将dumpcap更改为wireshark用户组
|
1 |
$ sudo chgrp wireshark /usr/bin/dumpcap |
3.让wireshark用户组有root权限使用dumpcap
|
1 |
$ sudo chmod 4755 /usr/bin/dumpcap |
4.将需要使用的用户名(一般都是当前登陆用户)加入wireshark用户组
|
1 |
$ sudo gpasswd -a `whoami` wireshark |
macOS Sierra升级到macOS High Sierra后执行cc,git等命令报错,错误信息如下:
|
1 |
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun |
解决方法如下:
|
1 |
$ xcode-select --install |
按照以往的经验,先安装Windows 7之后,再装CentOS 7,那么CentOS 7应该会自动添加Windows 7启动项。但是安装完成后,发现启动项里没有Windows 7。
我们需要手动添加Windows 7的启动项。
我们需要修改grub2的模版文件,然后执行grub2-mkconfig自动重建grub2引导列表。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$ sudo cp /etc/grub.d/40_custom /etc/grub.d/41_win7_custom $ sudo vi /etc/grub.d/41_win7_custom #!/bin/sh exec tail -n +3 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. menuentry 'Windows 7'{ set root=(hd0,1) chainloader +1 } $ grub2-mkconfig -o /boot/grub2/grub.cfg $ reboot |
至于set root=(hd0,1),还是set root=(hd0,msdos1),或者set root=(hd0,msdosX),请在启动列表中按下e键,进入grub rescue模式,执行ls命令列出分区,如果第一个启动不了,请逐个分区都试试。
hdiutil convert -format UDRW -o destination_file.img source_file.isodiskutil list and determine the device node assigned to your flash media (e.g., /dev/disk2)diskutil unmountDisk /dev/diskN (replace N with the disk number from the last command; in the previous example, N would be 2)sudo dd if=/path/to/destination_file.img.dmg of=/dev/diskN bs=1m (replace /path/to/destination_file.img.dmg with the path where the image file is located; for example, ./win7.img.dmg)
diskutil eject /dev/diskN, and remove your flash media when the command completes (this can take a few hours on slower drives)最近在ThinkPad-T440上安装最新的Ubuntu 17.04的时候,系统提示如下信息:
|
1 |
Oct 21 00:29:34 ThinkPad-T440 kernel: [ 0.000000] [Firmware Bug]: TSC_DEADLINE disabled due to Errata; please update microcode to version: 0x20 (or later) |
通过提示,可以看到是系统的CPU微码部分没有更新到最新,导致系统在执行部分功能的时候发生了异常,升级BIOS可以解决这个问题。
在联想官网上下载最新的BIOS光盘镜像(假定镜像名为BIOSCD.iso)之后,发现无法直接通过U盘启动系统。原因是光盘的镜像格式不符合U盘启动需要的格式,需要进行转换之后才可以正常启动系统。
可以通过如下的方式,转换下载到的镜像文件之后,刷新BIOS。
|
1 2 3 4 5 6 7 8 |
$ sudo apt-get install genisoimage $ geteltorito -o bios.img BIOSCD.iso #找出U盘挂载的位置,假定是/dev/sdb $ df $ sudo dd if=bios.img of=/dev/sdb |
之后,重启系统即可。
1.按照How to successfully build packages for WD My Cloud from source中的介绍,搭建完成WDMyCloud的编译环境
2.使用如下方式编译:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
$ su $ cd ~/wdmc-build/64k-jessie $ chroot build $ mount -t proc none /proc $ mount -t devtmpfs none /dev $ mount -t devpts none /dev/pts $ export DEBIAN_FRONTEND=noninteractive $ export DEBCONF_NONINTERACTIVE_SEEN=true $ export LC_ALL=C $ export LANGUAGE=C $ export LANG=C $ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' $ export DEB_BUILD_OPTIONS=nocheck $ cd root $ apt-get update $ apt-get upgrade $ apt-get install ca-certificates $ apt-get install dh-autoreconf $ apt-get install git $ apt-get install apache2-dev $ apt-get install apache2 $ apt-get install systemtap-sdt-dev $ apt-get install libxml2 $ apt-get install libxml2-dev $ apt-get install libssl-dev $ apt-get install libpcre3 libpcre3-dev $ apt-get install libsqlite3-dev $ apt-get install libbz2-dev $ apt-get install libcurl4-openssl-dev $ apt-get install libqdbm-dev $ apt-get install libdb-dev #configure: error: Cannot find enchant $ apt-get install enchant libenchant-dev #configure: error: webp/decode.h not found $ apt-get install libwebp-dev #configure: error: png.h not found. $ apt-get install libpng-dev #configure: error: xpm.h not found. $ apt-get install libxpm-dev #configure: error: freetype-config not found. $ apt-get install libfreetype6-dev #configure: error: Unable to find gd.h anywhere under /usr $ apt-get install libgd-dev #configure: error: Unable to locate gmp.h $ apt-get install libgmp-dev #configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information. $ apt-get install libc-client-dev #configure: error: Kerberos libraries not found. $ apt-get install libkrb5-dev #configure: error: libfbclient, libgds or libib_util not found! Check config.log for more information. $ apt-get install firebird-dev #configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works. $ apt-get install libicu-dev #configure: error: sasl.h not found! $ apt-get install libsasl2-dev #configure: error: mcrypt.h not found. Please reinstall libmcrypt. $ apt-get install libmcrypt-dev #checking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found! $ apt-get install unixODBC-dev #configure: error: Directory /usr is not a FreeTDS installation directory $ apt-get install FreeTDS-dev #configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path $ apt-get install libpq-dev #configure: error: Cannot find pspell $ apt-get install libpspell-dev #configure: error: Please reinstall libedit - I cannot find readline.h $ apt-get install libedit-dev #configure: error: Can not find recode.h anywhere under /usr /usr/local /usr /opt. $ apt-get install librecode-dev #configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation. $ apt-get install libsnmp-dev #configure: error: Cannot find libtidy $ apt-get install libtidy-dev #checking for XMLRPC-EPI in default path... not found $ apt-get install libxmlrpc-epi-dev #configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution $ apt-get install libxslt-dev #configure: error: Please reinstall the libzip distribution $ apt-get install libzip-dev $ git clone -b master-7.1 https://gitlab.com/deb.sury.org/php.git php7 --depth=1 $ cd php7 #禁用systemd $ sed -i "s/CONFIGURE_SYSTEMD *:= *--with-fpm-systemd/CONFIGURE_SYSTEMD := --without-fpm-systemd/g" debian/rules $ sed -i "s/DH_SYSTEMD *:= *--with systemd/DH_SYSTEMD :=/g" debian/rules $ dpkg-buildpackage -d -b -uc #编译依赖包php-common $ cd .. $ git clone -b debian/50 git://anonscm.debian.org/pkg-php/php-defaults.git $ cd php-defaults #禁用systemd $ sed -i "s/DH_SYSTEMD *:= *--with *systemd/DH_SYSTEMD :=/g" debian/rules $ dpkg-buildpackage -d -b -uc $ exit |
3.编译php-apcu,这个模块WD MyCloud需要
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
$ su $ cd ~/wdmc-build/64k-jessie $ chroot build $ mount -t proc none /proc $ mount -t devtmpfs none /dev $ mount -t devpts none /dev/pts $ export DEBIAN_FRONTEND=noninteractive $ export DEBCONF_NONINTERACTIVE_SEEN=true $ export LC_ALL=C $ export LANGUAGE=C $ export LANG=C $ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' $ export DEB_BUILD_OPTIONS=nocheck $ cd root #安装依赖 $ apt-get install shtool $ apt-get install liblist-moreutils-perl $ apt-get install xml2 # "dch" command $ apt-get install devscripts #安装我们刚刚编译好的PHP7包 $ dpkg -i php-common_50_all.deb $ dpkg -i php7.1-common_7.1.10-1_armhf.deb $ dpkg -i php7.1-readline_7.1.10-1_armhf.deb $ dpkg -i php7.1-opcache_7.1.10-1_armhf.deb $ dpkg -i php7.1-json_7.1.10-1_armhf.deb $ dpkg -i php7.1-cli_7.1.10-1_armhf.deb $ dpkg -i php7.1-dev_7.1.10-1_armhf.deb #编译依赖 $ git clone git://anonscm.debian.org/pkg-php/dh-php.git $ cd dh-php $ git checkout debian/0.26 -b debian/0.26 $ dpkg-buildpackage -d -b -uc $ cd .. $ dpkg -i dh-php_0.26_all.deb #参考 https://packages.debian.org/source/sid/php-apcu # git://anonscm.debian.org/pkg-php/php-apcu.git #https://pecl.php.net/package/APCu $ git clone git://anonscm.debian.org/pkg-php/php-apcu.git $ cd php-apcu $ git checkout debian/5.1.8+4.0.11-1 -b debian/5.1.8+4.0.11-1 #Build the package $ debuild -b -d -uc -us $ cd .. $ dpkg -i php-apcu_5.1.8+4.0.11-1_armhf.deb $ git clone git://anonscm.debian.org/pkg-php/php-apcu-bc.git $ cd php-apcu-bc $ debuild -b -d -uc -us $ exit |
上面下载的代码由于是国外的服务器,因此可能会出现一直无法下载成功的情况,可以从这里下载代码的拷贝。PHP源代码点击这里,PHP7 Debian编译配置文件点击这里,dh-php源代码点击这里,php-apcu源代码点击这里, php-apcu-bc源代码点击这里。
在WDMyCloud中安装的时候执行如下命令:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
$ sudo apt-get update $ sudo apt-get install -y --force-yes php7.1 $ sudo apt-get install -y --force-yes libapache2-mod-php7.1 $ sudo apt-get install -y --force-yes php7.1-curl $ sudo apt-get install -y --force-yes php-apcu $ sudo apt-get install -y --force-yes php-apcu-bc $ sudo apt-get install -y --force-yes php7.1-xml #这个是个坑,如果没有增加这个模块,也是可以正常启动的,但是却没办法正常登录进入,应用会出现异常 $ sudo apt-get install -y --force-yes php7.1-mbstring #由于PHP7中的parse_ini_file不再兼容“#”作为注释字符,只能使用“;”进行注释,但是这个注释无法 #被其他应用读取,而WDMyCloud里面的其他脚本也需要读取/etc/system.conf里面的内容 #目前唯一的解决方法就是删除全部的注释行 # /var/www/htdocs/UI/index.php $ sudo cp /etc/system.conf /etc/system.conf.bak $ sudo sed -i '/^#/d' /etc/system.conf #语法调整 $ sudo cp /var/www/htdocs/UI/views/common/dates.php /var/www/htdocs/UI/views/common/dates.php.bak $ sudo sed -i 's/^<?.*$/<?php/g' /var/www/htdocs/UI/views/common/dates.php #/var/www/htdocs/UI/views/layouts/main/main.php $ sudo cp /etc/php5/apache2/conf.d/include_path.ini /etc/php/7.1/apache2/conf.d/ $ sudo chmod 777 /etc/php/7.1/apache2/conf.d/include_path.ini $ sudo a2dismod php5 $ sudo a2enmod php7.1 $ sudo phpenmod curl $ sudo service apache2 restart |
注意,这部分的功能目前仅仅是可用,还没有达到完全正常的情况,如果出现问题,可以切换回PHP5,目前已知的完美切换回到原来的PHP5的办法就是卸载上面安装的所有PHP7的相关应用才能切换成功,否则总有部分小功能不是太正常.