Django项目之图书馆项目

1.项目架构

2.表结构设计

from django.db import models

# Create your models here.

#作者详情表
class AuthorDeatil(models.Model):
nid = models.AutoField(primary_key=True)
birthday = models.DateField()
telephone = models.BigIntegerField()
addr = models.CharField(max_length=64) # 出版社表
class Publish(models.Model):
nid = models.AutoField(primary_key=True)
name = models.CharField(max_length=32)
city = models.CharField(max_length=32)
email = models.EmailField() # 书籍表
class Book(models.Model):
nid = models.AutoField(primary_key=True)
title = models.CharField(max_length=32)
publishDate = models.DateField()
price = models.DecimalField(max_digits=5, decimal_places=2)
publish = models.ForeignKey(to="Publish", to_field="nid", on_delete=models.CASCADE)
# 多对多关系表
authors = models.ManyToManyField(to='Author') def __str__(self):
return self.title # 作者表
class Author(models.Model):
nid = models.AutoField(primary_key=True)
name = models.CharField(max_length=32)
age = models.IntegerField()
authordetail = models.OneToOneField(to="AuthorDeatil", to_field="nid", on_delete=models.CASCADE) def __str__(self):
return self.name

models.py

3.Settings设计

"""
Django settings for book_sys2 project. Generated by 'django-admin startproject' using Django 2.1.2. For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/ For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
""" import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '39as(vby5vue!jq@tvs+xuaksiv7+r(964)c-xv8ysh05a9rww' # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'app01.apps.App01Config',
] MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
] ROOT_URLCONF = 'book_sys2.urls' TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')]
,
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
] WSGI_APPLICATION = 'book_sys2.wsgi.application' # Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
} # Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
] # Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/ STATIC_URL = '/static/' STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)

settings.py

4.路由设计

