<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[业精于勤，荒于嬉]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/jasper_ding</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; jasper_ding]]></copyright><item><title><![CDATA[使用 SQL 的 CASE 语句做付款方式的统计]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/128982086</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/128982086</guid><author>jasper_ding</author><pubDate>Sat, 11 Feb 2023 11:53:49 +0800</pubDate><description><![CDATA[使用 SQL 的 CASE 语句做付款方式的统计]]></description><category></category></item><item><title><![CDATA[使用SQL 的CASE 语句做分时段统计]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/114264985</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/114264985</guid><author>jasper_ding</author><pubDate>Mon, 01 Mar 2021 16:17:05 +0800</pubDate><description><![CDATA[某日老板突然要求，想看各时段的订单数量。心想，订单表中有纪录时间点，这应该不成问题，只是这 SQL 语句该如何下？如果一个小时统计一次，总不能分24次吧！
订单数据表 orders 如下：

希望得出的结果如下：

利用 CASE 语句就能完成任务。
SELECT CASE WHEN DATE_FORMAT(T1.CreateTime, "%H") = 0 THEN "H00"
             WHEN DATE_FORMAT(T1.CreateTime, "%H") = 1 THEN "H01"]]></description><category></category></item><item><title><![CDATA[单列的 FORM]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/104290740</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/104290740</guid><author>jasper_ding</author><pubDate>Thu, 13 Feb 2020 09:32:24 +0800</pubDate><description><![CDATA[利用bootstrap 的 form-inline 实作下面的样式。

&lt;form class="form-inline font5" style="margin:0px;" id="frmFind"&gt;
   &lt;input type=hidden name="MemberNo" value="&lt;?php echo $memberNo; ?&gt;"&gt;
   &lt;i...]]></description><category></category></item><item><title><![CDATA[使用 Tamir.SharpSSH 类库实现 SFTP 文件操作]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/103493075</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/103493075</guid><author>jasper_ding</author><pubDate>Wed, 11 Dec 2019 15:27:32 +0800</pubDate><description><![CDATA[前言
在改一个 VB.NET 的项目，因需要将本机档案上传到云端，所以找到了 Tamir.SharpSSH 这个类库，但很多资料都是介绍如何用 C# 来实现。想把范例改成 VB.NET，但碰到无法继承的问题，或许是对 VB.NET 不熟，无法排解问题，索性把范例纳入 VB.NET 的解决方案中，让 VB.NET 透过 C# 的范例实现 SFTP 文件操作的功能。

在原 VB.NET 解决方案中添...]]></description><category></category></item><item><title><![CDATA[Pygame实作GUI（04）MyBaseForm 类]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/101911937</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/101911937</guid><author>jasper_ding</author><pubDate>Wed, 02 Oct 2019 13:12:46 +0800</pubDate><description><![CDATA[前言
前三篇介绍了 GUI 中的 Label, Button, Checkbox, Radio Button 等控件，基本上这些控件都是摆放在屏幕上的某个位置，要有显示及判断 click 事件的管理机制。每一个画面都会有，所以要设计成一个类来管理，因此设计了 MyBaseForm 类。
MyBaseForm 类
建构函式如下：
class MyBaseForm(object):
    def _...]]></description><category></category></item><item><title><![CDATA[Pygame实作GUI（03）检查方块]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/101686826</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/101686826</guid><author>jasper_ding</author><pubDate>Sun, 29 Sep 2019 13:47:30 +0800</pubDate><description><![CDATA[前言
检查方块（checkbox）在操作上与按钮相似，只是其选择状态并非短暂的。检查方块可以被认为是个触发开关，但当它被 clicked 时，它就会改变选择或未选择状态。如下图，「记住密码」与「自动登录」就使用了的检查方块。

检查方块除了左边的图案之外，也有与之联系的文字描述，所以右边的文字也是检查方块的一部分。
检查方块可以是单独出现或以 exclusive groups形式出现。一个单独出现...]]></description><category></category></item><item><title><![CDATA[Pygame实作GUI（02）Button]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/101608901</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/101608901</guid><author>jasper_ding</author><pubDate>Sat, 28 Sep 2019 13:18:25 +0800</pubDate><description><![CDATA[前言
按钮（Button）是GUI中最简单的一种控件，由一个矩形区域组成，有两个状态：作用中、非作用中。两种状态表示可以点击或无法点击。
按钮可以用图案表示，也可以使用文字，当然图案加文字也是可以的。因此大概知道一个Button 应该有一个代表底图的 surface 对象，以及一个显示文字的 Label 控件。
在 GUI 中除了 Button 控件，还有单选钮（RadioButton）、复选钮（...]]></description><category></category></item><item><title><![CDATA[Pygame 实作 GUI（01）Label]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/101102103</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/101102103</guid><author>jasper_ding</author><pubDate>Sat, 21 Sep 2019 13:02:28 +0800</pubDate><description><![CDATA[前言
GUI ( Graphical User Interface ) 中文称之为『图形用户界面』。在Python 中，虽有默认的 UI 工具包  Tkinter，但如何与 pygame 融合使用？却不是简单易解的事。游戏中的用户界面，除了中文输入外，其他的部份用 pygame 来实作并非难事。既然易用的轮子难寻，索性就自己建造属于自己的 GUI 系统。
显示文字
在 pygame 中要显示文字，...]]></description><category></category></item><item><title><![CDATA[Python 3 入门手札（15）threading 多线程模块]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/99706356</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/99706356</guid><author>jasper_ding</author><pubDate>Sun, 18 Aug 2019 16:59:27 +0800</pubDate><description><![CDATA[在 Python 中使用多线程只要用 threading 模块就能达成，建立一个线程的方法是用 threading.Thread() 类别来建立一个线程对象：
import threading
t = threading.Thread(target=函式名称, args = (参数,))

如果要执行的函式需传入参数的话，必须放在 threading.Thread() 里的 args 参数之中，而...]]></description><category></category></item><item><title><![CDATA[Python 3 入门手札（14）档案存取]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/98480131</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/98480131</guid><author>jasper_ding</author><pubDate>Mon, 05 Aug 2019 10:48:49 +0800</pubDate><description><![CDATA[Python 内建的 open() 函式可用来开启档案，它会传回一个档案对象，然后我们即可用档案对象的 read(), close() 等方法来操作档案。例如：
f = open(‘a.txt’)    # 以读取模式开启 a.txt 文件并传回一个档案对象
data = f.read()      # 读取档案内容
f.close()            # 关闭档案

开启档案时的参数设定
...]]></description><category></category></item><item><title><![CDATA[Python 3 入门手札（13）import 模块]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/97496196</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/97496196</guid><author>jasper_ding</author><pubDate>Sat, 27 Jul 2019 11:27:04 +0800</pubDate><description><![CDATA[Import 会将 python 代码从另一个文件中转移到当前的程序中。这些代码包括变量、函式、类别、模块及套件。
模块（module）
模块基本上就是一般的程序文件（.py）。在模块中可以定义各种变量、函式或类别。例如，我们自己写了很多函式，就可以将之储存到模块中，等需要时再汇入使用。
套件（package）
如果功能较多或较复杂，则可以将之分门别类储存到多个模块中，然后将这些模块存放在一个文件...]]></description><category></category></item><item><title><![CDATA[Python 3 入门手札（12）对象与类别]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/96704443</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/96704443</guid><author>jasper_ding</author><pubDate>Sun, 21 Jul 2019 11:53:15 +0800</pubDate><description><![CDATA[对象与类的三大特点：


对象（object）是由类（class）产生的。


类规划了对象的数据储存方式，这些储存的数据就称为对象的属性。


类规划了对象的操作方式，这些操作方式就称为对象的方法。


基本上类就像是对象的设计蓝图，有了类（蓝图）就可以用它来产生或建立对象。同一个类所产生的对象都具有相同的属性及操作方式，就像是同一个模子（蓝图）印出来的。例如，车厂设计好一车型的蓝图（类），然后...]]></description><category></category></item><item><title><![CDATA[Python 3 入门手札（11）函式 Function]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/96145571</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/96145571</guid><author>jasper_ding</author><pubDate>Tue, 16 Jul 2019 16:26:51 +0800</pubDate><description><![CDATA[使用变量的理由是为了要重复使用同一份数据，同样的，使用函式（Function）的理由是为了要重复使用一段程序。我们可以将需要重复使用的程序片段赋予一个函式名称，然后像变量一样，呼叫这个函式名称来重复使用这个程序片段。
设计自己的函式
定义函式要使用 def，语法如下：
def 函式名称(参数1, 参数2, …):
     程序区块

函式名称的命名规则就跟变量一样，其中参数可以有多个，也可以无参...]]></description><category></category></item><item><title><![CDATA[Python 3 入门手札（10）异常处理]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/95859234</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/95859234</guid><author>jasper_ding</author><pubDate>Sun, 14 Jul 2019 09:59:11 +0800</pubDate><description><![CDATA[Python 一开始执行程序时，会先全面检查语法，如果语法错误，就会停止执行，此时必须修正语法，然后重新执行。如果语法没有错误，但在执行过程中发生系统无法处理的错误，此时系统会产生一个异常（Exception），如果此异常没有被处理，那么就会一层层往上送给呼叫它的程序，直到有程序出面处理为止。如果送到最上层都没有被处理，那么就会终止程序的执行并显示错误讯息。例如：

为了避免程序因发生异常而被终止...]]></description><category></category></item><item><title><![CDATA[Python 3 入门手札（09）循环 while 及 for]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/95344055</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/95344055</guid><author>jasper_ding</author><pubDate>Wed, 10 Jul 2019 16:58:35 +0800</pubDate><description><![CDATA[如果需要重复执行某项工作，可用 while 或 for 循环来进行。其中 while 循环可依照条件来重复执行。而 for 循环则专门用来走访容器中的元素。
While 循环

语法如下：
while 条件式 :
程序区块
n = int(input('请输入一个正整数：'))
k = n
while n &gt; 1 :
    n = n – 1
    k = k * n
print(k)
...]]></description><category></category></item><item><title><![CDATA[Python 3 入门手札（08）if 判断式]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/94967867</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/94967867</guid><author>jasper_ding</author><pubDate>Sun, 07 Jul 2019 10:31:27 +0800</pubDate><description><![CDATA[If 判断式可以在程序中做「如果…就…」的判断，写法如下：
if a &lt; 1:       # if 判断式，判断 a 是否小于 1
    a += 1      #  右缩区块，表 a &lt; 1 时，才会执行。
    b = a + 3

print(b)        # 未缩排，不属于 if 区块。

属于 if 的程序区块要「以 4 个空格向右缩排」，表示它们是属于上一行的区...]]></description><category></category></item><item><title><![CDATA[Python 3 入门手札（07）多重指定与自动解包、打包]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/94581101</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/94581101</guid><author>jasper_ding</author><pubDate>Wed, 03 Jul 2019 17:47:46 +0800</pubDate><description><![CDATA[多重指定可以让我们一次指定多个变量，例如：
x, y, z = 1, 2, 3

在等号右边的数据列，其实就是一个没加小括号的 tuple。凡是在需要多个值的场合，tuple 会自动解包（tuple unpacking），然后将元素一一指定给对应的变量。此时等号两边的项目数量必须相同才行，否则会产生错误。
等号的两边都可以是容器
只要是可读取元素的容器，都可以自动解包。甚至等号的左边也可以是有顺序...]]></description><category></category></item><item><title><![CDATA[Python 3 入门手札（06）字符串 String]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/94133167</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/94133167</guid><author>jasper_ding</author><pubDate>Sat, 29 Jun 2019 11:10:51 +0800</pubDate><description><![CDATA[字符串（string）也是一种有顺序的「序列容器」，因此操作方法也和 List 很类似，不过和 tuple 一样，其元素是不能改变的。


同样有索引和切片的功能，例如：s=’0123456’


Python 没有「字符」类型，所以都是以〝只有一个字的字符串〞来表示。


在算符部分，+（串接）、*（重复 n 次）、in （包含于）及 not in 都可以使用。


在比较算符 &gt;, ...]]></description><category></category></item><item><title><![CDATA[Python 3 入门手札（05）在结构体中存储值 — dict]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/93312569</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/93312569</guid><author>jasper_ding</author><pubDate>Sat, 22 Jun 2019 12:02:02 +0800</pubDate><description><![CDATA[dict : 字典


Dict（字典）跟 set（集合）很像，其差别在于 dict 中的元素是以「键 : 值」成对的方式来储存，方便我们用键（key）来查询对应的值。


字典中的键必须是唯一的，但值可以重复。


字典是以大括号 {key1 : value1, key2 : value2, …} 来标示。


如果要建立空字典，可以用空的大括号 { } 或是不加参数的 dict()。


字典...]]></description><category></category></item><item><title><![CDATA[Python 3 入门手札（04）在结构体中存储值 — Set]]></title><link>https://blog.youkuaiyun.com/jasper_ding/article/details/92589372</link><guid>https://blog.youkuaiyun.com/jasper_ding/article/details/92589372</guid><author>jasper_ding</author><pubDate>Mon, 17 Jun 2019 11:33:38 +0800</pubDate><description><![CDATA[Set：集合


如果说 list 是「一串数据」，那么 set（集合）就是「一堆数据」。一串数据是有顺序性的，例如：〝甲〞、〝乙〞、〝丙〞…依序排列，而一堆数据则是随机摆放，没有固定顺序。


Set 要用大括号 {x, y, z } 来标示。


Set 的元素必须是唯一而不可重复的，如果加入重复的数据则会被合并。


除了使用 { } 来建立 set 之外，也可以用 set() 函式取用其他...]]></description><category></category></item></channel></rss>