Regex filter visible characters with character class

最近有一个任务就是过滤掉文件中的非法不可读字符,也就是除了大小写字符,数字还有标点符号外其它的所有字符。网上找竟然没有现成的,就自己写了一个:

"[^a-zA-Z0-9 -/:-@\[-`{-~]"

符合这个条件的字符都会被替换为空,虽然可以更精简一点,不过我还是把标点符号那一部分孤立出来了,加强了扩展性,小伙伴们可以直接摘取,标点符号有几段是不连续的。

Recently a task was put on my desk which I needed to write a regex to filter out all non-readable characters from . In other words, only alphabetic, numeric and symbolic characters are allowed in that field. Well, I did not find anyone wrote this kinda of regex on the internet and came up my own one:

"[^a-zA-Z0-9 -/:-@\[-`{-~]"

All characters meets the above regex will be replaced with an empty string. Though it can be more simple, for compatibility, I just isolated the symbolic part from other two parts (alphabetic and numeric). The symbolic part is not continues and has several chunks coz those chunks are not continuous on the ASCII table. Please feel free to use it and leave your comment below.

Recaptcha 2 is now on site

There was a spamming problem on my blog a few months ago. Though I have Akismet to block them, I quickly get bored seeing my spamming box is filled with trashes. It is necessary to include some kinda of verification stuff for the comment module.

Unfortunately, due to my laziness I left an unfinished verification system for months. :(

Well, the comment function here is no longer disabled. I just implemented Recaptcha 2. K, now please get busy commenting! XD

=======================Translation===========================

之前我一直深受垃圾邮件的困扰。即使我有Akismet插件可是我很不喜欢看到我的垃圾邮件箱充满了无用的广告。我想我需要给评论模块加一个验证机制。

可惜我灰常懒,我一直留着一个未完工的验证马系统在那里好几个月。

不过现在就好了。我刚刚引入了Recaptcha2。现在小伙伴们可以尽情评论啦!O(∩_∩)O哈哈~

Windows Server 2012 on ESXi 4.1

From: http://jgiffard.wordpress.com/2013/06/25/windows-server-2012-on-esxi-4-1/

My I.T infrastructure at home has 4 ESXi 4.1 servers which host a number of VMs that are used for home and work purposes.  However, my organically grown infrastructure has now reached the point where it needs re-organising.  As part of that I’m installing new A/D controllers and decided to use Server 2012.

And then found that ESXi 4.1 doesn’t support it.  Try it and you’ll get the Server 2012 sad face appearing.  I don’t have time just now to update to ESX5.X on my servers, so I hunted around the Internet to see if there was a workaround.

I found these set of instructions ( really don’t do this for a production environment )

    • Create a  new VM over the vSphere Client.
    • As “Guest Operating System” use Microsoft Windows Server 2008 R2 (64-bit)
    • After VM has been created but before first power on, download the following  bios file and upload it to your ESXi datastore into the folder of the VM
    • Now open the .vmx file of the new VM and add the follwing lines
bios440.filename = "bios.440.rom"
mce.enable = TRUE
cpuid.hypervisor.v0 = FALSE
vmGenCounter.enable = FALSE
    • Power on VM and Server 2012 will install and run