pic

js 点击两张图片来回切换

感情迁移 提交于 2019-11-28 18:15:20
<script> function change_pic() { var imgObj = document.getElementById("caocao_pic"); if (imgObj.getAttribute("src", 2) == "../img/jpg/1.png") { imgObj.src = "img/jpg/2.png"; } else { imgObj.src = "../img/jpg/1.png"; } } </script> <img src="../img/jpg/1.png" class="wujiang_pic_size" id="caocao_pic" onClick="change_pic()" /> 来源: https://www.cnblogs.com/lovebear123/p/11419057.html

抓取百度图片

喜欢而已 提交于 2019-11-28 16:33:15
# -*- coding: utf-8 -*- ''' Created on 2018年3月13日 @author: by ''' # coding=utf-8 """根据搜索词下载百度图片""" import re import sys import urllib import requests def get_onepage_urls(onepageurl): """获取单个翻页的所有图片的urls+当前翻页的下一翻页的url""" if not onepageurl: print('已到最后一页, 结束') return [], '' try: html = requests.get(onepageurl).text except Exception as e: print(e) pic_urls = [] fanye_url = '' return pic_urls, fanye_url pic_urls = re.findall('"objURL":"(.*?)",', html, re.S) fanye_urls = re.findall(re.compile(r'<a href="(.*)" class="n">下一页</a>'), html, flags=0) fanye_url = 'http://image.baidu.com' + fanye_urls[0]

How to reduce the code space for a hexadecimal ASCII chars conversion using a _small_ code space?

ぐ巨炮叔叔 提交于 2019-11-28 13:39:46
How to reduce the code space for a hexadecimal ASCII chars conversion using a small code space? In an embedded application, I have extraordinary limited space (note 1). I need to convert bytes, from serial I/O, with the ASCII values '0' to '9' and 'A' to 'F' to the usual hexadecimal values 0 to 15. Also, all the other 240 combinations, including 'a' to 'f', need to be detected (as an error). Library functions such as scanf(), atoi(), strtol() are far too large to use. Speed is not an issue. Code size is the the limiting factor. My present method re-maps the 256 byte codes into 256 codes such

pak文件的打包和解包

夙愿已清 提交于 2019-11-28 03:08:16
pak格式的文件 一般游戏有资源 游戏素材会打包放进去 比如游戏语音 游戏多加点语音 多加一些贴图资源 外部文件实现的 素材--->pak文件--->用的时候从文件中取出来 文件的打包 1 #include<iostream> 2 #include<fstream>//观于文件的头函数 3 using namespace std; 4 5 struct fileInfo 6 { 7 int fileSize;//文件大小 8 int fileOff;//文件在pak中的偏移 9 int fileNameSize;//文件名的长度 10 char* fileName;//文件名 11 }; 12 int main() 13 { 14 fileInfo pic[4] = { { 0, 0, 0, "背景.jpg" }, { 0, 0, 0, "人物.jpg" }, { 0, 0, 0, "箱子.jpg" }, { 0, 0, 0, "目的地.jpg" } }; 15 //初始化结构体 给结构体内存放数据 16 int listNum = 4, listSize = 8; 17 18 fstream resFile[4];//源文件 19 fstream srcFile;//打包之后的文件 20 for (int i = 0; i < 4; i++) 21 { 22 resFile[i]

@ sign in C variable declaration

不问归期 提交于 2019-11-27 21:55:09
I found this header file for PIC microcontrollers by the name of pic1250.h and I'm unable to get the hang of some syntax used in it. The source for the file is: /* * Header file for the Microchip * PIC 12c508 chip * PIC 12c509 chip * Baseline Microcontrollers */ static volatile unsigned char RTCC @ 0x01; static volatile unsigned char TMR0 @ 0x01; static volatile unsigned char PCL @ 0x02; static volatile unsigned char STATUS @ 0x03; static unsigned char FSR @ 0x04; static volatile unsigned char OSCCAL @ 0x05; static volatile unsigned char GPIO @ 0x06; static unsigned char control OPTION @ 0x00;

Difference between PORT and LATCH on PIC 18F

空扰寡人 提交于 2019-11-27 18:48:17
I already read the datasheet and google but I still don't understand something. In my case, I set PIN RC6 of a PIC18F26K20 in INPUT mode: TRISCbits.TRISC6 = 1; Then I read the value with PORT and LATCH and I have different value! v1 = LATCbits.LATC6; v2 = PORTCbits.RC6; v1 gives me 0 where v2 gives 1. Is it normal? In which case we have to use PORT and in which case LATCH? Mark Rushakoff The latch is the output latch onto which values are written. The port is the voltage at the actual pin. There are a few situations where they can be different. The one that I've encountered most frequently is

