欢迎来到 艾瑞可erik 的魔法世界 🧙‍♂️

给我一个需求,还你一个项目——别管它是什么。这就是全栈。

📚 291 篇文章 🏷️ 504 个标签 📂 90 个分类

🔥 最新文章

centos安装第三方yum软件仓库

因为需要配置centos一些功能,系统自带yum仓库不全面很麻烦,百度一下就找到了第三方yum仓库。

  1. 安装第三方EPEL软件库

     rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    
  2. 导入key(不导入的话会出错)

     rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
    
  3. 把服务器的包信息下载到本地电脑缓存起来

Installing Third-Party Yum Repositories on CentOS

Because I needed to configure some features on CentOS and the yum repositories that come with the system aren’t comprehensive enough — which is a real pain — I searched on Baidu and found third-party yum repositories.

  1. Install the third-party EPEL software repository

     rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    
  2. Import the key (things will break if you don’t)

     rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
    
  3. Download the server’s package information and cache it locally on your machine

北方的杏仁

天黑了,夜色醉了……

时间重新回到2014年之前。天上不时有闪过明眸,我呆在尝尝未甘霖的雨露里慢慢享受着清晨着些……

校园上,暗绿色的草坪,起伏游荡有种说不出的沉重,默默逝色。我在,看着反复起落的情绪中陶醉无边。有时甚觉时间的颓败是一种生命的惩罚,只因我拒绝外在,拒绝失误……

断了阳光的玄子,间隙上插着儿时的微笑,不明间,不然已。一层层泡在天空的毛雪,是初春纤维的肆虐,这已出乎我的觉察,竟有些敬畏生命。感知你所知道的世界,觉察你所想达到的境界,淌洋于四周风的呼吸……

我在,这地方有如此多的爱。我在,还好我已经在。 别了,我的那个世界,涩甜的泉水,愤怒的不满,吼叫时代,终结着我和我的世界。而今6年有余,不曾再会回归……

不再,永不在,尚存已不多时日。 其实,北方的杏仁很苦,涩涩的苦……

Almonds of the North

It’s dark now, the night has grown drunk…

Time returns to before 2014. Bright eyes flicker across the sky now and then; I linger in the sweet rain I never tire of tasting, slowly savoring these early-morning hours…

On campus, the dark-green lawn heaves and wanders with an indescribable heaviness, silently fading. I am here, reveling boundlessly in emotions that rise and fall again and again. Sometimes I feel that the decay of time is a punishment for life — only because I refuse the outside, refuse to slip…

The mystery that has cut off the sunlight wears a childhood smile in its gaps, unknowing, unwilling. Layer upon layer of woolly snow steeped in the sky is the rampage of early-spring fibers; this has gone beyond my awareness, and I even feel a certain awe before life. Perceive the world you know, sense the realm you wish to reach, drift in the breathing of the wind all around…

I am here; this place holds so much love. I am here — thank goodness I am already here. Farewell, that world of mine: the astringent-sweet spring water, the furious discontent, the age of shouting, ending me and my world. And now, more than six years on, never to return again…

No more, never more; not much time remains. In truth, the almonds of the North are very bitter — astringently bitter…

Windows 上静态编译 Libevent 2.0.10 并实现一个简单 HTTP 服务器

[文章作者:张宴 ] 本文介绍了如何在 Windows 操作系统中,利用微软 Visual Studio 2005 编译生成 Libevent 2.0.10 静态链接库,并利用 Libevent 静态链接库,实现一个简单的 HTTP Web服务器程序:httpd.exe。 假设 Visual Studio 2005 的安装路径为“D:\Program Files\Microsoft Visual Studio 8\”,Libevent 2.0.10 解压后的路径为“D:\libevent-2.0.10-stable”。

Statically Compiling Libevent 2.0.10 on Windows and Implementing a Simple HTTP Server

[ Article author: 张宴 ] This article explains how to compile the Libevent 2.0.10 static link library on Windows using Microsoft Visual Studio 2005, and then use that Libevent static link library to implement a simple HTTP web server program: httpd.exe. Assume Visual Studio 2005 is installed at “D:\Program Files\Microsoft Visual Studio 8\“, and that Libevent 2.0.10 is extracted to “D:\libevent-2.0.10-stable”.

参加过二战的熊

在 爱丁堡有个叫Wojtek的传奇。不知你有没有见过这么一辆公交车,上面印有一头抱着炮弹的西伯利亚棕熊。它就是传说中的Wojtek,到过伊朗、跟波兰 人摔过跤、能喝酒、参过军、打过二战、扛过炮弹、揍过德国人,最终在爱丁堡动物园安度晚年。(来源:英国那些事儿维基百科 英国邮报)

The Bear That Fought in World War II

In Edinburgh there is a legend named Wojtek. I wonder if you’ve ever seen a bus with a Siberian brown bear clutching an artillery shell printed on it. That is the legendary Wojtek, who went to Iran, wrestled with Poles, could drink alcohol, served in the army, fought in World War II, carried artillery shells, punched Germans, and finally spent his later years in Edinburgh Zoo. (Source: Britain’s Those Things, Wikipedia, UK Daily Mail)

display:inline-block/text-align:justify下列表的两端对齐布局

by zhangxinxu

一、何为列表元素的两端对齐布局

首先说说何为两端对齐。下面这个截图是word中一段英文左对齐的右边缘截图:
word中文字左对齐截图 张鑫旭-鑫空间-鑫生活

可以看到右侧是参差不起的,现在,选中文字,点击word上方的两端对齐按钮,如下图:
点击word中两端对齐按钮 张鑫旭-鑫空间-鑫生活

