这个无所谓存在的宇宙

本来想用英文写的, 怕自己表达无力, 还是用中文吧.

这些都是最近自己的想法, 当然, 现在我对这些想法深信不疑. 东西很消极, 大家请别觉得我神经, 其实觉得也无所谓.

首先需要说明的是, 我信仰无神论和决定论. 无神论好理解, 决定论也就是我不相信自由意志的存在, 觉得一切从一开始就已经注定了. 注意注定的是每一个细节, 包括你我此刻在想什么, 以后会想什么.

我从小就想知道, 这个宇宙的本质是什么, 我想现在我自己已经大致了解了宇宙是什么, 虽然我所猜测的东西没有任何实用价值. 这不是关于什么物理定律, 也不是关于造物主. 或者它更应该是一个哲学上的问题.

我的答案是, 宇宙存在, 也不存在, 需要注意的是, 这里及后文的 “宇宙” 是指最根本的, 不是指我们的世界 (包括外太空什么的). 因为宇宙本身并无任何属性与规律, 甚至没有真与假, 存在与不存在之分.

所以我们又算什么? 我们能感受到的一切, 难道都是假的吗? 之前我说过, 宇宙本身是没有真与假之分的, 所以按说不能给我们是真还是假一个答案. 但是为了方便理解, 请先认定, 我们都是假的.

这真的是一个难以接受的想法, 我非常理解. 我还是继续说吧. 不仅是我们, 还有我们生存的世界, 地球, 太阳系, 银河系… 它们都存在, 但也都不存在. 最后更深一层的, 我们所在的这个世界的规律, 它们存在, 也不存在.

对于我自己的想法而言, 这里已经到达了核心. 即, 我们目前所感知的一切 “存在”, 都是建立在我们所 “存在” 的这个世界的规律之上的. 而这些存在却不存在的规律, 对于我们, 就是一切. 我想如今物理学所探讨的, 也就是这些存在却不存在的规律吧.

想到了佛家的一句话 “色即是空, 空即是色”. 对于这个宇宙, 有即是无, 无即是有. 因为宇宙本身是一切, 同时它也什么都不是. 如之前所说: “宇宙本身并无任何属性与规律”, 我们此刻说, 宇宙是存在的, 其实不然, 有发现自己犯了一个什么错误吗? 说宇宙存在, 是把我们所存在 (这里使用存在, 我想应该是正确的) 的这个世界中物质的一个属性 (存在或不存在) 加在了一个没有这个属性的东西 (或许这里也不能称作是东西) 上.

就说到这儿吧, 我想能理解的人已经理解了, 不能理解的想理解也不容易了…

Original link of this archive: http://vilic.info/blog/archives/617
本文的原始链接: http://vilic.info/blog/archives/617

JavaScript for…in 语句的最佳用法

大家对JavaScript里的for…in语句一定不陌生吧, 不过, 这个语句有时会做一些我们可能不想它做的事. 比如:

Object.prototype.test = function () { };

var obj = {
    a: “aaa”,
    b: “bbb”
};

//需要说明的一点是, 这里的i类型为string, 即使是对于数组, 也同样如此.
for (i in obj)
    alert(obj[i]);

结果发现test方法也跑出来. 为了避免这样的情况, 我们通常做简单的处理:

for (i in obj)
    if (typeof obj[i] != “function”) 
        alert(obj[i]);

不过如果枚举的类型里也有function呢? 所以, 提出我认为的最佳方案:

for (i in obj)
    if (obj.constructor.prototype[i] === undefined)
        alert(obj[i]);

Original link of this archive: http://vilic.info/blog/archives/613
本文的原始链接: http://vilic.info/blog/archives/613

JavaScript完美实现函数重载

今天Google了一下JS的函数重载, 居然没有发现自己的文章, 结果在博客内搜索了下, 才发现是SEO的问题.

于是, 在这里贡献出暑假的时候写的JS函数重载, 其实它本身是自己的类库vejis的一部分, 不过vejis估计短时间内不会完善了, 所以现在把代码单独提出来, 供大家使用. 至少这是目前我见过的最爽的JS函数重载.

先看示例代码:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>