博客园添加旋转的正方体特效

送分小仙女□ 提交于 2019-11-27 18:04:40
哇,这个旋转的正方体特效也十分好看呢 参考链接: https://www.cnblogs.com/Trojan00/p/9497480.html 效果展示 具体步骤 将代码复制即可 代码如下:(在 博客侧边栏公告(支持HTML代码)中粘贴即可 ) <style> /*最外层容器样式*/ .wrap { width: 100px; height: 100px; margin: 150px; position: relative; } /*包裹所有容器样式*/ .cube { width: 50px; height: 50px; margin: 0 auto; transform-style: preserve-3d; transform: rotateX(-30deg) rotateY(-80deg); animation: rotate linear 20s infinite; } @-webkit-keyframes rotate { from { transform: rotateX(0deg) rotateY(0deg); } to { transform: rotateX(360deg) rotateY(360deg); } } .cube div { position: absolute; width: 200px; height: 200px; opacity: 0.8

PHP 图片合成、仿微信群头像

做~自己de王妃 提交于 2019-11-27 13:20:18
PHP 图片合成、仿微信群头像 参考文章:   作者:凯歌~, php图片合成方法(多张图片合成一张) 。   经过测试,略作调整和注释,感谢分享。   欢迎提出改善优化意见! 示例代码: /** * 合成图片 * @param array $pic_list [图片列表数组] * @param boolean $is_save [是否保存,true保存,false输出到浏览器] * @param string $save_path [保存路径] * @return boolean|string */ function getGroupAvatar($pic_list=array(),$is_save=false,$save_path=''){ if(empty($pic_list)){ return false; } // 只操作前9个图片 $pic_list = array_slice($pic_list, 0, 9); //设置背景图片宽高 $bg_w = 150; // 背景图片宽度 $bg_h = 150; // 背景图片高度 //新建一个真彩色图像作为背景 $background = imagecreatetruecolor($bg_w,$bg_h); //为真彩色画布创建白灰色背景,再设置为透明 $color = imagecolorallocate(

H264(NAL简介与I帧判断)

别说谁变了你拦得住时间么 提交于 2019-11-27 08:05:33
此文转自: https://www.cnblogs.com/yjg2014/p/6144977.html 1、NAL全称Network Abstract Layer, 即网络抽象层。 在H.264/AVC视频编码标准中,整个系统框架被分为了两个层面:视频编码层面(VCL)和网络抽象层面(NAL)。其中,前者负责有效表示视频数据的内容,而后者则负责格式化数据并提供头信息,以保证数据适合各种信道和存储介质上的传输。因此我们平时的每帧数据就是一个NAL单元(SPS与PPS除外)。在实际的H264数据帧中,往往帧前面带有00 00 00 01 或 00 00 01分隔符,一般来说编码器编出的首帧数据为PPS与SPS,接着为I帧…… 2、如何判断帧类型(是图像参考帧还是I、P帧等)? NALU类型是我们判断帧类型的利器,从官方文档中得出如下图: 我们还是接着看最上面图的码流对应的数据来层层分析,以00 00 00 01分割之后的下一个字节就是NALU类型,将其转为二进制数据后,解读顺序为从左往右算,如下: (1)第1位禁止位,值为1表示语法出错 (2)第2~3位为参考级别 (3)第4~8为是nal单元类型 例如上面00000001后有67,68以及65 其中0x67的二进制码为: 0110 0111 4-8为00111,转为十进制7,参考第二幅图:7对应序列参数集SPS

gcc/g++编译选项: -fPIC

旧时模样 提交于 2019-11-27 05:11:13
在理解PIC概念之前,先了解一下动态链接库的载入时重定位概念。 载入时重定位: 我们知道,Linux的可执行文件一般是elf格式的,在这个可执行文件的头部包含了很多重要的信息:如文件格式,加载地址,符号表等。当连接器链接生成可执行文件时,会将程序的加载地址写入可执行文件头。在程序运行时,动态加载器将可执行文件载入文件头指定的加载地址处,并加载该地址,开始从该地址处运行。由此可见,可执行文件的起始地址是在编译时就决定的: ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Advanced Micro Devices X86-64 Version: 0x1 Entry point address: 0x4005b0 // 程序入口地址 Start of program headers: 64 (bytes into file) Start of section headers: 4472 (bytes into