交叉编译Python-2.7.13到ARM(aarch32)平台
作者:彭东林
邮箱:pengdonglin137@163.com
QQ:405728433
环境
主机: ubuntu14.04 64bit
开发板: qemu + vexpress-a9 (参考: http://www.cnblogs.com/pengdonglin137/p/6442583.html)
工具链: arm-none-linux-gnueabi-gcc (gcc version 4.8.3 20140320)
Python版本: Python-2.7.13
参考
http://www.41443.com/HTML/Python/20151105/414154.html
http://www.cnblogs.com/tolimit/p/4519838.html?utm_source=tuicool&utm_medium=referral
正文
1、下载解压python源码
到https://www.python.org/downloads/下载最新的python2系列的软件,这里我用的是Python-2.7.13
#解压
tar -xf Python-2.7..tar.xz #创建python2_7_13_for_x86_64
mkdir python2_7_13_for_x86_64 #创建python2_7_13_for_arm
mkdir python2_7_13_for_arm
2、编译x86_64版本的python软件
我把编译过程写成了脚本, 进入python2_7_13_for_x86_64/目录,然后执行如下脚本:
配置 mk1_conf.sh
#!/bin/bash ../Python-2.7./configure --prefix=`pwd`
编译mk2_make.sh
#!/bin/bash make -j4
安装 mk3_install.sh
#!/bin/bash make install
3、交叉编译
交叉编译的第一步是为python源码打上交叉编译用的patch:Python-2.7.13-compile.patch.tar.gz
cd Python-2.7./
patch -p1 < ../python2_7_13_for_arm/Python-2.7.-xcompile.patch
我也把编译过程放到脚本,也分为三个:
配置 mk1_conf.sh
#!/bin/bash
export PATH=/home/pengdonglin/src/qemu/aarch32/arm-2014.05/bin:$PATH
../Python-2.7./configure --prefix=`pwd` \
--host=arm-none-linux-gnueabi \
--build=x86_64-linux-gnu \
--enable-ipv6 \
--enable-shared \
ac_cv_file__dev_ptmx="yes" \
ac_cv_file__dev_ptc="no"
编译 mk2_make.sh
#!/bin/bash
export PATH=/home/pengdonglin/src/qemu/aarch32/arm-2014.05/bin:$PATH
make HOSTPYTHON=../python2_7_13_for_x86_64/python \
HOSTPGEN=../python2_7_13_for_x86_64/Parser/pgen \
BLDSHARED="arm-none-linux-gnueabi-gcc -shared" \
CROSS_COMPILE=arm-none-linux-gnueabi- \
CROSS_COMPILE_TARGET=yes \
HOSTARCH=arm-none-linux-gnueabi \
BUILDARCH=x86_64-linux-gnu \
-j4
安装 mk3_install.sh
#!/bin/bash
export PATH=/home/pengdonglin/src/qemu/aarch32/arm-2014.05/bin:$PATH
make install HOSTPYTHON=../python2_7_13_for_x86_64/python \
BLDSHARED="arm-none-linux-gnueabi-gcc -shared" \
CROSS_COMPILE=arm-none-linux-gnueabi- \
CROSS_COMPILE_TARGET=yes \
prefix=`pwd`
4、重新制作ramdisk镜像
参考博文:用Qemu搭建aarch32学习环境
修改mk_ramdisk.sh如下:
#!/bin/bash
sudo rm -rf rootfs
sudo rm -rf tmpfs
sudo rm -rf ramdisk*
sudo mkdir rootfs
sudo cp ../busybox-1.24./_install/* rootfs/ -raf
sudo mkdir -p rootfs/proc/
sudo mkdir -p rootfs/sys/
sudo mkdir -p rootfs/tmp/
sudo mkdir -p rootfs/root/
sudo mkdir -p rootfs/var/
sudo mkdir -p rootfs/mnt/
sudo cp etc rootfs/ -arf
sudo cp -arf ../arm-2014.05/arm-none-linux-gnueabi/libc/lib rootfs/
sudo rm -rf rootfs/lib/*.a
sudo /home/pengdonglin/src/qemu/aarch32/arm-2014.05/bin/arm-none-linux-gnueabi-strip rootfs/lib/*
# 拷贝python相关的文件到根文件系统中
sudo mkdir -p rootfs/usr
pushd rootfs/usr
sudo cp -raf /home/pengdonglin/src/qemu/python_cross_compile/python2_7_13_for_arm/lib .
sudo cp -raf /home/pengdonglin/src/qemu/python_cross_compile/python2_7_13_for_arm/include .
sudo cp -raf /home/pengdonglin/src/qemu/python_cross_compile/python2_7_13_for_arm/bin .
sudo cp -raf /home/pengdonglin/src/qemu/python_cross_compile/python2_7_13_for_arm/share .
sudo /home/pengdonglin/src/qemu/aarch32/arm-2014.05/bin/arm-none-linux-gnueabi-strip lib/python*
popd
sudo mkdir -p rootfs/dev/
sudo mknod rootfs/dev/tty1 c 4 1
sudo mknod rootfs/dev/tty2 c 4 2
sudo mknod rootfs/dev/tty3 c 4 3
sudo mknod rootfs/dev/tty4 c 4 4
sudo mknod rootfs/dev/console c 5 1
sudo mknod rootfs/dev/null c 1 3
sudo mkdir -p rootfs/lib/modules/4\.10\.0\+
sudo mkdir -p rootfs/tools
sudo cp ./other_tools/* rootfs/tools
# 将ramdisk的大小扩展为100MB
sudo dd if=/dev/zero of=ramdisk bs=1M count=100
sudo mkfs.ext4 -F ramdisk
sudo mkdir -p tmpfs
sudo mount -t ext4 ramdisk ./tmpfs/ -o loop
sudo cp -raf rootfs/* tmpfs/
sudo umount tmpfs
sudo gzip --best -c ramdisk > ramdisk.gz
sudo mkimage -n "ramdisk" -A arm -O linux -T ramdisk -C gzip -d ramdisk.gz ramdisk.img
这里需要注意:
1、将刚才交叉编译python所得的文件拷贝到rootfs/usr下面: bin、lib、include和share
2、由于Python的lib目录占用了很大空间,有70MB左右,所以这里我们把ramdisk的大小设置为100MB
3、此外,qemu-system-arm运行的,可以给-m设置较大的物理内存,这里我设置的是1GB
5、修改kernel配置
修改ramdisk的大小设置, 这里我设置的是100MB:
Device Drivers --->
[*] Block devices --->
() Default RAM disk size (kbytes)
6、测试
制作好ramdisk以及编译出新的kernel后,运行系统:
sudo qemu-system-arm \
-M vexpress-a9 \
-m 1024M \
-smp \
-kernel ./linux-4.10/out_aarch32/arch/arm/boot/zImage \
-nographic \
-append "root=/dev/ram0 rw rootfstype=ext4 console=ttyAMA0 init=/linuxrc ignore_loglevel" \
-initrd ./rootfs/ramdisk.img \
-net nic,vlan= -net tap,vlan=,ifname=tap0 \
-dtb ./linux-4.10/out_aarch32/arch/arm/boot/dts/vexpress-v2p-ca9.dtb
$./run.sh
sudo tunctl -u root -t tap0
TUNSETIFF: Device or resource busy
sudo ifconfig tap0 0.0.0.0 promisc up
sudo brctl addif br0 tap0
brctl show
bridge name bridge id STP enabled interfaces
br0 .480fcf3ace87 no eth0
tap0
docker0 .02423772cc85 no
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.10.+ (pengdonglin@pengdonglin-HP) (gcc version 4.8. (prerelease) (Sourcery CodeBench Lite 2014.05-) ) # SMP Mon Mar :: CST
[ 0.000000] CPU: ARMv7 Processor [410fc090] revision (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[ 0.000000] OF: fdt:Machine model: V2P-CA9
[ 0.000000] debug: ignoring loglevel setting.
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] On node totalpages:
[ 0.000000] free_area_init_node: node , pgdat c0a637c0, node_mem_map ef7fa000
[ 0.000000] Normal zone: pages used for memmap
[ 0.000000] Normal zone: pages reserved
[ 0.000000] Normal zone: pages, LIFO batch:
[ 0.000000] HighMem zone: pages, LIFO batch:
[ 0.000000] percpu: Embedded pages/cpu @ef7b5000 s27648 r8192 d21504 u57344
[ 0.000000] pcpu-alloc: s27648 r8192 d21504 u57344 alloc=*
[ 0.000000] pcpu-alloc: [] [] [] []
[ 0.000000] Built zonelists in Zone order, mobility grouping on. Total pages:
[ 0.000000] Kernel command line: root=/dev/ram0 rw rootfstype=ext4 console=ttyAMA0 init=/linuxrc ignore_loglevel
[ 0.000000] log_buf_len individual max cpu contribution: bytes
[ 0.000000] log_buf_len total cpu_extra contributions: bytes
[ 0.000000] log_buf_len min size: bytes
[ 0.000000] log_buf_len: bytes
[ 0.000000] early log buf free: (%)
[ 0.000000] PID hash table entries: (order: , bytes)
[ 0.000000] Dentry cache hash table entries: (order: , bytes)
[ 0.000000] Inode-cache hash table entries: (order: , bytes)
[ 0.000000] Memory: 1007212K/1048576K available (6144K kernel code, 453K rwdata, 1440K rodata, 1024K init, 191K bss, 41364K reserved, 0K cma-reserved, 262144K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 ( kB)
[ 0.000000] vmalloc : 0xf0800000 - 0xff800000 ( MB)
[ 0.000000] lowmem : 0xc0000000 - 0xf0000000 ( MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( MB)
[ 0.000000] .text : 0xc0008000 - 0xc0700000 ( kB)
[ 0.000000] .init : 0xc0900000 - 0xc0a00000 ( kB)
[ 0.000000] .data : 0xc0a00000 - 0xc0a71784 ( kB)
[ 0.000000] .bss : 0xc0a73000 - 0xc0aa2c4c ( kB)
[ 0.000000] SLUB: HWalign=, Order=-, MinObjects=, CPUs=, Nodes=
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] Build-time adjustment of leaf fanout to .
[ 0.000000] RCU restricting CPUs from NR_CPUS= to nr_cpu_ids=.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=, nr_cpu_ids=
[ 0.000000] NR_IRQS: nr_irqs:
[ 0.000000] L2C: platform modifies aux control register: 0x02020000 -> 0x02420000
[ 0.000000] L2C: DT/platform modifies aux control register: 0x02020000 -> 0x02420000
[ 0.000000] L2C- enabling early BRESP for Cortex-A9
[ 0.000000] L2C- full line of zeros enabled for Cortex-A9
[ 0.000000] L2C- dynamic clock gating disabled, standby mode disabled
[ 0.000000] L2C- cache controller enabled, ways, kB
[ 0.000000] L2C-: CACHE_ID 0x410000c8, AUX_CTRL 0x46420001
[ 0.000000] smp_twd: clock not found -
[ 0.000206] sched_clock: bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.002899] clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: ns
[ 0.003447] Failed to initialize '/smb@04000000/motherboard/iofpga@7,00000000/timer@12000': -
[ 0.006792] Console: colour dummy device 80x30
[ 0.007168] Calibrating local timer... .56MHz.
[ 0.063191] Calibrating delay loop... 869.99 BogoMIPS (lpj=)
[ 0.148244] pid_max: default: minimum:
[ 0.149235] Mount-cache hash table entries: (order: , bytes)
[ 0.149279] Mountpoint-cache hash table entries: (order: , bytes)
[ 0.158258] CPU: Testing write buffer coherency: ok
[ 0.158718] ftrace: allocating entries in pages
[ 0.580570] CPU0: thread -, cpu , socket , mpidr
[ 0.584830] Setting up static identity map for 0x60100000 - 0x60100058
[ 0.591663] smp: Bringing up secondary CPUs ...
[ 0.677810] CPU1: thread -, cpu , socket , mpidr
[ 1.623456] CPU2: failed to boot: -
[ 2.569146] CPU3: failed to boot: -
[ 2.569341] smp: Brought up node, CPUs
[ 2.569417] SMP: Total of processors activated (1739.98 BogoMIPS).
[ 2.569500] CPU: All CPU(s) started in SVC mode.
[ 2.599822] devtmpfs: initialized
[ 2.617472] VFP support v0.: implementor architecture part variant rev
[ 2.631508] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: ns
[ 2.632028] futex hash table entries: (order: , bytes)
[ 2.671232] NET: Registered protocol family
[ 2.675992] DMA: preallocated KiB pool for atomic coherent allocations
[ 2.853307] cpuidle: using governor ladder
[ 2.853708] hw-breakpoint: debug architecture 0x4 unsupported.
[ 2.854172] Serial: AMBA PL011 UART driver
[ 2.860429] OF: amba_device_add() failed (-) for /memory-controller@100e0000
[ 2.862876] OF: amba_device_add() failed (-) for /memory-controller@100e1000
[ 2.863329] OF: amba_device_add() failed (-) for /watchdog@100e5000
[ 2.865275] irq: type mismatch, failed to map hwirq- for /interrupt-controller@1e001000!
[ 2.877129] .uart: ttyAMA0 at MMIO 0x10009000 (irq = , base_baud = ) is a PL011 rev1
[ 2.889012] console [ttyAMA0] enabled
[ 2.893012] 1000a000.uart: ttyAMA1 at MMIO 0x1000a000 (irq = , base_baud = ) is a PL011 rev1
[ 2.895140] 1000b000.uart: ttyAMA2 at MMIO 0x1000b000 (irq = , base_baud = ) is a PL011 rev1
[ 2.896620] 1000c000.uart: ttyAMA3 at MMIO 0x1000c000 (irq = , base_baud = ) is a PL011 rev1
[ 2.897695] OF: amba_device_add() failed (-) for /smb@/motherboard/iofpga@,/wdt@0f000
[ 2.979213] SCSI subsystem initialized
[ 2.980067] libata version 3.00 loaded.
[ 2.981102] usbcore: registered new interface driver usbfs
[ 2.981415] usbcore: registered new interface driver hub
[ 2.981690] usbcore: registered new device driver usb
[ 2.988362] Advanced Linux Sound Architecture Driver Initialized.
[ 3.011566] clocksource: Switched to clocksource arm,sp804
[ 3.159190] NET: Registered protocol family
[ 3.164055] TCP established hash table entries: (order: , bytes)
[ 3.164307] TCP bind hash table entries: (order: , bytes)
[ 3.164553] TCP: Hash tables configured (established bind )
[ 3.166386] UDP hash table entries: (order: , bytes)
[ 3.166801] UDP-Lite hash table entries: (order: , bytes)
[ 3.167985] NET: Registered protocol family
[ 3.171676] RPC: Registered named UNIX socket transport module.
[ 3.171948] RPC: Registered udp transport module.
[ 3.172020] RPC: Registered tcp transport module.
[ 3.172115] RPC: Registered tcp NFSv4. backchannel transport module.
[ 3.177825] Trying to unpack rootfs image as initramfs...
[ 3.184610] rootfs image is not initramfs (no cpio magic); looks like an initrd
[ 3.416590] Freeing initrd memory: 22120K
[ 3.420686] hw perfevents: enabled with armv7_cortex_a9 PMU driver, counters available
[ 3.430377] workingset: timestamp_bits= max_order= bucket_order=
[ 3.457911] squashfs: version 4.0 (//) Phillip Lougher
[ 3.463134] jffs2: version 2.2. (NAND) © - Red Hat, Inc.
[ 3.464581] 9p: Installing v9fs 9p2000 file system support
[ 3.470989] bounce: pool size: pages
[ 3.471215] io scheduler noop registered (default)
[ 3.475569] clcd-pl11x .clcd: PL111 designer rev2 at 0x10020000
[ 3.483346] clcd-pl11x .clcd: /clcd@ hardware, 1024x768@ display
[ 3.602322] Console: switching to colour frame buffer device 128x48
[ 3.617254] clcd-pl11x 1001f000.clcd: PL111 designer rev2 at 0x1001f000
[ 3.619006] clcd-pl11x 1001f000.clcd: /smb@/motherboard/iofpga@,/clcd@1f000 hardware, 640x480@ display
[ 3.984710] brd: module loaded
[ 3.991353] .flash: Found x16 devices at 0x0 in -bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[ 3.991791] Intel/Sharp Extended Query Table at 0x0031
[ 3.992447] Using buffer write method
[ 3.992792] erase region : offset=0x0,size=0x80000,blocks=
[ 3.994929] .flash: Found x16 devices at 0x0 in -bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
[ 3.995125] Intel/Sharp Extended Query Table at 0x0031
[ 3.995600] Using buffer write method
[ 3.995708] erase region : offset=0x0,size=0x80000,blocks=
[ 3.995876] Concatenating MTD devices:
[ 3.995986] (): "40000000.flash"
[ 3.996076] (): "40000000.flash"
[ 3.996153] into device "40000000.flash"
[ 4.011057] libphy: Fixed MDIO Bus: probed
[ 4.068484] libphy: smsc911x-mdio: probed
[ 4.071230] smsc911x 4e000000.ethernet eth0: MAC Address: :::::
[ 4.179313] isp1760 4f000000.usb: bus width: , oc: digital
[ 4.181070] isp1760 4f000000.usb: NXP ISP1760 USB Host Controller
[ 4.181548] isp1760 4f000000.usb: new USB bus registered, assigned bus number
[ 4.182418] isp1760 4f000000.usb: Scratch test failed.
[ 4.182705] isp1760 4f000000.usb: can't setup: -19
[ 4.183183] isp1760 4f000000.usb: USB bus deregistered
[ 4.185634] usbcore: registered new interface driver usb-storage
[ 4.192487] mousedev: PS/ mouse device common for all mice
[ 4.201100] rtc-pl031 .rtc: rtc core: registered pl031 as rtc0
[ 4.216680] mmci-pl18x .mmci: Got CD GPIO
[ 4.216979] mmci-pl18x .mmci: Got WP GPIO
[ 4.218707] mmci-pl18x .mmci: mmc0: PL181 manf rev0 at 0x10005000 irq , (pio)
[ 4.272360] ledtrig-cpu: registered to indicate activity on CPUs
[ 4.279939] usbcore: registered new interface driver usbhid
[ 4.280124] usbhid: USB HID core driver
[ 4.321426] input: AT Raw Set keyboard as /devices/platform/smb@/smb@:motherboard/smb@:motherboard:iofpga@,/.kmi/serio0/input/input0
[ 4.326835] aaci-pl041 .aaci: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 33
[ 4.326992] aaci-pl041 .aaci: FIFO entries
[ 4.327894] oprofile: using arm/armv7-ca9
[ 4.331342] NET: Registered protocol family
[ 4.331955] 9pnet: Installing 9P2000 support
[ 4.332582] Registering SWP/SWPB emulation handler
[ 4.348427] rtc-pl031 .rtc: setting system clock to -- :: UTC ()
[ 4.349574] ALSA device list:
[ 4.349669] #: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 33
[ 4.999294] input: ImExPS/ Generic Explorer Mouse as /devices/platform/smb@/smb@:motherboard/smb@:motherboard:iofpga@,/.kmi/serio1/input/input2
[ 5.014045] RAMDISK: gzip image found at block
[ 11.157823] EXT4-fs (ram0): mounted filesystem with ordered data mode. Opts: (null)
[ 11.158866] VFS: Mounted root (ext4 filesystem) on device :.
[ 11.189561] Freeing unused kernel memory: 1024K
[ 12.209586] Generic PHY 4e000000.etherne:: attached PHY driver [Generic PHY] (mii_bus:phy_addr=4e000000.etherne:, irq=-)
[ 12.236870] smsc911x 4e000000.ethernet eth0: SMSC911x/921x identified at 0xf1420000, IRQ:
Please press Enter to activate this console.
[root@vexpress ]#
[root@vexpress ]# [ 31.810292] random: fast init done
[root@vexpress ]#
[root@vexpress ]#
[root@vexpress ]# python
Python 2.7. (default, Mar , ::)
[GCC 4.8. (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> for i in range(): print "hello world"
...
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
>>> [ 236.572628] random: crng init done
完。
交叉编译Python-2.7.13到ARM(aarch32)平台的更多相关文章
- 交叉编译Python-2.7.13到ARM(aarch32)—— 支持sqlite3
作者:彭东林 邮箱:pengdonglin137@163.com QQ: 405728433 环境 主机: ubuntu14.04 64bit 开发板: qemu + vexpress-a9 (参考: ...
- 交叉编译Python-2.7.13到ARM(aarch64)平台
方法跟交叉编译Python-2.7.13到ARM(aarch32)平台基本一样, 不同的地方只是把工具链换成编译aarch64的工具链,这里可以参考用qemu搭建aarch64学习环境. 创建目录: ...
- Windows平台交叉编译Arm Linux平台的QT5.7库
1.准备交叉编译环境 环境说明:Windows 7 64位 此过程需要: (1)Qt库开源代码,我使用的是5.7.0版本: (2)Perl语言环境5.12版本以上: (3)Python语言环境 2.7 ...
- 如何交叉编译Python到ARM-Linux平台(转)
源: 如何交叉编译Python到ARM-Linux平台
- ubuntu 交叉编译qt 5.7 程序到 arm 开发板
ubuntu 交叉编译qt 5.7 程序到 arm 开发板平台1 ubuntu 12.042 arm-linux-gcc 4.5.13 QT 5.74 开发板210 armcortex-A8 一 概述 ...
- Python - Python2与Python3合理共存Windows平台
Install Python2 and Python3 Python 2.7.13 - Windows x86-64 MSI installer Python 3.6.0 - Windows x86- ...
- 设计视图不能用于 x64 和 ARM 目标平台
设计视图不能用于 x64 和 ARM 目标平台
- 【转】IAR IDE for MSP430、8051、ARM等平台的结合使用
IAR IDE for MSP430.8051.ARM等平台的结合使用 以前很长一段时间使用IAR作为MSP430的开发平台,前几天一个无线监控的项目用到了Zigbee(CC2530),于是开始使用I ...
- ARM mbed平台WIZwiki-W7500使用说明
ARM mbed IDE 是ARM内核微控制器的在线开发工具,其站点是:http://developer.mbed.org. 站点提供了在线编译器,不须要本地安装编译器就可以进行开发,因此没有地点.时 ...
随机推荐
- JAVA中浮点数显示
//Java小数点后留两位 double num1 =11; double num2 =21; String num3 =""; //函数可以确定十进制数的显示格式:百分数,限定小 ...
- JavaScript严格模式说明带示例
严格模式(use strict) 目的 消除JS中一些不合理.不严谨之处,减少一些怪异行为 消除代码中的一些不安全之处,保障代码运行安全 提高编译器效率,增加运行速度 为以后的JS新规范做铺垫 兼容性 ...
- CSS3高级选择器
CSS3中添加了一些新的选择器 与之前的不同 这些选择器有些类似于jquery的选择器 能够让我们更高的操作DOM 废话不多说 为了更直观的了解 我们以这段为实例 来进行操作 <!DOCTYPE ...
- Javascript—②函数
新手Perfect教程之Javascript②教程-函数 前言:上回我们是从hello world开始的,本期将会讲"函数" 在学自定义函数之前,先了解几个已经定义好的函数: 1 ...
- groovy学习(五) 命令行输入输出
isr = new InputStreamReader(System.in);br = new BufferedReader(isr);name = br.readLine();println(&qu ...
- idea常用设置
Idea删除当前行的快捷键是Ctrl+y,复制当前行的快捷键是Ctrl+d,和eclipse的习惯不一样.虽然可以一键把idea的快捷键映射成eclipse,但是这样做代价太大,如果这样,idea的官 ...
- 学习ASP.NET MVC(十)——排序
1 按照价格对书籍进行排序 下面我们通过一个简单的例子学习如何对书籍信息按照价格进行排序. 首先,我们在Controllers\BookController.cs文件中的SearchIndex方法添加 ...
- 字符串查找算法总结(暴力匹配、KMP 算法、Boyer-Moore 算法和 Sunday 算法)
字符串匹配是字符串的一种基本操作:给定一个长度为 M 的文本和一个长度为 N 的模式串,在文本中找到一个和该模式相符的子字符串,并返回该字字符串在文本中的位置. KMP 算法,全称是 Knuth-Mo ...
- Angular.js之内置过滤器学习笔记
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- 调用android方法,出现版本太低解决方法
原因如下图所示: 调用需要API级别11,当前是8. 解决方法如下图所示: 点击