Skip to main content

转战 Hugo, 博客迁移之路

· One min read

都快要把自己感动, 从最初(2011年)的 Wordpress, 到后来自己开发的 Tellets , 现在又到了 Hugo.

之所以抛弃 Wordpress 是因为它太笨重了,那些年是租的虚拟主机来挂博客,每年也还会有些投入,但是后来很少维护了,便不在想续费了.

后面想找一个轻便的能根据文件时生成的博客系统,所幸找到了 Droplet,但发现好多东西都不能满足要求,后来把 Droplet 完全重写成了 Tellts,自己添加的最喜欢的功能是直接配置 Github 的文章引用. Tellets 也是 PHP 的,而且必须要支持文件操作,但很多 PHP 应用服务器都不提供文件操作(例如: 新浪 SEA, 当初的京东云擎),后来主机停了便没有去管了. 再后来有点想用 Go 重写 Tellts, 但实在没时间,然后又过了很长一段时间.

在工作的情况下需要了解 Docker, 顺势也就利用 Docker 部署了 Hugo.

CentOS 新手

· 14 min read

记录我玩 centos 的经历 很多时候需要 sudo 等 root 权限的时候需要自行判断.尽量不直接用 root 帐户.

我自己使用时的主要安装过程

初始配置 -> 设置好 openssh-server -> 添加额外的 repo -> 安装 git 下载我的dotfiles 其他步骤则按需进行

我的编程之道

· 5 min read
  • 能不能做
  • 该怎么做
  • 这样做会遇到什么问题
  • 我有没有办法能够协调这些问题
  • 将来会有什么样的改变
  • 我需要运行在什么环境下
  • 用什么语言写
  • 运行时需要依赖什么条件
  • 测试是否通过

学习之谈

· 3 min read

一下内容之作为个人学习的一些经验 带有强烈的主观色彩, 不能认为完全正确. 😄

小东西

· One min read

Little things make life better.

这里收录了我平时自己或者别人找我做的一些东西,就记录在这里了. 不在乎天长地久,只在乎曾经拥有.嘿嘿

学生考勤系统

· 2 min read

别人作业啥的~~,不过还是学到了一些技巧

尚且还有一些问题没解决的

  • 作为阴影的窗口,不能设置 ShowInTaskBar = false, 设置后会消失,这个相对比较麻烦,没处理
  • 画阴影的函数还不是很完善,只能是类似的阴影

截图​

登录页面

查询,操作页面

一些技巧

让窗口可拖动​

是重写的WndProc,而不是传统的鼠标事件


// Let Windows drag this form for us
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x0084 /*WM_NCHITTEST*/)
{
m.Result = (IntPtr)2; // HTCLIENT
return;
}
base.WndProc(ref m);
}

传统版本

// In form load

var lastPoint = new Point();
var _isDraging = false;
MouseDown += (sender, e) =>
{
_isDraging = true;
lastPoint = e.Location;
};
MouseMove += (sender, e) =>
{
if (! _isDraging)
return;

int ox = e.X - lastPoint.X;
int oy = e.Y - lastPoint.Y;
Location = new Point(Location.X + ox, Location.Y + oy);
};
MouseUp += (sender, e) => { _isDraging = false; };

实现类似的窗体阴影​

是使用的一个类 Dropshadow.

最开始从这里 看到能实现阴影的方法,后来有查找了很多东西,修改成了 我自己的 Dropshadow 版本.调用方法

var f = new Dropshadow(this)
{
BorderRadius = 40,
ShadowColor = Color.Blue
};

f.RefreshShadow();

在 DataGridView 中使用 DateTimePicker​

这个忘记了具体是在哪里找的了,使用 CalendarColumn 和 CalendarCell 即可.在设计时可以直接选择.

圆角边框​

[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
public static extern IntPtr CreateRoundRectRgn
(
int nLeftRect, // x-coordinate of upper-left corner
int nTopRect, // y-coordinate of upper-left corner
int nRightRect, // x-coordinate of lower-right corner
int nBottomRect, // y-coordinate of lower-right corner
int nWidthEllipse, // height of ellipse
int nHeightEllipse // width of ellipse
);

// in form load
Region = Region.FromHrgn(Win32.CreateRoundRectRgn(0, 0, Width, Height, 20, 20));