<html xmlns=”http://www.w3.org/1999/xhtml“>
<head>
    <title>JavaScript完美实现函数重载</title>
    <script src=”vejis-mo.js” type=”text/javascript”></script>
    <script type=”text/javascript”>
        /*
            这个函数重载代码是vejis库的一部分, 现在单独提取出来分享.
            vejis命名空间下有两个特殊的类型, Integer和Null, 在调用vejis.use(vejis)后即可直接使用.
        */

        /*
            使用vejis命名空间, 将目标对象的方法和属性拷贝到window对象, 第二个参数可选, 指示是否覆盖.
            Method, _等都是vejis的成员.
        */

        vejis.use(vejis, true);

        //定义一个方法
        var test = new Method();
       
        //重载, 1个String类型的参数
        test.overload(String, function (msg) {
            alert(msg);
        });
       
        //重载, 1个Integer类型的参数
        test.overload(Integer, function (n) {
            alert(“The integer given is ” + n + “.”);
        });

        test(“Hello, Vejis!”);
        test(57);

        //以下为简写
        var test2 = _(function () {
            alert(“No arguments given.”);
        });

        test2._(Object, String, function (obj, str) {
            alert(“You’ve given me a Object and a String!”);
        });

        //自定义的类型
        test2._(MyClass, function (mc) {
            alert(mc.description);
            mc.sayHello();
        });

        test2();
        test2({}, “”);
        test2(new MyClass());

        function MyClass() {
            this.description = “This is my class.”
            this.sayHello = _(function () {
                alert(“Hello! I am MyClass!”);
            });
        }
    </script>
</head>
<body>
</body>
</html>

木哈哈, 是不是很爽~ 其实这里不止可以实现JS重载普通的函数, 还可以重载类型, 慢慢发掘吧~

脚本在这里, 当然, 因为只是提取的函数重载部分, 其他的我能删的都删了:

http://www.vilic.info/vejis/vejis-mo.js

2011.3.13 文件有改动, 详见: http://www.vilic.info/blog/archives/638

Original link of this archive: http://vilic.info/blog/archives/610
本文的原始链接: http://vilic.info/blog/archives/610

The Two Possibilities

(This article is partly the same with a previous one)
I have thought about the producing of consciousness for a long time. And days ago, I got an important inspiration from a common sense: we cannot remember anything that happened when we were too young, at generally less than 3 years old. But why?
I think there are two possibilities. And either of them has the same necessary condition —- we can feel ourselves. Just try to remember anything that’s without your consciousness. But I guess you can’t.
So, get back to the possibilities.
The first one is that our memory system might not be powerful enough to “record” our consciousness when we are too young. So, even if the things happened are recorded, our consciousness are not, one can never remember a thing recorded without our consciousness.
And the second one, which I believe is the truth, the very young human beings have not got clear consciousness cause the regular activities in our brain is not complex enough (I believe regular activities of anything can produce consciousness) to produce clear consciousness.

Original link of this archive: http://vilic.info/blog/archives/606
本文的原始链接: http://vilic.info/blog/archives/606

Who am I

So, who am I in your mind? A programmer may think I am a good JSer; a computer user may think I am a computer master; a people who have saw my paintings may think I am really good at drawing; a teacher who recognized I never listen to his or her class may think I am a bad student; a classmate who don’t really know me may think I am a good guy who has some talents but is a little strange; my friends may think I am a boy born with dreams.

I am lucky to have a quite high IQ, and I thought it’s the most precious thing my parents gave me. But I am unlucky to have an IQ that’s not high enough. I am a man standing between the ordinary people and the geniuses, called sub-genius. I have the dreams the geniuses have, but I may not be able to realize them because I can’t think as a genius.

You may say, efforts can create a genius, but they can’t. Just like something I think it simple will always be a mystery to some people. So, get back to the question, who am I?

Yes I am a boy with dreams. I don’t care about money, power or something else. I just want to know about the world and leave the world without pities. At least, I did want to. Little people know my dream of being a theoretical physicist, cause my physics is not at the top of my class, I mean ordered by examination. I was addicted to create my theory of the universe, seems crazy but it’s true. But whatever I create, it would not change the scores I got. I am full of imagination; I got to understand some things by myself. The only pity is, what I understood has already been understood by people yesterday. But I dreamt, one day I will understand something, which hasn’t been understood by the others.

Then I get into how is the producing of our consciousness, another mystery for human to solve. Some people know I am an Atheist and Fatalist; this makes me think everything in the world usual. When I feel sad about something, I will say to myself. All the things have been decided since the universe born. Then I will be happy again. And I was always a positive man because I believed I was born to achieve my dreams.

But it changes. The more I think about “what is consciousness”, the more I feel my life is nothing. Consider it, when you recognize everything is false, how will you feel? Fortunately, it will only happen when I think about these things.

But it’s also interesting thinking about the unpleasant stuff. So I turned my direction from theoretical physics or web programming into AI studies (actually, it’s not after I recognized the unpleasant thing).

But now, I want to turn back. Maybe physics is just the one I really want, or maybe, I think I have got to know what consciousness is. I want to continue build my theory, at least, I am now wanting to.

So, you may have noticed I write little about programming. Yes, because I know the difference between dreams and hobbies. A dream is the thing you want to achieve to realize your value, but a hobby is just a thing that can make you feel good.

That’s might be me, part of me at least.

Original link of this archive: http://vilic.info/blog/archives/603
本文的原始链接: http://vilic.info/blog/archives/603