pic

Django-C005-说说MVT之外的事情

五迷三道 提交于 2020-01-03 00:25:24
此文章完成度【100%】留着以后忘记的回顾。多写多练多思考,我会努力写出有意思的demo,如果知识点有错误、误导,欢迎大家在评论处写下你的感想或者纠错。 【Django version】: 2.1 【pymysql version】:0.9.3 【python version】: 3.7 【Pillow version】:6.0.0 常用 到此为止,关于Django框架的三大块MVT已经告一段落,让我们扩充一些Django其他的功能,为了更好的完成开发,而努力吧 主要知识点如下: 静态文件处理 中间件 上传图片 admin站点 分页 示例:省市区选择、jquery、ajax 接下来才是每天都最重要的环节,重复重复不断重复的创建项目:   创建项目test5 django-admin startproject test5 进入到项目目录test5,创建应用school cd test5 python manage.py startapp school 在test5下的settings中的INSTALLED_APPS中注册应用 INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django

Reading state of input pins on a PIC18

我怕爱的太早我们不能终老 提交于 2020-01-02 09:44:47
问题 I have been able to get outputs working on my PIC and can make a bunch of LEDs dance on and off as I set various output latches high/low. However, I'm having a lot o difficulty reading in the state of a pin. See the code below. I set up my config, and define the TRISC as input and TRISB as output. In an infinite loop, I check to see whether RC6 is high or low, and set the entire B latch high or low depending on the result. #include <htc.h> __CONFIG(1, FOSC_IRC & FCMEN_OFF & IESO_OFF); _

Reading state of input pins on a PIC18

南楼画角 提交于 2020-01-02 09:43:32
问题 I have been able to get outputs working on my PIC and can make a bunch of LEDs dance on and off as I set various output latches high/low. However, I'm having a lot o difficulty reading in the state of a pin. See the code below. I set up my config, and define the TRISC as input and TRISB as output. In an infinite loop, I check to see whether RC6 is high or low, and set the entire B latch high or low depending on the result. #include <htc.h> __CONFIG(1, FOSC_IRC & FCMEN_OFF & IESO_OFF); _

Set Output Port High Low C

瘦欲@ 提交于 2020-01-01 19:47:39
问题 I'm using MPLAB to compile a program in C using the CCS compiler. I want to set an output port as high or low using defined ports. #bit portOut1 = PORTC.0 So, I want to set my portOut1 high or low. I had used 3 ways to do it, but just one had worked. But I'm not satisfied with that. 1: (Doesn't work, why?) portOut1 = output5.value; 2: (Doesn't work, why?) output_bit(portOut1,value); 3: (Obviously work) output_bit(pin_c0, value); I don't understand why the first and second way doesn't work.

Set Output Port High Low C

谁说胖子不能爱 提交于 2020-01-01 19:47:28
问题 I'm using MPLAB to compile a program in C using the CCS compiler. I want to set an output port as high or low using defined ports. #bit portOut1 = PORTC.0 So, I want to set my portOut1 high or low. I had used 3 ways to do it, but just one had worked. But I'm not satisfied with that. 1: (Doesn't work, why?) portOut1 = output5.value; 2: (Doesn't work, why?) output_bit(portOut1,value); 3: (Obviously work) output_bit(pin_c0, value); I don't understand why the first and second way doesn't work.

Python:把多张图片放在同一个word中

烂漫一生 提交于 2020-01-01 00:28:07
前言:在原部门的最后一天,有个需求,需要分两步完成。 第一步: 有一堆照片在同一个文件夹下,根据excel读取规则,如下图 因为比较乱,所以需要把图片放在一个个按“门店名称”创建的文件夹下,以供部门同事后续核对 from PIL import Image from docx import Document from docx . shared import Inches from docx import enum import openpyxl import shutil import os import traceback file_path = os . path . abspath ( '.' ) #第一部分:把图片根据规则整理到不同的文件夹内 print ( os . listdir ( file_path ) ) pic_path = file_path + '\\' + '5G门头点检' + '\\' # print(pic_path) data = openpyxl . load_workbook ( '图片清单.xlsx' ) data_sheet = data [ 'Sheet1' ] maxrow = data_sheet . max_row + 1 for i in range ( 2 , maxrow ) : store_name = data_sheet

【开源】OSharp框架解说系列(2.1):EasyUI的后台界面搭建及极致重构

落花浮王杯 提交于 2019-12-31 23:22:29
OSharp是什么?   OSharp是个快速开发框架,但不是一个大而全的包罗万象的框架,严格的说,OSharp中什么都没有实现。与其他大而全的框架最大的不同点,就是OSharp只做抽象封装,不做实现。依赖注入、ORM、对象映射、日志、缓存等等功能,都只定义了一套最基础最通用的抽象封装,提供了一套统一的API、约定与规则,并定义了部分执行流程,主要是让项目在一定的规范下进行开发。所有的功能实现端,都是通过现有的成熟的第三方组件来实现的,除了EntityFramework之外,所有的第三方实现都可以轻松的替换成另一种第三方实现,OSharp框架正是要起隔离作用,保证这种变更不会对业务代码造成影响,使用统一的API来进行业务实现,解除与第三方实现的耦合,保持业务代码的规范与稳定。 本文已同步到系列目录: OSharp快速开发框架解说系列 前言   要了解一个东西长什么样,至少得让我们能看到,才能提出针对性的见解。所以,为了言之有物,而不是凭空漫谈,我们先从UI说起,后台管理页面的UI我们将使用应用比较普遍的easyui框架。   以前在用easyui的时候,每个页面都得从0做起,或者不厌其烦地由以前的页面通过“复制-粘贴”的方式来修改,久页久之,就会造成页面庞大且难以维护。其实,前端的html,javascript代码与后端的代码是一样的,通过一定的组织,把重复的代码抽离出来

上传图片

戏子无情 提交于 2019-12-29 22:07:39
<div class="portrait"> <img alt="头像" src="img/male.jpg" id="portrait_pic"> <input type="file" accept="image/*"> <input type="hidden" name="portrait_pic"> </div> $(".portrait input").change(function(){ if(this.files.length==0) { return; } var file = this.files[0]; var reader = new FileReader(); reader.onload = function(e){ $("#portrait_pic").attr("src",e.target.result); $(".portrait input[name='portrait_pic']").val(e.target.result); } reader.readAsDataURL(file); }); 来源: https://www.cnblogs.com/fan-lily/p/5758818.html

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

送分小仙女□ 提交于 2019-12-29 01:38:13
问题 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.

tkinter 图片切割程序

倾然丶 夕夏残阳落幕 提交于 2019-12-28 09:22:03
import tkinter as tk from tkinter import filedialog, messagebox from PIL import Image, ImageTk from collections import namedtuple import enum images = { 'num' : 3, 'path_file' : '' } def image_handle ( ) : def show_pic ( file_path ) : pic = tk.Tk ( ) pic_image = Image.open ( file_path ) w = pic_image.size [ 0 ] h = pic_image.size [ 1 ] pic_size = str ( str ( w ) + 'x' + str ( h )) window.geometry ( pic_size ) pic_tkimage = ImageTk.PhotoImage ( pic_image ) pic_label = tk.Label ( image = pic_tkimage ) pic_label.pack ( ) pic.mainloop ( ) def cut ( name1,d ) : name1 = name1 print ( name1 ) img =