有了前面的基础,后面就是将页面展示出来。

预览图如下:1号和31号分别有活动,会一并显示出来

 

这里需要搞定几个问题,一个就是数据库的连接,我们用\sys\class\class.db_connect.inc.php

  1. <?php

  1.  

  1. /*

  1. * 数据库操作(数据库访问,认证等)

  1. */

  1.  

  1. class DB_Connect

  1. {

  1. /**

  1. * Stores a database object

  1. *

  1. * @var object A database object

  1. */

  1. protected $db;

  1.  

  1. /**

  1. * Checks for a DB object or creates one if one isn't found

  1. *

  1. * @param object $dbo A database object

  1. */

  1. protected function __construct($db = NULL)

  1. {

  1. if (is_object($db)) {

  1. $this->db = $db;

  1. } else {

  1. // Constants are defined in /sys/config/db-cred.inc.php

  1. $dsn = "mysql:host=" . DB_HOST . ";dbname=" . DB_NAME;

  1. try {

  1. $this->db = new PDO($dsn, DB_USER, DB_PASS, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . DB_ENCODE));

  1. } catch (Exception $e) {

  1. // If the DB connection fails, output the error

  1. die ($e->getMessage());

  1. }

  1. }

  1. }

  1. }

  1.  

  1. ?>

程序中需要引入DB_USER等的定义文件:db-cred.inc.php

  1. <?php

  1. /*

  1. * Created on 2012-4-24 by xiongxuebing

  1. */

  1. /*

  1. * Create an empty array to store constants

  1. */

  1. $C = array();

  1. /*

  1. * The database host URL

  1. */

  1. $C['DB_HOST'] = 'localhost';

  1. /*

  1. * The database username

  1. */

  1. $C['DB_USER'] = 'root';

  1. /*

  1. * The database password

  1. */

  1. $C['DB_PASS'] = 'root';

  1. /*

  1. * The name of the database to work with

  1. */

  1. $C['DB_NAME'] = 'php-jquery_example';

  1.  

  1. $C['DB_ENCODE'] = 'UTF8';

  1.  

  1. ?>

 

需要注意的是,类似DB_HOST的常量并没有直接定义,而是通过在/sys/core/init.inc.php中进行定义:

  1. foreach ($C as $name => $val) {
    define($name, $val);
    }
  1. 原文件如下的示:
  1.  
  1. <?php

  1. /*

  1. * Created on 2016-6-19 by luhx

  1. */

  1.  

  1. session_start();

  1. /*

  1. * Generate an anti-CSRF token if one doesn't exist

  1. */

  1. if (!isset($_SESSION['token'])) {

  1. $_SESSION['token'] = sha1(uniqid(mt_rand(), TRUE));

  1. }

  1.  

  1. /*

  1. * Include the necessary configuration info

  1. */

  1. include_once '../sys/config/db-cred.inc.php';

  1.  

  1. /*

  1. * Define constants for configuration info

  1. */

  1. foreach ($C as $name => $val) {

  1. define($name, $val);

  1. }

  1. /*

  1. * Create a PDO object

  1. */

  1. $dsn = "mysql:host=" . DB_HOST . ";dbname=" . DB_NAME;

  1. $dbo = new PDO($dsn, DB_USER, DB_PASS);

  1. /*

  1. * Define the auto-load function for classes

  1. */

  1. function __autoload($class)

  1. {

  1. $filename = "../sys/class/class." . $class . ".inc.php";

  1. if (file_exists($filename)) {

  1. include_once $filename;

  1. }

  1. }

  1.  

  1. ?>

 

接下来需显示日历:index.php

  1. <?php

  1. /*

  1. * Created on 2012-4-24 by xiongxuebing

  1. */

  1. /*

  1. * 包含必须的文件

  1. */

  1.  

  1. include_once '../sys/core/init.inc.php';

  1. /*

  1. * 载入日历

  1. */

  1. $cal = new Calendar($dbo, "2010-01-01 12:00:00");

  1.  

  1. /**

  1. * 初始化标题和样式文件

  1. */

  1. $page_title = "Events Calendar";

  1. $css_files = array('style.css');

  1. include_once 'assets/common/header.inc.php';

  1. ?>

  1.  

  1. <?php

  1. /*

  1. * 包含尾页

  1. */

  1. include_once 'assets/common/footer.inc.php';

  1. ?>

 
