简繁EN

So, Let's Start a Blog!

As far back as I can remember, I've wanted a website of my own, probably since I was in middle school. That was around 2001 or 2002. Blogs hadn't caught on yet, and for a lot of people the only chance to use a computer was at an internet cafe in some run-down alley. Looking back, that was the first faint spark of what got me into IT. I didn't know how to program then. About the closest I'd come was the stripped-down QBasic that came with machines like the Subor learning computer. We didn't have the flood of information we have now, where if you don't understand something you can just Baidu it or Google it. Most people around me didn't know what a computer was. The few who'd used one had only played Counter-Strike, Red Alert and, later, The Legend of Mir. So "CTRL+C" in the Subor manual had me stumped for two or three years. What on earth did the "+" mean? Then one day it hit me. Press CTRL and C at the same time. Bingo!

I majored in software engineering in college, so I had both the chance and the skills to build my own website. Personal blogs were starting to catch on, and I signed up for blogs on tech sites like CSDN and cnblogs, though I wasn't exactly diligent about updating them. I often had hundreds of links to technical articles in my browser bookmarks. I'd work my way through them and they'd pile up again. It's been ten years since my freshman year, and I've still got close to a hundred articles bookmarked that I need to dig into. I've written plenty of technical notes and summaries, too. The way I write and save them has gone from Notepad to Word to Evernote to WizNote to Cmd Markdown to Atom+OneDrive. I'll probably write a separate post about Atom later. It's a pretty good editor for both blog posts and code.

After I left college and started working, I often thought about getting back to blogging. I'd given it up before I'd got very far. The heyday of blogs has passed, even Weibo's star has faded, and WeChat Moments seems to have taken over the whole business of reading in spare moments. But for those of us who work in IT, technical blogs are still a big part of how we learn day to day. I'd also really like to share what I've learned over the years with everyone through a blog. From college to Tencent to Baidu to Microsoft, I've worked with a lot of products and technologies and collected a pile of bits and pieces. I've never had a good chance to sort through them and put them in a simpler form that's easier for everyone to follow. Sharing what you've learned is also a way to sum it up and go over it again. At work and in life, sometimes the farther you go, the less sure you are where you're going. Once in a while I'd like to stop rushing, look back and write down what I've been through, and remind myself what I really want to pursue.

So lately I've been trying to figure out how to set up my own blog with the energy I have to spare. In the end I went with Hexo and a simple theme, NexT. Markdown is the obvious choice for an engineer. What engineer wants to get stuck in the mud of rich text editing in something like Word? "Why is the line spacing in the second paragraph bigger than in the first?" "How do I get this list to start at 1 again?" ... One thing I like about Hexo is that I can write and manage posts in an editor like Atom, then use Hexo to publish them straight to GitHub Pages or anywhere else that hosts static web content. I can use my own root domain, too. Still, I spent quite a bit of energy on details like counting visits and setting up comments. The recent shutdown of the Duoshuo comment service in particular got me worried. Even if I use another free comment service, sooner or later I'll have to deal with that one shutting down, too. Backing up and exporting the comments then could be a real pain. In the end I decided to leave comments off for now and think about it again once the blog has a bit of a following. Right now a comment system is something I only think I need.

The main reason I didn't go with WordPress is that, for engineers like me, one big drawback of WP is probably how bad the Markdown looks. I tried all sorts of tweaks and still wasn't happy with it. Also, since I may edit posts fairly often after I publish them, to fix mistakes or add things, I'd rather manage the content in an editor like Atom (vim would work too, haha), skip the WP web editing box, and use a script to update and publish posts in batches. I'm also working on a script that publishes and updates posts by working directly with the WP database. That way I'll be able to update the WP post list in batches, much like publishing a batch of posts with Hexo. The WP database structure isn't very complicated. If all I want to do is update posts in batches, the script logic should be pretty simple. When it's ready I'll open-source it on GitHub so anyone can use it as a reference.

I've written a few series of related posts before, including write-ups of my solutions to LeetCode problems. I'll republish them here and also publish them separately with GitBook. GitBook is a bit like Hexo, but it arranges posts more like an ebook than a blog. That makes it easy to look things up and read a whole series on a topic without going through a pile of posts one by one. GitBook hasn't been out long, though. It's got plenty of bugs, few features, and a lot of the features it does have are incomplete. The plugins have pieces missing too, and many haven't been updated in ages or don't work with GitBook anymore. I may write a post about using GitBook later, with some of the problems I ran into and how I solved them.

OK, enough talk, let's get to it. A new star is rising in the blogosphere!