手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表2012年08月的文章

TextMate高端黑引发开源“圣战”????

前两天好象听说。textmate 开源了?不知道是否听错,但传闻是在st(sublime Text2)的压力下开源的。。。(没有亲见,只是听闻而已)
结果又在cnbeta上看到标题所在的新闻了。。。
cnbeta上这么写着:

感谢中国 Linux 公社的投递
最近,一位 ID 为 ieure 的用户在文本编辑器 TextMate 的 GitHub 上提交了一个 patch,号称“修复了许多 bug”。在描述中,他说自己尝试使用 TextMate2,但是遇到了很多不可接受的错误。于是他制作了这个可以解决一切问题的 patch。

但这个 patch 的改动量实在是太大了,大到令人怀疑:算下来这个 patch 一共执行了几百万次代码改动。果然,这是一个来自高端黑 Emaser 的作品:这个 patch 会把 TextMate 删除干净之后安装上 Emacs.

于是这 patch 自然又是引起了一次已经让大家习以为常的“圣战”,Vim 用户也积极插上来一脚责问作者为什么不把它换成 Vim。但亮点根本不在于这场圣战本身,而是在于围观群众。

大量的中文用户观光团(包括但不限于豆瓣、煎蛋)跑到了这页面下面围观并留下脚印。现在,这个页面上绝大多数的留言都是中文的,内容也大多都是“XX观光团”。这还真是一则相当不错的黑色幽默呢。

截至发稿时,这个页面已经基本被中文回复占领,用户大多是来自豆瓣/人人/新浪微博/煎蛋的围观群众。

围观地址:GitHub

---EOF--
果然看到了很多类似“<豆瓣观光团> ”这样的内容。。。。中国人真多,这是我的感慨 .其他没了。

PHPer下一步应该学go?

其实看到现在,很多人都在推荐go语言,理由有很多种,但对于PHPer来说,不一定就是适合的。go是google推出的语言,到现在为止也已经有很长时间了,再加上go又能底层,又能WEB,所以。。。
但是,究竟应该不应该学,还是会有点想法,所以看到这篇全英文的介绍的时候就蛋定不了了。
原文是来自于:Why you PHP guys should learn Golang

Go or Golang, is a open source, community supported, fast, consistent, scalable, productive language, and conceived by Google. More and more applications were build with it. Although Rob Pike has said that “… we expected C++ programmers to see Go as an alternative …”, but I really think of that: You PHP guys should learn Golang! Let’s talk about WHY.

 

Easy to learn

PHP is easy to learn. Golang is as easy as PHP!

The syntax of PHP is similar to C family’s programming languages(C/C++/Java etc.). If you have some experiences with those languages, it is not too hard to write some codes when you first met PHP.

Golang is also a C family’s programming language. Eh… with a litte syntax difference. For example, the keyword “for” is similar with PHP’s, but without the pair of parentheses. And the condition keyword “if” is without the pair of parentheses either. You can read Effective Go for more things.

Golang has only 30 keywords and 47 operators, delimiters or other special tokens. There is no need to work hard for remembering all the literals. The type system is exquisite and easy to use. No huge OO but a practical struct type with methods on it. The interface design is one of my favorate parts of Golang. When you have finished this A Tour of Go, based on your PHP experiences, some jobs could be done with Golang immediately.

Easy to Use

Your PHP scripts will be evaluated by SAPI components: web server module, PHP-fpm or CLI. All needed for PHP deploying is a SAPI environment. Deployment of the environment is the most difficult part to understand for a PHP beginner.

All the Golang’s codes will be compiled and linked into native code. So there is no need to deploy a environment for it executing but a build environment. Compaire with deployment of the PHP environment, it is not so much complex. Do you really think of the deployment of the PHP environment is really complex? I don’t think so. Really!

To deploy the build environment, just need 3 steps:

  • Download Golang‘s source code.
  • Setup the environment variables. Here’s a great blog post: Go environment setup
  • Run the ‘all.bash’ in the ‘src’ directory.

Or only one step: Use the binary package to setup.

Then a toolset called “go” can be used. Using the go tool is as easy as using PHP’s CLI tool. “The Go Tool” has already explained it.

A myth of PHP

If a programming language is easy to learn and use, shall we learn and use it? Lots of programming languages are easy to learning and use. Shall we learn and use all of them? The answer is straightforward: NO!

But why you PHP guys should learn Golang? Just because it is cool! Ja, I’m kidding, but it is true. Anyway, let’s talk about PHP itself first.

PHP is “a general-purpose server-side scripting language originally designed for Web development to produce dynamic Web pages.(Wikipedia)”. The most important feature of PHP is embedding with HTML. PHP code write in “<?php … ?>” tag; HTML write outside. It also has a powerful extension system. The extension can be writen by C with Zend API. Data processing was actually done by those extensions. IMO, PHP must be the best template programming language.

But if you have years experiences with PHP and began face to some complex web application. You must have already felt some powerlessness to PHP. It dosen’t have concurrent mechanism build-in, no threads, multiprocessing or X-routines. A slow data source will be blocked entire page’s processing. A powerful web server in the front of PHP is always needed. Backend programes were writen to process data. Message Queue, Cache, Proxy … The system is not only about PHP, but also about a lot of services and system components. This time, PHP is really be a template language with few logical jobs.

PHPers are always looking for solutions, like “PHP multithread” or a concurrent RPC framework for PHP. I could not say witch one is better. But I’m sure that you must choose an other programming language for the backend job. In my own case, I tried C(struggle with malloc/free)/Java(stumble in the jar hell)/Python(never be pythonic but type lost)..If I get profermance, I must struggle with the memory management; If I use GC, I must deploy and turning VM; If I get convenient, careless would kill me….Eche has advantages, each also has a problem.