首先需要创建一个Calendar
/sys/class/class.calendar.inc.php
  1. <?php

  1.  

  1. /*

  1. * Created on 2012-4-24 by xiongxuebing

  1. */

  1.  

  1. class Calendar extends DB_Connect

  1. {

  1. /**

  1. * 日历根据此日期构建

  1. * YYYY-MM-DD HH:MM:SS

  1. * @var string

  1. */

  1. private $_useDate;

  1. /**

  1. * 日历显示月份

  1. * @var int

  1. */

  1. private $_m;

  1. /**

  1. *

  1. * @var int

  1. */

  1. private $_y;

  1. /**

  1. * 这个月有多少天

  1. * @var int

  1. */

  1. private $_daysInMonth;

  1. /**

  1. * 这个月从周几开始

  1. * @var int

  1. */

  1. private $_startDay;

  1.  

  1. public function __construct($dbo = NULL, $useDate = NULL)

  1. {

  1. parent::__construct($dbo);

  1. /*

  1. * Gather and store data relevant to the month

  1. */

  1. if (isset($useDate)) {

  1. $this->_useDate = $useDate;

  1. } else {

  1. $this->_useDate = date('Y-m-d H:i:s');

  1. }

  1. $ts = strtotime($this->_useDate);

  1. $this->_m = date('m', $ts);

  1. $this->_y = date('Y', $ts);

  1. $this->_daysInMonth = cal_days_in_month(

  1. CAL_GREGORIAN,

  1. $this->_m,

  1. $this->_y

  1. );

  1. $ts = mktime(0, 0, 0, $this->_m, 1, $this->_y);

  1. $this->_startDay = date('w', $ts);

  1. }

  1.  

  1. /**

  1. * 生成用于显示日历和活动的HTML标记

  1. *

  1. * 使用储存在类属性中的数据,截入给定月份的活动数据,生成并返回完整的日历HTML标记

  1. * @return string 日历HTML标记

  1. */

  1. public function buildCalendar()

  1. {

  1. /**

  1. * 确定日历显示月份并创建一个用于标识日历每列星期几的缩写数组

  1. */

  1. $cal_month = date('F Y', strtotime($this->_useDate));

  1. $cal_id = date('Y-m', strtotime($this->_useDate));

  1. $weekdays = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');

  1. /**

  1. * 给日历标记添加一个标题

  1. */

  1. $html = "\n\t<h2 id=\"month-$cal_id\">$cal_month</h2>";

  1. for ($d = 0, $labels = NULL; $d < 7; ++$d) {

  1. $labels .= "\n\t\t<li>" . $weekdays[$d] . "</li>";

  1. }

  1. $html .= "\n\t<ul class=\"weekdays\">" . $labels . "\n\t</ul>";

  1.  

  1. /*

  1. * Load events data

  1. */

  1. $events = $this->_createEventObj();

  1.  

  1. /*

  1. * 生成日历HTML标记

  1. */

  1. $html .= "\n\t<ul>"; // 开始一个新的<ul>

  1. for ($i = 1, $c = 1, $t = date('j'), $m = date('m'), $y = date('Y'); $c <= $this->_daysInMonth; ++$i) {

  1. $event_info = NULL; // clear the variable

  1.  

  1. //为该月的之前几天添加填充项

  1. $class = $i <= $this->_startDay ? "fill" : NULL;

  1.  

  1. //如果当前处理日期是今天,则为他添加class today

  1. if ($c == $t && $m == $this->_m && $y == $this->_y) {

  1. $class = "today";

  1. }

  1. $ls = sprintf("\n\t\t<li class=\"%s\">", $class);

  1. $le = "\n\t\t</li>";

  1. if ($this->_startDay < $i && $this->_daysInMonth >= $c) {

  1.  

  1.  

  1. if (isset($events[$c])) {

  1.  

  1. foreach ($events[$c] as $event) {

  1. $link = '<a href="view.php?event_id=' . $event->id . '">' . $event->title . '</a>';

  1. $event_info = "\n\t\t\t$link";

  1. }

  1. }

  1. $date = sprintf("\n\t\t\t<strong>%02d</strong>", $c++);

  1. } else {

  1. $date = "&nbsp;";

  1. }

  1. //如果赶上星期六,就新起一行

  1. $wrap = $i != 0 && $i % 7 == 0 ? "\n\t</ul>\n\t<ul>" : NULL;

  1.  

  1. //Assemble the pieces into a finished item

  1. $html .= $ls . $date . $event_info . $le . $wrap;

  1. }

  1.  

  1.  

  1. //Add filler to finish out the last week

  1. while ($i % 7 != 1) {

  1. $html .= "\n\t\t<li class=\"fill\">&nbsp;</li>";

  1. ++$i;

  1. }

  1.  

  1. //Close the final unordered list

  1. $html .= "\n\t</ul>\n\n";

  1. $admin = $this->_adminGeneralOptions();

  1. /**

  1. * 返回用于输出的HTML标记

  1. */

  1. return $html . $admin;

  1. }

  1.  

  1. /**

  1. * 得到活动信息HTML

  1. * @param int $id 活动ID

  1. * @return string 用于显示活动信息的基本HTML标记

  1. */

  1. public function displayEvent($id)

  1. {

  1. /**

  1. * Make sure an ID was passed

  1. * */

  1. if (empty($id)) {

  1. return NULL;

  1. }

  1. /**

  1. * Make sure the ID is an integer

  1. **/

  1. $id = preg_replace('/[^0-9]/', '', $id);

  1. /**

  1. * Load the event data from the DB

  1. **/

  1. $event = $this->_loadEventById($id);

  1. /**

  1. * Generate strings for the date, start, and end time

  1. * */

  1. $ts = strtotime($event->start);

  1. $date = date('F d, Y', $ts);

  1. $start = date('g:ia', $ts);

  1. $end = date('g:ia', strtotime($event->end));

  1.  

  1. /*

  1. * Load admin options if the user is logged in

  1. */

  1. $admin = $this->_adminEntryOptions($id);

  1. return "<h2>$event->title</h2>\n\t<p class=\"dates\">$date, $start&mdash;$end</p>" .

  1. "\n\t<p>$event->description</p>$admin";

  1. }

  1.  

  1. public function displayForm()

  1. {

  1. if (isset($_POST['event_id'])) {

  1. $id = (int)$_POST['event_id'];

  1. // Force integer type to sanitize data

  1. } else {

  1. $id = NULL;

  1. }

  1. /*

  1. * Instantiate the headline/submit button text

  1. */

  1. $submit = "Create new!";

  1. /*

  1. * If an ID is passed, loads the associated event

  1. */

  1. if (!empty($id)) {

  1. $event = $this->_loadEventById($id);

  1. if (!is_object($event)) {

  1. return NULL;

  1. }

  1. $submit = "Edit event!";

  1. }

  1.  

  1. return <<<FORM_MARKUP

  1. <form action="assets/inc/process.inc.php" method="post">

  1. <fieldset>

  1. <legend>$submit</legend>

  1. <label for="event_title">Event Title</label>

  1. <input type="text" name="event_title" id="event_title" value="$event->title" />

  1. <label for="event_start">Start Time</label>

  1. <input type="text" name="event_start" id="event_start" value="$event->start" />

  1. <label for="event_end">End Time</label>

  1. <input type="text" name="event_end" id="event_end" value="$event->end" />

  1. <label for="event_description">Event Description</label>

  1. <textarea name="event_description" id="event_description">$event->description</textarea>

  1. <input type="hidden" name="event_id" value="$event->id" />

  1. <input type="hidden" name="token" value="$_SESSION[token]" />

  1. <input type="hidden" name="action" value="event_edit" />

  1. <input type="submit" name="event_submit" value="$submit" /> or <a href="./" class = "link">cancel</a>

  1. </fieldset>

  1. </form>

  1. FORM_MARKUP;

  1. }

  1.  

  1. public function processForm()

  1. {

  1. if ($_POST['action'] != 'event_edit') {

  1. return "The method processForm was accessed incorrectly";

  1. }

  1. $title = htmlentities($_POST['event_title'], ENT_QUOTES, "UTF-8");

  1. $desc = htmlentities($_POST['event_description'], ENT_QUOTES, "UTF-8");

  1. $start = htmlentities($_POST['event_start'], ENT_QUOTES, "UTF-8");

  1. $end = htmlentities($_POST['event_end'], ENT_QUOTES, "UTF-8");

  1.  

  1. if (!$this->_validDate($start) || !$this->_validDate($end)) {

  1. return "Invalid date format! Use YYYY-MM-DD HH:MM:SS.";

  1. }

  1. /*

  1. * If no event ID passed, create a new event

  1. */

  1. if (empty($_POST['event_id'])) {

  1. $sql = "INSERT INTO `events` (`event_title`, `event_desc`, `event_start`, `event_end`)" .

  1. " VALUES (:title, :description, :start, :end)";

  1. } else {

  1. $id = (int)$_POST['event_id'];

  1. $sql = "UPDATE `events` SET `event_title`=:title,`event_desc`=:description,`event_start`=:start,`event_end`=:end WHERE `event_id`=$id";

  1. }

  1. try {

  1. $stmt = $this->db->prepare($sql);

  1. $stmt->bindParam(":title", $title, PDO::PARAM_STR);

  1. $stmt->bindParam(":description", $desc, PDO::PARAM_STR);

  1. $stmt->bindParam(":start", $start, PDO::PARAM_STR);

  1. $stmt->bindParam(":end", $end, PDO::PARAM_STR);

  1. $stmt->execute();

  1. $stmt->closeCursor();

  1. return $this->db->lastInsertId();

  1. } catch (Exception $e) {

  1. return $e->getMessage();

  1. }

  1. }

  1.  

  1. public function confirmDelete($id)

  1. {

  1. if (empty($id)) {

  1. return NULL;

  1. }

  1. $id = preg_replace('/[^0-9]/', '', $id);

  1. /*

  1. * If the confirmation form was submitted and the form.

  1. * has a valid token, check the form submission

  1. */

  1. if (isset($_POST['confirm_delete']) && $_POST['token'] == $_SESSION['token']) {

  1. /*

  1. * If the deletion is confirmed,

  1. * remove the event from the database

  1. */

  1. if ($_POST['confirm_delete'] == "删除") {

  1. $sql = "DELETE FROM `events` WHERE `event_id`=:id LIMIT 1";

  1. try {

  1. $stmt = $this->db->prepare($sql);

  1. $stmt->bindParam(":id", $id, PDO::PARAM_INT);

  1. $stmt->execute();

  1. $stmt->closeCursor();

  1. header("Location: ./");

  1. return;

  1. } catch (Exception $e) {

  1. return $e->getMessage();

  1. }

  1. } /*

  1. * If not confirmed,

  1. * sends the user to the main view

  1. */

  1. else {

  1. header("Location: ./");

  1. return;

  1. }

  1. }

  1. /*

  1. * If the confirmation form hasn't been submitted, display it

  1. * */

  1. $event = $this->_loadEventById($id);

  1. /*

  1. * If no object is returned, return to the main view

  1. * */

  1. if (!is_object($event)) {

  1. header("Location: ./");

  1. }

  1. return <<<CONFIRM_DELETE

  1. <form action="confirmdelete.php" method="post">

  1. <h2>确定要删除 "$event->title" 吗?</h2>

  1. <p>删除后将<strong>不能恢复</strong></p>

  1. <p>

  1. <input type="submit" name="confirm_delete" value="删除" />

  1. <input type="submit" name="confirm_delete" value="取消" />

  1. <input type="hidden" name="event_id" value="$event->id" />

  1. <input type="hidden" name="token" value="$_SESSION[token]" />

  1. </p>

  1. </form>

  1. CONFIRM_DELETE;

  1. }

  1.  

  1. private function _validDate($date)

  1. {

  1. $pattern = '/^(\d{4}(-\d{2}){2} (\d{2})(:\d{2}){2})$/';

  1. /*

  1. * If a match is found, return TRUE. FALSE otherwise.

  1. */

  1. return preg_match($pattern, $date) == 1 ? TRUE : FALSE;

  1. }

  1.  

  1. private function _loadEventData($id = NULL)

  1. {

  1. $sql = "SELECT `event_id`, `event_title`, `event_desc`,`event_start`, `event_end` FROM `events`";

  1. if (!empty($id)) {

  1. $sql .= "WHERE `event_id`=:id LIMIT 1";

  1. } else {

  1. $start_ts = mktime(0, 0, 0, $this->_m, 1, $this->_y);

  1. $end_ts = mktime(23, 59, 59, $this->_m + 1, 0, $this->_y);

  1. $start_date = date('Y-m-d H:i:s', $start_ts);

  1. $end_date = date('Y-m-d H:i:s', $end_ts);

  1.  

  1. $sql .= "WHERE `event_start` BETWEEN '$start_date' AND '$end_date' ORDER BY `event_start`";

  1. }

  1. try {

  1. $stmt = $this->db->prepare($sql);

  1. /*

  1. * Bind the parameter if an ID was passed

  1. */

  1. if (!empty($id)) {

  1. $stmt->bindParam(":id", $id, PDO::PARAM_INT);

  1. }

  1. $stmt->execute();

  1. $results = $stmt->fetchAll(PDO::FETCH_ASSOC);

  1. $stmt->closeCursor();

  1. return $results;

  1. } catch (Exception $e) {

  1. die ($e->getMessage());

  1. }

  1. }

  1.  

  1. /**

  1. * 载入该月全部活动信息到一个数组

  1. * @return array 活动信息

  1. */

  1. private function _createEventObj()

  1. {

  1. /*

  1. * Load the events array

  1. */

  1. $arr = $this->_loadEventData();

  1. /**

  1. * Create a new array, then organize the events* by the day of the monthon which they occur

  1. * */

  1. $events = array();

  1. foreach ($arr as $event) {

  1. $day = date('j', strtotime($event['event_start']));

  1. try {

  1. $events[$day][] = new Event($event);

  1. } catch (Exception $e) {

  1. die ($e->getMessage());

  1. }

  1. }

  1. return $events;

  1. }

  1.  

  1. private function _loadEventById($id)

  1. {

  1. /**

  1. * 如果id为空,返回NULL

  1. */

  1. if (empty($id)) {

  1. return NULL;

  1. }

  1. /**

  1. * 载入活动信息数组

  1. */

  1. $event = $this->_loadEventData($id);

  1. /**

  1. * 返回event对象

  1. */

  1. if (isset($event[0])) {

  1. return new Event($event[0]);

  1. } else {

  1. return NULL;

  1. }

  1. }

  1.  

  1. private function _adminGeneralOptions()

  1. {

  1. if (isset($_SESSION['user'])) {

  1. return <<<ADMIN_OPTIONS

  1. <a href="admin.php" class="admin">+ 新&nbsp;建&nbsp;活&nbsp;动</a>

  1. <form action="assets/inc/process.inc.php" method="post">

  1. <div>

  1. <input type="submit" value="登&nbsp;&nbsp;出" class="link" />

  1. <input type="hidden" name="token" value="$_SESSION[token]" />

  1. <input type="hidden" name="action" value="user_logout" />

  1. </div>

  1. </form>

  1. ADMIN_OPTIONS;

  1. } else {

  1. return <<<ADMIN_OPTIONS

  1. <a href="login.php" class="link">登&nbsp;&nbsp;录</a>

  1. ADMIN_OPTIONS;

  1. }

  1. }

  1.  

  1. private function _adminEntryOptions($id)

  1. {

  1. if (isset($_SESSION['user'])) {

  1. return <<<ADMIN_OPTIONS

  1. <div class="admin-options">

  1. <form action="admin.php" method="post">

  1. <p>

  1. <input type="submit" name="edit_event" value="编&nbsp;&nbsp;辑" />

  1. <input type="hidden" name="event_id" value="$id" />

  1. </p>

  1. </form>

  1. <form action="confirmdelete.php" method="post">

  1. <p>

  1. <input type="submit" name="delete_event" value="删&nbsp;&nbsp;除" />

  1. <input type="hidden" name="event_id" value="$id" />

  1. </p>

  1. </form>

  1. </div>

  1. <!-- end .admin-options -->

  1. ADMIN_OPTIONS;

  1. } else {

  1. return NULL;

  1. }

  1. }

  1.  

  1.  

  1. }

  1.  

  1. ?>

  1.  

 