"""book_sys2 URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path
from app01 import views urlpatterns = [
path('admin/', admin.site.urls),
re_path('index/$', views.index),
re_path('index/add/$', views.add_book),
re_path('books/(\d+)/change/$', views.change_book),
re_path('books/(\d+)/delete/$', views.delete_book),
]

urls.py

5.视图设计

from django.shortcuts import render, HttpResponse, redirect
from .models import Publish, Author, Book, AuthorDeatil
# Create your views here. def add_book(request):
if request.method == "POST":
title = request.POST.get("title")
price = request.POST.get("price")
pub_date = request.POST.get("pub_date")
publish_id = request.POST.get("publish_id")
authors_id_list = request.POST.getlist("authors_id_list")
book_obj = Book.objects.create(title=title, price=price, publishDate=pub_date, publish_id=publish_id)
book_obj.authors.add(*authors_id_list)
return redirect("/index/")
publish_list = Publish.objects.all()
author_list = Author.objects.all()
return render(request, "addbook.html", locals()) def index(request):
book_list = Book.objects.all()
pub_list = Publish.objects.all()
au_list = Author.objects.all()
au_name = []
pu_name = []
for n in au_list:
au_name.append(n.name)
for n in pub_list:
pu_name.append(n.name)
if request.method == "POST":
name = request.POST.get('name')
# print(name)
# 根据作者拿到所有的书本
if name in au_name:
author_obj = Author.objects.get(name=name)
book_list_1 = author_obj.book_set.all()
# 根据出版社拿到所有的书本
elif name in pu_name:
pub_obj = Publish.objects.get(name=name)
book_list_1 = pub_obj.book_set.all()
return render(request, "index.html", locals())
# return HttpResponse("OK") def change_book(request, edit_id):
edit_book_obj = Book.objects.filter(pk=edit_id).first()
publish_list = Publish.objects.all()
author_list = Author.objects.all()
if request.method == "POST":
title = request.POST.get("title")
price = request.POST.get("price")
pub_date = request.POST.get("pub_date")
publish_id = request.POST.get("publish_id")
authors_id_list = request.POST.getlist("authors_id_list")
Book.objects.filter(pk=edit_id).update(title=title, price=price, publishDate=pub_date,
publish_id=publish_id)
edit_book_obj.authors.set(authors_id_list)
return redirect("/index/")
return render(request, "changebook.html", locals()) def delete_book(request, del_id):
Book.objects.filter(pk=del_id).delete()
return redirect("/index/")

views.py

6.模板设计

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>添加书籍</title>
<link rel="stylesheet" href="/static/bootstrap/dist/css/bootstrap.min.css">
<style type="text/css">
* {
margin: 0;
padding: 0;
}
.navbar-header {
display: inline-block;
width: 800px;
}
.ul_list {
padding-top: 8px;
padding-left: 15px;
display: inline-block;
color: #fff;
} #con_btn {
padding: 0;
} .row {
float: right;
display: inline-block;
width: 600px;
padding-top: 15px;
padding-left: 200px;
} .input-group {
width: 300px;
} .container1 {
width: 60%;
margin: auto;
} #sub-btn {
width: 20%;
margin: auto;
} #cancel { display: inline-block;
float: right;
margin-top: -36px;
}
</style>
</head>
<body>
<div class="lead_head">
{#导航条#}
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<div class="logo">
<div class="container">
<div class="ul_list">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9">
<ul class="nav navbar-nav">
<li><a href="#" id="con_btn">
<button type="button" class="btn btn-default navbar-btn">Welcome to the Book
Store
</button>
</a></li>
<li>
<a href="#">Index</a></li> <li>
<a href="#">Books</a>
</li>
<li>
<a href="#">Issuers</a></li>
<li>
<a href="#">Authors</a></li> </ul>
</li>
</ul>
</div> </div>
</div> </div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="input-group">
<input type="text" class="form-control" placeholder="Anything U Want">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Search</button>
</span>
</div>
</div>
</div>
</div>
</nav>
</div> <div class="container1">
<div class="row1"> <form action="" method="post">
{% csrf_token %}
<div class="form-group">
<label for="">名称</label>
<input type="text" name="title" class="form-control" value="">
</div> <div class="form-group">
<label for="">价格</label>
<input type="text" name="price" class="form-control">
</div> <div class="form-group">
<label for="">出版日期</label>
<input type="date" name="pub_date" class="form-control">
</div> <div class="form-group">
<label for="">出版社</label>
<select name="publish_id" id="" class="form-control">
{% for publish in publish_list %}
<option value="{{ publish.pk }}">{{ publish.name }}</option>
{% endfor %}
</select>
</div> <div class="form-group">
<label for="">作者</label>
<select type="text" name="authors_id_list" multiple class="form-control">
{% for author in author_list %}
<option value="{{ author.pk }}">{{ author.name }}</option>
{% endfor %} </select>
</div>
<input type="submit" class="btn btn-default" id="sub-btn">
</form>
<a id="cancel" href="/index/"><input type="submit" class="btn btn-default" value="Cancel"></a>
</div>
</div>
</body>
</html>

addbook.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ChangeBook</title>
<link rel="stylesheet" href="/static/bootstrap/dist/css/bootstrap.min.css">
<style type="text/css">
* {
margin: 0;
padding: 0;
}
.navbar-header {
display: inline-block;
width: 800px;
}
.ul_list {
padding-top: 8px;
padding-left: 15px;
display: inline-block;
color: #fff;
} #con_btn {
padding: 0;
} .row {
float: right;
display: inline-block;
width: 600px;
padding-top: 15px;
padding-left: 200px;
} .input-group {
width: 300px;
} .container1 {
width: 60%;
margin: auto;
}
</style>
</head>
<body>
<div class="lead_head">
{#导航条#}
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<div class="logo">
<div class="container">
<div class="ul_list">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9">
<ul class="nav navbar-nav">
<li><a href="#" id="con_btn">
<button type="button" class="btn btn-default navbar-btn">Welcome to the Book
Store
</button>
</a></li>
<li>
<a href="#">Index</a></li> <li>
<a href="#">Books</a>
</li>
<li>
<a href="#">Issuers</a></li>
<li>
<a href="#">Authors</a></li> </ul>
</li>
</ul>
</div> </div>
</div> </div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="input-group">
<input type="text" class="form-control" placeholder="Anything U Want">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Search</button>
</span>
</div>
</div>
</div>
</div>
</nav>
</div>
<div class="container1">
<div class="row1">
<div class="col-md-6 col-md-offset-3">
<form action="" method="post">
{% csrf_token %}
<div class="form-group">
<label for="">名称</label>
<input type="text" name="title" class="form-control" value="{{ edit_book_obj.title }}">
</div> <div class="form-group">
<label for="">价格</label>
<input type="text" name="price" class="form-control" value="{{ edit_book_obj.price }}">
</div> <div class="form-group">
<label for="">出版日期</label>
<input type="date" name="pub_date" class="form-control"
value="{{ edit_book_obj.publishDate|date:'Y-m-d' }}">
</div>
<div class="form-group">
<label for="">出版社</label>
<select name="publish_id" id="" class="form-control">
{% for publish in publish_list %}
{% if edit_book_obj.publish == publish %}
<option selected value="{{ publish.pk }}">{{ publish.name }}</option>
{% else %}
<option value="{{ publish.pk }}">{{ publish.name }}</option>
{% endif %}
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="">作者</label>
<select type="text" name="authors_id_list" multiple class="form-control">
{% for author in author_list %}
{% if author in edit_book_obj.authors.all %}
<option selected value="{{ author.pk }}">{{ author.name }}</option>
{% else %}
<option value="{{ author.pk }}">{{ author.name }}</option>
{% endif %} {% endfor %}
</select>
</div>
<input type="submit" class="btn btn-default">
</form>
</div>
</div>
</div>
</body>
</html>

changebook.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>图书管理系统V1.0</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
.navbar-header{
display: inline-block;
width: 800px;
}
.ul_list{
padding-top: 8px;
padding-left: 15px;
display: inline-block;
color: #fff;
}
#con_btn{
padding: 0;
}
.row{
float: right;
display: inline-block;
width: 600px;
padding-top: 15px;
padding-left: 200px;
}
.input-group{
width: 300px;
}
.lead_body{
width: 100%;
height: 80%;
text-align: center;
background-color: #e5e5e5;
margin: auto;
}
.inner_body{
width: 80%;
height: 80%;
{#background-color: #1b6d85;#}
margin: auto;
{#border: 1px solid gray;#}
}
.td{
text-align: center;
}
.ul_left{
float: left;
padding-left: 60px;
list-style-type:none;
font-size: 25px;
}
.ul_left .blank{
{#height: 100px;#}
{#width: 10px;#}
padding-bottom: 100px;
}
.ul_left .click1:hover{
cursor: pointer;
color: orange;
}
.ul_left .click2:hover{
cursor: pointer;
color: orange;
}
.ul_left .click3:hover{
cursor: pointer;
color: orange;
}
.left_body{
height: 333px;
float: left;
background-color: white;
margin-left: -685px;
display: inline-block;
position: fixed;
z-index: 999;
}
#show-books, #show-issuers, #show-authors{
border: none;
}
#close{
float: right;
margin-right: 10px;
cursor: pointer;
margin-top: 10px;
position: relative;
z-index: 999;
font-size: 25px;
} </style>
<link rel="stylesheet" href="/static/bootstrap/dist/css/bootstrap.min.css">
</head>
<body>
<div class="lead_head">
{#导航条#}
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<div class="logo">
<div class="container">
<div class="ul_list">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9">
<ul class="nav navbar-nav">
<li><a href="#" id="con_btn">
<button type="button" class="btn btn-default navbar-btn">Welcome to the Book
Store
</button>
</a></li>
<li>
<a href="#">Index</a></li> <li>
<a href="#">Books</a>
</li>
<li>
<a href="#">Issuers</a></li>
<li>
<a href="#">Authors</a></li> </ul>
</li>
</ul>
</div> </div>
</div> </div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="input-group">
<input type="text" class="form-control" placeholder="Anything U Want">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Search</button>
</span>
</div>
</div>
</div>
</div>
</nav>
</div>
<ul class="ul_left">
<li class="click1">Authors</li>
<li class="blank"></li>
<li class="click2">Issuers</li>
<li class="blank"></li>
<li class="click3">Books</li>
</ul>
<div class="lead_body">
<div class="left_body">
<div class="author" style="display: none">
<form action="" method="post">
{% csrf_token %}
<h3>Authors</h3>
{% for authors in au_list %}
<button id="show-authors" type="submit" value="{{ authors }}" name="name" class="btn btn-default btn-lg btn-block">{{ authors }}</button>
{% endfor %}
<button id="back1" type="button" class="btn btn-default btn-lg btn-block">Hide<<</button>
</form>
</div>
<div class="issuers" style="display: none">
<h3>Issuers</h3>
<form action="" method="post">
{% for issuers in pub_list %}
{% csrf_token %}
<button id="show-issuers" type="submit" value="{{ issuers.name }}" name="name" class="btn btn-default btn-lg btn-block">{{ issuers.name }}</button>
{% endfor %}
<button id="back2" type="button" class="btn btn-default btn-lg btn-block">Hide<<</button>
</form>
</div>
<div class="books" style="display: none">
<h3>Books</h3>
{% for books in book_list %}
<button id="show-books" type="button" class="btn btn-default btn-lg btn-block">《{{ books }}》</button>
{% endfor %}
<button id="back3" type="button" class="btn btn-default btn-lg btn-block">Hide<<</button>
</div>
</div>
<div class="inner_body"> {#巨幕内容,其他母版引用的时候要删除#}
<div class="jumbotron">
<div id="first" >
<h1>Welcome!</h1>
<p>Here is something U want to know before U begin !</p>
<p><a id="show" class="btn btn-primary btn-lg" href="#" role="button">Show Me</a></p>
<p><a id="hide" class="btn btn-default btn-lg" href="#" role="button" style="display: none">Hide</a>
<a id="add" class="btn btn-info btn-lg" href="/index/add/" role="button" style="display: none">Add Book</a>
</p>
</div>
<div id="second" >
<span id="close" >X</span>
<h1>{{ name }}</h1>
{% for n in book_list_1 %}
<p>《{{ n }}》</p>
{% endfor %} </div>
</div>
<table id="show-hide" class="table table-bordered table-hover table-striped" style="display: none">
<thead>
<tr>
<th class="td" >Number</th>
<th class="td">Title</th>
<th class="td">Price</th>
<th class="td">Release Date</th>
<th class="td">Publishing House</th>
<th class="td">Authors</th>
<th class="td">Action</th>
</tr>
</thead>
<tbody>
{% for book in book_list %}
<tr>
<td>{{ forloop.counter }}</td>
<td >{{ book.title }}</td>
<td >{{ book.price }}元</td>
<td >{{ book.publishDate|date:"Y-m-d" }}</td>
<td >{{ book.publish.name }}</td>
<td >{% for author in book.authors.all %}
{% if forloop.last %}
<span>{{ author.name }}</span>
{% else %}
<span>{{ author.name }}</span>,
{% endif %}
{% endfor %}</td>
<td > <a href="/books/{{ book.pk }}/change/" class="btn btn-warning">Edit</a>
<a id="del" href="/books/{{ book.pk }}/delete/" class="btn btn-danger">Delete</a></td>
</tr>
{% endfor %}
</tbody> </table>
</div> </div>
</div>
</div>
</body>
<script type="text/javascript" src ="../static/JS/jQuery_File/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
$("#show").click(function () {
$("#show, #every_list").hide();
$("#hide, #add").show();
$('#show-hide').fadeIn();
});
$("#hide").click(function () {
$('#show-hide').fadeOut();
$("#show, #every_list").show();
$("#add, #hide").hide();
});
$('.click1').mouseover(function () {
$('.author').show('10000'); }); $('.click2').mouseover(function () {
$('.issuers').show('10000');
}); $('.click3').mouseover(function () {
$('.books').show('10000');
});
$('#back1,#back2,#back3 ').click(function () {
$('.books, .issuers, .author').hide('10000');
});
$('#close').click(function () {
$('#close, #second').hide();
{#$('#first').show();#}
});
$('#del').click(function () {
confirm('you will delete a book!');
});
</script> </html>

index.html

路飞学城Python-Day100的更多相关文章

  1. 路飞学城—Python爬虫实战密训班 第三章

    路飞学城—Python爬虫实战密训班 第三章 一.scrapy-redis插件实现简单分布式爬虫 scrapy-redis插件用于将scrapy和redis结合实现简单分布式爬虫: - 定义调度器 - ...

  2. 路飞学城—Python爬虫实战密训班 第二章

    路飞学城—Python爬虫实战密训班 第二章 一.Selenium基础 Selenium是一个第三方模块,可以完全模拟用户在浏览器上操作(相当于在浏览器上点点点). 1.安装 - pip instal ...

  3. 路飞学城Python爬虫课第一章笔记

    前言 原创文章,转载引用务必注明链接.水平有限,如有疏漏,欢迎指正. 之前看阮一峰的博客文章,介绍到路飞学城爬虫课程限免,看了眼内容还不错,就兴冲冲报了名,99块钱满足以下条件会返还并送书送视频. 缴 ...

  4. 路飞学城-Python开发集训-第3章

    学习心得: 通过这一章的作业,使我对正则表达式的使用直接提升了一个level,虽然作业完成的不怎么样,重复代码有点多,但是收获还是非常大的,有点找到写代码的感觉了,遗憾的是,这次作业交过,这次集训就结 ...

  5. 路飞学城-Python开发集训-第1章

    学习体会: 在参加这次集训之前我自己学过一段时间的Python,看过老男孩的免费视频,自我感觉还行,老师写的代码基本上都能看懂,但是实际呢?....今天是集训第一次交作业的时间,突然发现看似简单升级需 ...

  6. 路飞学城-Python开发集训-第4章

    学习心得: 学习笔记: 在python中一个py文件就是一个模块 模块好处: 1.提高可维护性 2.可重用 3.避免函数名和变量名冲突 模块分为三种: 1.内置标准模块(标准库),查看所有自带和第三方 ...

  7. 路飞学城-Python开发集训-第2章

    学习心得: 这章对编码的讲解超级赞,现在对于编码终于有一点认知了,但还没有大彻大悟,还需要更加细心的琢磨一下Alex博客和视频,以前真的是被编码折磨死了,因为编码的问题而浪费的时间很多很多,现在终于感 ...

  8. 路飞学城-Python开发-第二章

    ''' 数据结构: menu = { '北京':{ '海淀':{ '五道口':{ 'soho':{}, '网易':{}, 'google':{} }, '中关村':{ '爱奇艺':{}, '汽车之家' ...

  9. 路飞学城-Python开发-第三章

    # 数据结构: # goods = [ # {"name": "电脑", "price": 1999}, # {"name&quo ...

  10. 路飞学城-Python开发-第一章

    # 基础需求: # 让用户输入用户名密码 # 认证成功后显示欢迎信息 # 输错三次后退出程序 username = 'pandaboy' password = ' def Login(username ...

随机推荐

  1. openc下cv::Mat和IplImage的相互转换

    opencv2.0的类CV::Mat和opencv1.0的IplImage之间烦人转换: cv::Mat matimg = cv::imread ("girl.jpg"); Ipl ...

  2. 好纠结啊,JeeWx商业版本号和开源版本号有什么差别呢?

    好纠结啊,JeeWx商业版本号和开源版本号有什么差别呢? JeeWx开源版本号是一套基础微信开发平台.有基础的微信菜单.素材管理.微信对接等基础功能,适合于开发人员学习研究. JeeWx商业版本号是一 ...

  3. 动态内存管理---new&amp;delete

    动态内存管理 动态对象(堆对象)是程序在执行过程中在动态内存中用new运算符创建的对象. 因为是用户自己用new运算符创建的.因此也要求用户自己用delete运算符释放,即用户必须自己管理动态内存. ...

  4. Linux黑洞

    1 什么是Linux黑洞 在Linux系统中,/dev/null是一个虚设的设备.俗称"Linux黑洞". 不论什么对/dev/null的写入都会成功.但数据会消失得无影无踪.没有 ...

  5. Sublime Text 2 SFTP UnicodeDecodeError错误!

    右键-->SFTP/FTP ->Sync Remote To Local {作者:半条虫(466814195)} 提示下面错误 An unexpected error occurred, ...

  6. poj 2135 Farm Tour 【无向图最小费用最大流】

    题目:id=2135" target="_blank">poj 2135 Farm Tour 题意:给出一个无向图,问从 1 点到 n 点然后又回到一点总共的最短路 ...

  7. nyoj--523--亡命逃窜(BFS水题)

    亡命逃窜 时间限制:1000 ms  |  内存限制:65535 KB 难度:4 描述 从前有个叫hck的骑士,为了救我们美丽的公主,潜入魔王的老巢,够英雄吧.不过英雄不是这么好当的.这个可怜的娃被魔 ...

  8. 彻底弄懂px em rem

    国内的设计师大都喜欢用px,而国外的网站大都喜欢用em和rem,那么三者有什么区别,又各自有什么优劣呢? PX特点 1. IE无法调整那些使用px作为单位的字体大小: 2. 国外的大部分网站能够调整的 ...

  9. Hdu-6253 2017CCPC-Final K.Knightmare 规律

    题面 题意:给你一个无限大的棋盘,一个象棋中的马,问你这个马,飞n步后,可能的位置有多少种? 题解:看到题,就想先打表试试,于是先写个暴力(枚举每个位置,是马就飞周围8个格子,注意不要在同个循环里把格 ...

  10. Java图片的压缩

    1.如果在springMvc中,会自带生成MultipartFile文件,将MultipartFile转化为File MultipartFile file1 = file; CommonsMultip ...