升级gradle后混淆代码出错…
android studio 每次更新都是大麻烦。
上次更新更新混淆命令改成了“minifyEnabled true”,折腾了半天。
这次更新混淆又变化了,原来“proguardFile ‘proguard-rules.txt’” 指定混淆文件,这次变成了 “proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.txt’”
次次更新不兼容,实在太坑了。
android studio 每次更新都是大麻烦。
上次更新更新混淆命令改成了“minifyEnabled true”,折腾了半天。
这次更新混淆又变化了,原来“proguardFile ‘proguard-rules.txt’” 指定混淆文件,这次变成了 “proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.txt’”
次次更新不兼容,实在太坑了。
html、js、css
http://jsfiddle.net/
http://runjs.cn/code
C,C++,D,Haskell,Lua,OCaml,PHP,Perl,Plain Text,Python,Ruby,Scheme,Tcl等
https://eval.in/
http://codepad.org/
http://tool.lu/coderunner
http://cogug.com/
https://coderpad.io/
http://cyber-dojo.org/setup/show/
http://www.tutorialspoint.com/codingground.htm
http://codevs.cn/
Scala
http://zh.scala-tour.com/#/hello-wolrd
在线IDE
https://koding.com/
API测试
https://apigee.com/console/
http://www.bejson.com/go.html?u=http://www.bejson.com/httppost/
httpbin(1): HTTP Request & Response Service
http://httpbin.org/
http://ifconfig.me/
正则
https://regex101.com/
http://www.regexr.com/
https://regex101.com/
正则表达式图形分析
远程唤醒
http://www.depicus.com/wake-on-lan/woli.aspx
html、xml、css、json、javaScript、java、sql格式化
http://tool.oschina.net/codeformat/json
http://tool.oschina.net/
http://www.kjson.com/
http://www.useol.com/
ping、TraceRoute、dns
http://alibench.com/
http://ping.pe/
http://www.ipip.net/ping.php
http://www.17ce.com/
http://ce.cloud.360.cn/
http://ping.chinaz.com/
Base64
http://www.kjson.com/encrypt/base64/
http://tool.chinaz.com/Tools/Base64.aspx
http://tool.oschina.net/
浏览器指纹
http://whoer.net/extended
https://whatleaks.com/
https://panopticlick.eff.org/
http://www.ip-score.com/
https://ipleak.net/
https://www.browserleaks.com/canvas
http://www.lalit.org/lab/javascript-css-font-detect/
在线pdf阅读
http://www.useol.com/pdfReader/
在线Crontab表达式执行时间验证
http://www.atool.org/crontab.php
在线 htpasswd 生成器工具
http://www.atool.org/htpasswd.php
在线端口扫描
http://www.atool.org/port_scanner.php
在线抓包
http://www.atool.org/port_scanner.php
NAT 连通性测试
http://cc.rtmfp.net/
linaro@cubieboard:~$aptitude install cups
linaro@cubieboard:~$ sudo vi /etc/cups/cupsd.conf
# 修改相关的内容
Listen 0.0.0.0:631
Browsing On
# Restrict access to the server...
Order allow,deny
Allow All
# Restrict access to the admin pages...
Order allow,deny
Allow All
# Restrict access to configuration files...
AuthType Default
Allow All
Require user @SYSTEM
Order allow,deny
linaro@cubieboard:~$ sudo usermod -aG lpadmin 账号名
linaro@cubieboard:~$ sudo /etc/init.d/cups restart
现在访问 http://ip:631 可以看到cups的管理界面,选择”Adding Printers and Classes”输入账号及密码,正常情况下应该把打印机识别出来了,按说明填写即可。
我这里型号没找到,只能自己在 http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX 下载的驱动,然后从里面找到打印机的ppd文件上传到 cups 上面的。
打印测试页却发现无法打印,提示 Idle – “File “/opt/epson-inkjet-printer-201207w/cups/lib/filter/epson_inkjet_printer_filter” not available: No such file or directory” ,在官方网站没有找到 arm 的驱动,无奈下载
epson-inkjet-printer-201207w-1.0.0-1lsb3.2.src.rpm 。 alien rpm 提示 is for architecture amd64 ; the package cannot be built on this system,无法使用,只能自己也压缩编译了。
linaro@cubieboard:~/epson-inkjet-printer-filter-1.0.0$ sudo aptitude install libcups2-dev
linaro@cubieboard:~/epson-inkjet-printer-filter-1.0.0$ sudo aptitude install libcupsimage2-dev
linaro@cubieboard:~$ rpm2cpio epson-inkjet-printer-201207w-1.0.0-1lsb3.2.src.rpm | cpio -div
epson-inkjet-printer-201207w-1.0.0.tar.gz
epson-inkjet-printer-201207w.spec
epson-inkjet-printer-filter-1.0.0.tar.gz
4991 blocks
linaro@cubieboard:~$ tar -xzf epson-inkjet-printer-filter-1.0.0.tar.gz
linaro@cubieboard:~$ cd epson-inkjet-printer-filter-1.0.0/
linaro@cubieboard:~/epson-inkjet-printer-filter-1.0.0$ ./configure --prefix=/opt
linaro@cubieboard:~/epson-inkjet-printer-filter-1.0.0$ make
linaro@cubieboard:~/epson-inkjet-printer-filter-1.0.0$ make install
linaro@cubieboard:/opt$ sudo mkdir -p /opt/epson-inkjet-printer-201207w/cups/lib/filter/
linaro@cubieboard:/opt$ sudo ln -s /opt/lib/cups/filter/epson_inkjet_printer_filter /opt/epson-inkjet-printer-201207w/cups/lib/filter/epson_inkjet_printer_filter
linaro@cubieboard:/opt$ sudo /etc/init.d/cups restart
sudo aptitude install lsb # 这个也许需要安装。
好了,打印机安装完毕。可以 windows 远程使用了。现在打开 http://IP:361/printers/ 找到安装的打印机,点开他,然后把这个 URL 拷贝下来。在WINDOWS 下 打印机 => 添加打印机 => 添加网络、无线或 Bluetooth 打印机我这里直接自动就把打印机搜索出来了,如果没有搜索出来,需要手工输入之前拷贝下来的 URL ,然后会提示需要驱动,我这里自动搜索驱动没成功,手工选择的对应驱动。继续下一步,接着可以打印测试页试一下,一切正常的话应该打印出来了。
目前还有一个问题是,在 http://IP:361/printers/ 打印测试页时出错,目前先这样吧,反正很少直接在cups打印测试页,都是在windows下操作,windows下操作没有问题。
另附编译好的驱动及ppd文件,具体能用到哪些打印机就不确定了…
linaro@cubieboard:~$ sudo aptitude install smartmontools
linaro@cubieboard:~$ sudo smartctl -a /dev/sda
smartctl 6.2 2013-07-26 r3841 [armv7l-linux-3.4.79] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda 7200.10
Device Model: ST3160815AS
Serial Number: 6RA0H0PJ
Firmware Version: 3.AAC
User Capacity: 160,041,885,696 bytes [160 GB]
Sector Size: 512 bytes logical/physical
Device is: In smartctl database [for details use: -P show]
ATA Version is: ATA/ATAPI-7 (minor revision not indicated)
Local Time is: Tue Apr 28 10:24:05 2015 UTC
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
See vendor-specific Attribute list for marginal Attributes.
General SMART Values:
Offline data collection status: (0x82) Offline data collection activity
was completed without error.
Auto Offline Data Collection: Enabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: ( 430) seconds.
Offline data collection
capabilities: (0x5b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
No Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 1) minutes.
Extended self-test routine
recommended polling time: ( 54) minutes.
SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000f 112 095 006 Pre-fail Always - 42480436
3 Spin_Up_Time 0x0003 098 097 000 Pre-fail Always - 0
4 Start_Stop_Count 0x0032 094 094 020 Old_age Always - 6735
5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 0
7 Seek_Error_Rate 0x000f 089 060 030 Pre-fail Always - 833016196
9 Power_On_Hours 0x0032 067 067 000 Old_age Always - 28938
10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 094 094 020 Old_age Always - 6263
187 Reported_Uncorrect 0x0032 082 082 000 Old_age Always - 18
189 High_Fly_Writes 0x003a 094 094 000 Old_age Always - 6
190 Airflow_Temperature_Cel 0x0022 044 039 045 Old_age Always FAILING_NOW 56 (Min/Max 53/57)
194 Temperature_Celsius 0x0022 056 061 000 Old_age Always - 56 (0 2 0 0 0)
195 Hardware_ECC_Recovered 0x001a 072 060 000 Old_age Always - 170581721
197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 1
198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 1
199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0
200 Multi_Zone_Error_Rate 0x0000 100 253 000 Old_age Offline - 0
202 Data_Address_Mark_Errs 0x0032 100 253 000 Old_age Always - 0
SMART Error Log Version: 1
ATA Error Count: 18 (device log contains only the most recent five errors)
CR = Command Register [HEX]
FR = Features Register [HEX]
SC = Sector Count Register [HEX]
SN = Sector Number Register [HEX]
CL = Cylinder Low Register [HEX]
CH = Cylinder High Register [HEX]
DH = Device/Head Register [HEX]
DC = Device Command Register [HEX]
ER = Error register [HEX]
ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.
Error 18 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 96 a5 6d e0 Error: UNC at LBA = 0x006da596 = 7185814
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
25 00 08 8f a5 6d e0 00 00:01:07.094 READ DMA EXT
25 00 08 87 a5 6d e0 00 00:01:07.094 READ DMA EXT
25 00 08 7f a5 6d e0 00 00:01:07.094 READ DMA EXT
25 00 08 77 a5 6d e0 00 00:01:07.088 READ DMA EXT
25 00 08 6f a5 6d e0 00 00:01:07.088 READ DMA EXT
Error 17 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 96 a5 6d e0 Error: UNC at LBA = 0x006da596 = 7185814
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
25 00 68 4f a5 6d e0 00 00:01:03.681 READ DMA EXT
25 00 00 37 9d 6b e0 00 00:01:03.679 READ DMA EXT
25 00 00 37 9c 6b e0 00 00:01:03.677 READ DMA EXT
25 00 00 b7 9a 6b e0 00 00:01:03.669 READ DMA EXT
25 00 00 b7 99 6b e0 00 00:01:03.669 READ DMA EXT
Error 16 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 96 a5 6d e0 Error: UNC at LBA = 0x006da596 = 7185814
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
25 00 08 8f a5 6d e0 00 00:20:34.997 READ DMA EXT
25 00 08 87 a5 6d e0 00 00:20:34.997 READ DMA EXT
25 00 08 7f a5 6d e0 00 00:20:34.997 READ DMA EXT
25 00 08 77 a5 6d e0 00 00:20:34.997 READ DMA EXT
25 00 08 6f a5 6d e0 00 00:20:34.996 READ DMA EXT
Error 15 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 96 a5 6d e0 Error: UNC at LBA = 0x006da596 = 7185814
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
25 00 68 4f a5 6d e0 00 00:20:31.667 READ DMA EXT
25 00 00 37 9d 6b e0 00 00:20:31.657 READ DMA EXT
25 00 00 37 9c 6b e0 00 00:20:31.654 READ DMA EXT
25 00 00 b7 9a 6b e0 00 00:20:31.643 READ DMA EXT
25 00 00 b7 99 6b e0 00 00:20:31.641 READ DMA EXT
Error 14 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 96 a5 6d e0 Error: UNC at LBA = 0x006da596 = 7185814
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
25 00 08 8f a5 6d e0 00 00:09:29.947 READ DMA EXT
25 00 08 87 a5 6d e0 00 00:09:29.947 READ DMA EXT
25 00 08 7f a5 6d e0 00 00:09:29.947 READ DMA EXT
25 00 08 77 a5 6d e0 00 00:09:29.947 READ DMA EXT
25 00 08 6f a5 6d e0 00 00:09:29.946 READ DMA EXT
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 14609 -
# 2 Short offline Aborted by host 90% 14609 -
# 3 Short offline Completed without error 00% 14380 -
SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
linaro@cubieboard:~$ sudo hdparm -I /dev/sda
/dev/sda:
ATA device, with non-removable media
Model Number: ST3160815AS
Serial Number: 6RA0H0PJ
Firmware Revision: 3.AAC
Standards:
Supported: 7 6 5 4
Likely used: 7
Configuration:
Logical max current
cylinders 16383 16383
heads 16 16
sectors/track 63 63
--
CHS current addressable sectors: 16514064
LBA user addressable sectors: 268435455
LBA48 user addressable sectors: 312581808
Logical Sector size: 512 bytes
Physical Sector size: 512 bytes
device size with M = 1024*1024: 152627 MBytes
device size with M = 1000*1000: 160041 MBytes (160 GB)
cache/buffer size = 8192 KBytes
Capabilities:
LBA, IORDY(can be disabled)
Queue depth: 32
Standby timer values: spec'd by Standard, no device specific minimum
R/W multiple sector transfer: Max = 16 Current = ?
Recommended acoustic management value: 208, current value: 0
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=120ns IORDY flow control=120ns
Commands/features:
Enabled Supported:
* SMART feature set
Security Mode feature set
* Power Management feature set
* Write cache
* Look-ahead
* Host Protected Area feature set
* WRITE_BUFFER command
* READ_BUFFER command
* DOWNLOAD_MICROCODE
SET_MAX security extension
* 48-bit Address feature set
* Device Configuration Overlay feature set
* Mandatory FLUSH_CACHE
* FLUSH_CACHE_EXT
* SMART error logging
* SMART self-test
* General Purpose Logging feature set
* Gen1 signaling speed (1.5Gb/s)
* Native Command Queueing (NCQ)
* Phy event counters
Device-initiated interface power management
* Software settings preservation
Security:
Master password revision code = 65534
supported
not enabled
not locked
not frozen
not expired: security count
not supported: enhanced erase
Checksum: correct
linaro@cubieboard:~$ sudo smartctl -H /dev/sda
smartctl 6.2 2013-07-26 r3841 [armv7l-linux-3.4.79] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
Please note the following marginal Attributes:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
190 Airflow_Temperature_Cel 0x0022 043 039 045 Old_age Always FAILING_NOW 57 (0 2 57 53 0)
检测磁盘驱动的健康程度SMART
http://www.linuxidc.com/Linux/2014-07/104674.htm
接着上一篇继续
安装 samba ,这里先安装 aptitude 。第一次时是用 apt-get 来安装的 samba ,结果出现包依赖错误,系统都挂了…
linaro@cubieboard:~$ sudo apt-get install aptitude
slinaro@cubieboard:~$ sudo aptitude update
linaro@cubieboard:~$ sudo aptitude safe-upgrade
linaro@cubieboard:~$ sudo aptitude install samba
下面配置账号。
linaro@cubieboard:~$ sudo adduser gftp
Adding user `gftp' ...
Adding new group `gftp' (1002) ...
Adding new user `gftp' (1001) with group `gftp' ...
Creating home directory `/home/gftp' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for gftp
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
linaro@cubieboard:~$ sudo usermod -a -G gftp linaro
linaro@cubieboard:/mnt/100g$ sudo chown gftp:gftp /mnt/100g
linaro@cubieboard:/mnt/100g$ sudo chmod ug+w /mnt/100g
linaro@cubieboard:~$ sudo smbpasswd -a gftp
New SMB password:
Retype new SMB password:
Added user gftp.
linaro@cubieboard:~$ sudo vi /etc/samba/smb.conf
# 追加以下内容:
[gftp_100g]
path = /mnt/100g
available = yes
valid users = gftp
read only = no
browseable = yes
public = yes
writable = yes
linaro@cubieboard:~$ sudo service smbd restart
smbd stop/waiting
smbd start/running, process 24739
好了,现在可以在 windows 下使用 \\IP 来访问共享了。
实测 win7 往 cubieboard 拷贝大文件速度在 9.77M -10.1M之间,应该是cubieboard 100M网卡的性能限制的。
参考:
How to Create a Network Share Via Samba Via CLI (Command-line interface/Linux Terminal) – Uncomplicated, Simple and Brief Way!
https://help.ubuntu.com/community/How%20to%20Create%20a%20Network%20Share%20Via%20Samba%20Via%20CLI%20%28Command-line%20interface/Linux%20Terminal%29%20-%20Uncomplicated,%20Simple%20and%20Brief%20Way!
今天把很早之前的 cubieboard 翻了出来,打算做 nas 。缺点是网卡是100M的。
现在的tf安装的 linaro server 14.04 系统。
tf卡是:三星(SAMSUNG)16GB UHS-1 Class10 TF(Micro SD)存储卡(读速48Mb/s)升级版
http://item.jd.com/763749.html
tf 卡速度为:
linaro@cubieboard:~$ sudo time dd if=/dev/zero bs=1024 count=1000000 of=/1Gb.file
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 106.254 s, 9.6 MB/s
0.83user 20.45system 1:46.26elapsed 20%CPU (0avgtext+0avgdata 640maxresident)k
8inputs+2000000outputs (1major+208minor)pagefaults 0swaps
linaro@cubieboard:~$ time dd if=/1Gb.file bs=64k |dd of=/dev/null
15625+0 records in
15625+0 records out
1024000000 bytes (1.0 GB) copied, 66.1161 s, 15.5 MB/s
2000000+0 records in
2000000+0 records out
1024000000 bytes (1.0 GB) copied, 66.1271 s, 15.5 MB/s
real 1m6.146s
user 0m2.350s
sys 0m17.540s
找了一块古董100g硬盘来做测试。
linaro@cubieboard:~$ sudo fdisk -l
....
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe467e467
Device Boot Start End Blocks Id System
....
fdisk 列出硬盘分区,硬盘的分区已经预先删干净了,下面新建一个主分区,并建立文件系统。
linaro@cubieboard:~$ sudo fdisk /dev/sda
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-312581807, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-312581807, default 312581807): +1G
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 2):
Using default value 2
First sector (2099200-312581807, default 2099200):
Using default value 2099200
Last sector, +sectors or +size{K,M,G} (2099200-312581807, default 312581807):
Using default value 312581807
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 82
Changed system type of partition 1 to 82 (Linux swap / Solaris)
Command (m for help): p
Disk /dev/sda: 160.0 GB, 160041885696 bytes
81 heads, 63 sectors/track, 61254 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe467e467
Device Boot Start End Blocks Id System
/dev/sda1 2048 2099199 1048576 82 Linux swap / Solaris
/dev/sda2 2099200 312581807 155241304 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
linaro@cubieboard:~$ sudo mkswap /dev/sda1
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=d1ba1e55-5eac-4226-9a2d-cda6eec6a84e
linaro@cubieboard:~$ sudo mkfs.ext4 /dev/sda2
mke2fs 1.42.9 (4-Feb-2014)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
9773056 inodes, 39072470 blocks
1953623 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1193 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks):
done
Writing superblocks and filesystem accounting information:
done
建立目录,挂载分区。
linaro@cubieboard:~$ sudo mkdir /mnt/100g
linaro@cubieboard:/mnt/100g$ cat /etc/fstab
# UNCONFIGURED FSTAB FOR BASE SYSTEM
tmpfs /tmp tmpfs size=20m 0 0
/dev/sda1 none swap defaults 0 0
/dev/sda2 /mnt/100g ext4 defaults,noatime 0 2
linaro@cubieboard:~$ sudo swapon /dev/sda1
linaro@cubieboard:~$ sudo mount -a
linaro@cubieboard:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 7.3G 1.5G 5.6G 21% /
devtmpfs 493M 4.0K 493M 1% /dev
none 4.0K 0 4.0K 0% /sys/fs/cgroup
tmpfs 20M 0 20M 0% /tmp
none 99M 244K 99M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 493M 0 493M 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/sda2 147G 188M 140G 1% /mnt/100g
跑磁盘性能测试
linaro@cubieboard:/mnt/100g$ sudo time dd if=/dev/zero bs=1024 count=1000000 of=/mnt/100g/1Gb.file
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 52.1182 s, 19.6 MB/s
0.85user 20.33system 0:52.13elapsed 40%CPU (0avgtext+0avgdata 640maxresident)k
8inputs+2000056outputs (0major+217minor)pagefaults 0swaps
linaro@cubieboard:/mnt/100g$ time dd if=/mnt/100g/1Gb.file bs=64k |dd of=/dev/null
15625+0 records in
15625+0 records out
1024000000 bytes (1.0 GB) copied, 39.456 s, 26.0 MB/s
2000000+0 records in
2000000+0 records out
1024000000 bytes (1.0 GB) copied, 39.469 s, 25.9 MB/s
real 0m39.494s
user 0m2.220s
sys 0m20.660s
linaro@cubieboard:/mnt/100g$
性能并不好,不过由于网卡只有100M,NAS 瓶颈并不在磁盘,而是在网络…
参考:
linux测试硬盘读写速度
http://5iwww.blog.51cto.com/856039/432290
cubieboard的sata评测
http://raspiweb.ch/post-56.htm
ubuntu 自带的 redis 版本太老了,居然是去年1月的版本。决定自己编译安装新版本。
sudo aptitude install build-essential
sudo aptitude install tcl # 可能需要指定版本
wget http://download.redis.io/redis-stable.tar.gz
tar xzf redis-stable.tar.gz
cd redis-stable
make
make test
redis-server Redis 服务器文件.
redis-sentinel 守护程序 (监控和故障转移).
redis-cli 命令行界面工具.
redis-benchmark 基准测试.
redis-check-aof and redis-check-dump 损坏数据修复工具.
手动拷贝文件到需要的地方时一个好主意。
sudo cp src/redis-server /usr/local/bin/
sudo cp src/redis-cli /usr/local/bin/
也可以使用 make install.
测试时出现过下面的错误,原因是内存不足,完整测试大约需要300M内存,加大内存即可。
[err]: Slave should be able to synchronize with the master in tests/integration/replication-psync.tcl
Replication not started.
[ok]: AOF rewrite of list with linkedlist encoding, int data
[ok]: EVAL does not leak in the Lua stack
[ok]: EVAL processes writes from AOF in read-only slaves
[ok]: We can call scripts rewriting client->argv from Lua
[ok]: Call Redis command with many args from Lua (issue #1764)
[ok]: Number conversion precision test (issue #1118)
[ok]: String containing number precision test (regression of issue #1118)
[ok]: Verify negative arg count is error instead of crash (issue #1842)
[ok]: Correct handling of reused argv (issue #1939)
I/O error reading reply
[exception]: Executing test client: I/O error reading reply.
I/O error reading reply
while executing
参考:
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-redis
http://redis.io/topics/quickstart
Redis 命令参考
http://redis.readthedocs.org/en/latest/index.html
持久化(persistence)
http://redis.readthedocs.org/en/latest/topic/persistence.html
一个客户端加入了 gdebug.ping 房间,服务器用 socket.to(“gdebug.ping”).emit(“gdebug.info”,data); 发消息,怎么试就试收不到。。。
最后发现把 . 去掉,改成 gdebug ping 就能收到消息了。
socket.io 文档太简单了,很多资料都没有。
ET.fromstring 传进去 unicode 字符串提示 UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 76-99: ordinal not in range(128)。
encode(‘utf-8′) 后传进去提示 ValueError: multi-byte encodings are not supported,不支持多字节编码。
python 的中文支持真是头痛,这个如果用 sys.setdefaultencoding=’utf-8’ 可以解决,但是觉得直接为了这个直接修改了全局编码不太好,最后发现可以用如下代码解决:
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
utf8_parser = ET.XMLParser(encoding='utf-8')
tree = ET.parse(StringIO(r.text.encode('utf-8')), parser=utf8_parser)
root=tree.getroot()
https://gist.github.com/GameXG/89b92a9a94456ff2da85
刚开始使用 Android Studio 结果发布时不混淆代码,已经在设置里面配置了 proguardFile ,但发布时还是没有混淆代码,也没有生成mapping.txt文件.
从网上搜索出来的全是
buildTypes {
release {
runProguard true
proguardFile ‘proguard-rules.txt’
}
增加了 runProguard true 后直接报如下错误:
Error:(41, 0) Gradle DSL method not found: ‘runProguard()’
Possible causes:
无奈跑到 Android Tools Project Site 翻文档发现0.14.0 (2014/10/31) runProguard 改名成了 minifyEnabled ,照着操作就可以了.
参考:
http://tools.android.com/tech-docs/new-build-system
http://tools.android.com/tech-docs/new-build-system/user-guide
http://developer.android.com/tools/help/proguard.html