然后在目录/public/assets/common/中 加入页头文件header.inc.php

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

  1. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  1. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

  1.  

  1. <head>

  1. <meta htp-equiv="Content-Type" content="text/html;charset=utf-8" />

  1. <title><?php echo $page_title; ?></title>

  1. <?php foreach ($css_files as $css): ?>

  1. <link rel="stylesheet" type="text/css" media="screen,projection"

  1. href="assets/css/<?php echo $css; ?>" />

  1. <?php endforeach; ?>

  1. </head>

  1.  

  1. <body>

页尾文件footer.inc.php

  1. </body>

  1. </html>

 

加入css文件:public/assets/css/style.css

  1. body{

  1. background-color:#789;

  1. font-famly:georgia,serif;

  1. font-size:13px;

  1. }

  1.  

  1. #content {

  1. display:block;

  1. width:812px;

  1. margin:40px auto 10px;

  1. padding:10px;

  1. background-color:#FFF;

  1. -moz-border-radius:6px;

  1. -webkit-border-radius:6px;

  1. border-radius:6px;

  1. border:2px solid black;

  1. -moz-box-shadow:0 0 14px #123;

  1. -webkit-box-shadow:0 0 14px #123;

  1. box-shadow:0 0 14px #123;

  1. }

  1.  

  1. h2,p{

  1. margin:0 auto 14px;

  1. text-align:center;

  1. }

  1.  

  1. ul{

  1. display:block;

  1. clear:left;

  1. height:82px;

  1. width:812px;

  1. margin:0 auto;

  1. padding: 0;

  1. list-style:none;

  1. background-color:#FFF;

  1. text-align:center;

  1. border:1px solid black;

  1. border-top: 0;

  1. border-bottom: 2px solid black;

  1. }

  1.  

  1. li {

  1. position:relative;

  1. float:left;

  1. margin:0;

  1. padding:20px 2px 2px;

  1. border-left:1px solid black;

  1. border-right:1px solid black;

  1. width: 110px;

  1. height: 60px;

  1. overflow:hidden;

  1. background-color:white;

  1. }

  1.  

  1. li:hover{

  1. background-color:#FCB;

  1. z-index:1;

  1. -moz-box-shadow: 0 0 10px #789;

  1. -webkit-box-shadow: 0 0 10px #789;

  1. box-shadow:0 0 10px #789;

  1. }

  1.  

  1. .weekdays{

  1. height: 20px;

  1. border-top: 2px solid black;

  1. }

  1. .weekdays li{

  1. height: 16px;

  1. padding: 2px 2px;

  1. background-color: #BCF;

  1. }

  1.  

  1. .fill{

  1. background-color:#BCD;

  1. }

  1.  

  1. .weekdays li:hover,li.fill:hover{

  1. background-color:#BCD;

  1. -moz-box-shadow: none;

  1. -webkit-box-shadow: none;

  1. box-shadow: none;

  1. }

  1.  

  1. .weekdays li:hover,.today{

  1. background-color: #BCF;

  1. }

  1.  

  1. li strong {

  1. position:absolute;

  1. top: 2px;

  1. right:2px;

  1. }

  1.  

  1. li a {

  1. position: relative;

  1. display:block;

  1. border: 1px dotted black;

  1. margin:2px;

  1. padding:2px;

  1. font-size:11px;

  1. background-color:#BEF;

  1. text-align:left;

  1. -moz-border-radius: 6px;

  1. -webkit-border-radius:6px;

  1. border-radius:6px;

  1. z-index:1;

  1. text-decoration:none;

  1. color:black;

  1. font-weight:bold;

  1. font-style:italic;

  1. }

  1.  

  1. li a:hover {

  1. background-color:#BCF;

  1. z-index:2;

  1. -moz-box-shadow: 0 0 6px #789;

  1. -webkit-box-shadow: 0 0 6px #789;

  1. box-shadow: 0 0 6px #789;

  1. }

  1.  