OK! Let’s back to Golang now!

Golang has GC, there is no need to care about memory management(or could pay less attention to it). And the code are compiled into native machine code. So, “cp” and “mv” are all needed for deploying the application writen by Golang. Oh, as I just said, Golang is a compiled language with a static type system. You have no chance to confuse veriable types. Of course, one of the most important thing is PHPer who moves to Golang “don’t have to surrender much expressiveness, but gain performance and get to play with concurrency(by Rob Pike)”. “Why Not Go?” talked about this deeply.

I would show parts of my own experience: a Gearman worker works for us to process backend data. PHP connected to the worker though Gearman Job Server with its Gearman API. The original worker was writen by python. There are lots of problems with that version(They are our own problems, but python’s). But it works for us. Then we rewrite the worker with Golang. It was amazing. I wrote a Gearman API for Golang, and a Golang package using Zend API(cgo is another amazing thing) for evaluating the PHP script in Golang. Then combined them together – A Gearman worker witch can execute PHP scripts. It works about 3 mounth in our production enverionment and looks great! Oh, I also wrote a RPC-combinator for combining the RPC call in PHP script. It will be used in our next product.

Everything goes right. Thanks Golang!

In any case, most of PHPers alwasy need to learn other languages for the backend development. If you have began looking for, or already tasted some of other languages. Why don’t you try Golang? It would make your life happy and easy. You could spend more time with your family and friends, eat your favorite foods and visit the places you love.

That’s why you PHP guys should learn Golang! Is it enough? I think so!

This is my writing exercise. If you find any grammatical or spelling error, plz tell me!

---EOF---

其实我也挺纠结的,要知道当时我刚跟着tour做了30多篇的时候,突然golang的网页就再也打不开了。再苦了,墙就是我们学习的最大障碍。想想这些年我们遇到了什么。。
sf.net被墙
groups.google.com被墙
python.org被墙
很多。。。。。这些都是我们的障碍啊

程序员遇到BUG怎么办?

这是微博上的一小段内容:
【程序猿被提bug之后的反应】1.怎么可能;2.在我这是好的,不信你来看看;3.真是奇怪,刚刚还好好的;4.肯定是数据问题;5.你清下缓 存试试;6.重启下电脑试试;7.你装的什么版本的类库(jdk)8.这谁写的代码;9.尼玛怎么还在用360安全浏览器;10.用户不会像你这么操作 的。
原微博在这里:http://weibo.com/1577794853/ywgaHrmRE

哈哈。有好多次都是以5来处理。但现在没有很好的缓存清理工具。一般不会说10.。。说10的话太恶心了
大小: 81.92 K
尺寸: 201 x 376
浏览: 1423 次
点击打开新窗口浏览全图

重拾扔了两年的scala

Scala被我扔了很久了。没办法,项目中根本用不到。而且说真的,不是相对较大的公司,以及项目很多很杂的公司,混合编程真的很少用的到。一般来说用用C和PHP就能解决N多事情了。当然C我也是垃圾。。。。可是如果你并不深入,C用的也很少。不是吗?

现在很多项目中越来越追求一些其他的特性,不得已,重新拾起来。原来我在学scala的时候,只是简单的折腾了几下就完事了,现在可能要深入一下下了。。亚力山大啊

Scala大家都知道啦,其实说白了,Scala就是一种针对 JVM 将函数和面向对象技术组合在一起的编程语言。Scala编程语言近来抓住了很多开发者的眼球。它看起来像是一种纯粹的面向对象编程语言,而又无缝地结合了 命令式和函数式的编程风格。Scala的名称表明,它还是一种高度可伸缩的语言。Scala的设计始终贯穿着一个理念:创造一种更好地支持组件的语言。 Scala融汇了许多前所未有的特性,而同时又运行于JVM之上。这两年,随着开发者对Scala的兴趣日增,以及越来越多的工具支持,无疑Scala语言将成为手上一件必不可少的工具。

因为资料确实不多,所以就找了51cto上面的一个专题来看:http://developer.51cto.com/art/200906/127830.htm,不过可能更多的还是需要看官网的手册了。否则真的没有办法深入。

专题上有不少链接还是有用的,其他的就当看新闻吧,不过也是旧闻了。。。

还有三个较长的玩意。。。

A Scala Tutorial for Java programmers(完结)

本文源自Michel Schinz和Philipp Haller所写的A Scala Tutorial for Java programmers(面向Java程序员的Scala教程),由Bearice成中文。本系列面向有一定Java开发经验的程序员。

走读Kestrel,了解Scala(完结)

Kestrel是一个Scala代码实例,是Twitter核心中使用的的消息转发机制,其原型来自于Ruby的Starling。本系列通过Kestrel进行Scala实例代码的讲解,对于实际使用Scala进行开发有相当的借鉴意义。

IBMDW的《从Java走进Scala》系列(更新中)

本系列由Neward & Associates的主管Ted Neward主持。本系列从08年初开始连载,可以说是早期Scala教程中的比较精彩的一个系列,对Scala语言中的很多细节都进行了描述。

-------

如果你兴趣不大就当看我这边也是一个新闻 吧。

一不小心又把数据库折腾挂了

一不小心又把数据库折腾挂了。你妹啊。我只是移动了一点文件,居然就直接挂了,无法启动
再启动的时候,居然直接说。。。mysql启动文件找不到了。什么mysqld_safe之类都在。就是没有mysql。。。
当时心里就郁闷了。用repair修复的时候说。。。plugin表没权限 又说host表没权限 .
苦。最后在vampire的帮助下才搞定了。

苦。

Tags: mysql

Records:41123456789