结果文字的右边缘就成了这样:
word中两端对齐效果截图 张鑫旭-鑫空间-鑫生活

右侧完全对齐了,也就是整篇文字全部沿着左边缘和右边缘对齐显示了。 然后这里的“列表元素”指的是具有类似结构的重复列表元素,例如QQ校友中的图片列表:
列表布局示意 张鑫旭-鑫空间-鑫生活

所谓列表元素的两端对齐就是每行列表元素的第一个元素与父容器的左边缘重合,最后一个元素与父容器的右边缘重合。例如淘宝首页的热卖单品,或是人人网的热门分享列表(如下截图):
人人网热门分享列表两端对齐 张鑫旭-鑫空间-鑫生活

我想我们平时写页面的时候也经常会拿到的列表元素两端对齐的体验舒服的设计图吧。

Two-End Alignment Layout for Lists with display:inline-block/text-align:justify

by zhangxinxu

1. What Two-End Alignment for List Elements Means

First, let’s talk about what two-end alignment is. The screenshot below is the right edge of a left-aligned English paragraph in Word:
Left-aligned text in Word, by Zhang Xinxu - Xin Space - Xin Life

As you can see, the right side is ragged. Now select the text and click the justify button at the top of Word, as shown below:
Clicking the justify button in Word, by Zhang Xinxu - Xin Space - Xin Life

The right edge of the text then looks like this:
Justified text in Word, by Zhang Xinxu - Xin Space - Xin Life

The right side is now perfectly aligned, meaning the whole block of text is displayed flush against both the left and the right edge. And here, “list elements” refers to repeated list elements with a similar structure, for example the image list on QQ Alumni:
List layout illustration, by Zhang Xinxu - Xin Space - Xin Life

Two-end alignment for list elements means that the first element of each row lines up with the left edge of the parent container, and the last element lines up with the right edge of the parent container. For example, the hot-selling items on the Taobao homepage, or the popular shares list on Renren (screenshot below):
Two-end aligned popular shares list on Renren, by Zhang Xinxu - Xin Space - Xin Life

I think that when we build pages day to day, we often get design mockups with comfortable two-end aligned list elements too.

关于Javascript的俩个有趣的探讨

作者: Laruence

关于事件处理函数引用的一个佐证

之前, 我在分析Javascript的This关键字的时候, 说过, 当使用inline的方式写dom元素的事件处理函数的时候, 采用的是引用的方式. 刚好nullbyte童鞋给我提供了一个很有意思的Case:

  <img id="foo" src="xxx" onerror=" alert('error');
  } function foobar() {
  alert('www.laruence.com'); " />
  <script>
  alert(document.getElementById("foo").onerror);
  </script>

在IE下试试看.. 不过, FF和Chrome下都不行, 应该是FF和Chrome都会验证html代码的合法性.

Two Interesting Discussions About JavaScript

Author: Laruence

A piece of supporting evidence for event handler references

Earlier, when I was analyzing the Javascript this keyword, I said that when you write a DOM element’s event handler inline, it is applied by reference. It just so happens that a friend named nullbyte gave me a very interesting case:

  <img id="foo" src="xxx" onerror=" alert('error');
  } function foobar() {
  alert('www.laruence.com'); " />
  <script>
  alert(document.getElementById("foo").onerror);
  </script>

Try it in IE.. Though it doesn’t work in FF or Chrome either — presumably because both FF and Chrome validate the legality of the HTML code.

有夕阳在

IMG_20150118_172915清晨,灼眼的阳光贴在大地上。 时常怀念故时的时光。可以光着屁股泡在大街上玩耍。入夏,抓知了,用火烤着吃。逮蚂蚱,逗得小猫满屋子追着跑。掏刺猬,拔拔它身上的针。 因儿时,因年幼,无知中,无拘束。 如今很少待在老家,也未曾看到闪闪的萤火虫,满地满地的花生、毛豆。 回想一下总会傻笑自己的无知,到现在的成熟。有任性的倔强,傻傻的支持,笨笨的给予。 他们都说我还是我,只是少了原来的我。很庆幸,我只做我。 有夕阳在,我不去担心阴暗空气。总用我的世界来爱着她。

There Is a Sunset

IMG_20150118_172915Early morning, the blinding sunlight clings to the earth. I often miss the days of old. When you could soak yourself in the streets playing. Come summer, catching cicadas and roasting them over a fire. Catching grasshoppers, teasing the kitten until it chased us all over the house. Digging out hedgehogs, plucking the spines off their bodies. Because of childhood, because of youth, in ignorance, without restraint. These days I rarely stay in my hometown, and I’ve never seen the glimmering fireflies, or the fields and fields of peanuts and edamame. Looking back I always giggle at my own ignorance, and at the maturity I have now. There’s a willful stubbornness, a silly support, a clumsy giving. They all say I’m still me, just missing the old me. I’m glad — I only do me. With the sunset there, I don’t worry about the gloomy air. I always love her with my whole world.

Answering a Common Question About PHP Floats

Regarding PHP’s floating point numbers, I wrote an article before: What you should know about PHP floats (All ‘bogus’ about the float in PHP) However, I left one thing out at the time, namely the answer to this common question:

1
2
3
4
<?php
    $f = 0.58;
    var_dump(intval($f * 100)); //why does it output 57?
?>

A PHP Function for Sending HTML Emails

by 张宴 wrote a simple PHP function for sending HTML emails. Function description: send_mail(“sender address”, “recipient address”, “email subject”, “email body”); Example: send_mail($from, “info@zyan.cc”, “This is the email subject”, “

This is the email body

“); The code is as follows:

view plainprint?