本篇文章对应代码:http://download.csdn.net/detail/luhouxiang/9554054

php学习,一个简单的Calendar(2) 一个简单的活动页面的更多相关文章

  1. ROS学习记录(三)————创建一个简单的发布节点和订阅节点

    暑假在家有些懈怠,不,非常懈怠- -||!良心已经发痛了,想快些补回原来的进度,但忽然发现,中断了一段时间再重新去学习,有的地方连最基本的符号都忘记了 ,这次特意弄个最最基础的,恢复一下,以前的进度. ...

  2. QML学习笔记(五)— 做一个简单的待做事项列表

    做一个简单的QML待做事项列表,能够动态添加和删除和编辑数据 GitHub:八至 作者:狐狸家的鱼 本文链接:QML学习笔记(五)— 做一个待做事项列表 主要用到QML:ListView 效果 全部代 ...

  3. python Django 学习笔记(六)—— 写一个简单blog做增删改练手

    简单效果图 1,创建一个项目myblog 可参考这里 myblog/ manage.py myblog/ __init__.py settings.py urls.py wsgi.py 2,创建blo ...

  4. Directx11学习笔记【十】 画一个简单的三角形

    本篇笔记要实现的是在屏幕上渲染出一个三角形,重点要学习的是渲染一个几何体的流程方式. 为了渲染几何图形,需要一个顶点缓存和一个描述顶点布局的输入层,还有着色器(主要是顶点着色器和像素着色器),下面来看 ...

  5. 【WPF】学习笔记(一)——做一个简单的电子签名板

    参加实习(WPF)已经有两个多周的时间了,踩了一些坑,也算积累了一些小东西,准备慢慢拿出来分享一下.(●'◡'●) 这次呢就讲讲一个简单的电子签名板的实现. 先上张图(PS:字写得比较丑,不要太在意哈 ...

  6. 【javaFX学习】(一) 建一个简单的界面

    转载注明出处:http://www.cnblogs.com/lensener/p/7976953.html 用过swing都知道有多蛋疼,界面有多丑.自从用了javaFX,腰也不酸了,腿也不疼了. 废 ...

  7. 学习selenium python版最初的一个小想法

    这个还是我在刚开始学习selenium的时候做的,自己觉得有点意思,在接下来我会基于目前我对于selenium的一些深入研究,写下我对selenium的理解以及UIAutomation的一些理解,以此 ...

  8. Neo4j学习笔记(1)——使用API编写一个Hello World程序

    项目的创建及配置 因为Neo4j依赖的jar包比较多,所以推荐使用Maven来管理. 首先创建一个Maven Project,添加依赖: <dependency> <groupId& ...

  9. go语言,golang学习笔记4 用beego跑一个web应用

    go语言,golang学习笔记4 用beego跑一个web应用 首页 - beego: 简约 & 强大并存的 Go 应用框架https://beego.me/ 更新的命令是加个 -u 参数,g ...

随机推荐

  1. elasticsearch的基本用法

    开始学习使用 elasticsearch, 把步骤记录在这里: 最大的特点: 1. 数据库的 database, 就是  index 2. 数据库的 table,  就是 tag 3. 不要使用bro ...

  2. XML 语法规则

    转摘自:http://www.w3school.com.cn/xml/xml_elements.asp XML 语法规则 XML 文档包含 XML 元素. XML 的语法规则很简单,且很有逻辑.这些规 ...

  3. lambda显式声明返回值

    10.21 编写一个lambda,捕获一个局部int变量,并递减变量值,直至它变为0.一旦变量变为0,再调用lambda应该不再递减变量.lambda应该返回一个bool值,指出捕获的变量是否为0. ...

  4. c# 可以有多个Main()函数

    可以有多个Main()函数,这样写:namespace ConsoleApp1{class Program{static void Main(string[] args){Console.WriteL ...

  5. phpcms 源码分析二:

    这次是逆雪寒的common.inc.php第二部分: <?php /* 明天放假了.今天在写点罗.放假没空写了.要陪老婆,大家看了有什么不明白的.可以跟帖问.我懂的我会回答.谢谢 [/php] ...

  6. javaHDU1003Max Sum

    import java.util.Scanner;  public class Sum  {public static void main(String args[])  {Scanner cin=n ...

  7. Thumb

    这个控件,真不好介绍,MSDN上也是草草几句,反正就是可以让用户拖动的玩意儿,但是,你会发现,当你在该控件上拖动时,它没有反响,也就是说这个东西默认不做任何操作的,它是赖在那里什么都不干,除非你去踢上 ...

  8. 一行 Python 代码搞定一棵树

    使用 Python 内建的 defaultdict 方法可以轻松定义一个树的数据结构. 简单的说树也可以是一个字典数据结构           Python   1 def tree(): retur ...

  9. c语言冒泡排序,指针,数组

    冒泡排序算法的运作如下: 比较相邻的元素.如果第一个比第二个大,就交换他们两个. 对每一对相邻元素作同样的工作,从开始第一对到结尾的最后一对.在这一点,最后的元素应该会是最大的数. 针对所有的元素重复 ...

  10. 一个苹果证书怎么多次使用(授权Mac开发)——导出p12文件

    为什么要导出.p12文件 当我们用大于三个mac设备开发应用时,想要申请新的证书,如果在我们的证书里,包含了3个发布证书,2个开发证书,可以发现再也申请不了开发证书和发布证书了(一般在我们的证书界面中 ...