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

杂七杂八:editplus and netbeans

Editplus和netbeans是什么我想不用详细介绍了吧。一般做PHP开发的人,几乎都了解这两个玩意。
Editplus是韩国人开发的,Netbeans是Sun的产品。

先说Netbeans吧,嗯,他们的东西还算不错,只是让我们写PHP的人郁闷的是,它没有自动换行(line wrap),所幸,6.10开始,这个功能已经被加进去了。现在用6.10M1的版本都可以进行尝试,但在尝试前,请记住(扫描项目的时候,不要设置换行,否则80%的机率会让你的NB爆掉)。

官方这样解释:

XML/HTML代码
  1. Guys from editor infrastructure asked me to help him to test new editor infrastructure that brings up also line wrapping features. Probably you remembered that this feature was enabled during NetBeans 6.9 development, but because it introduced many problems and there wasn't time to stabilize it enough, it's not in NetBeans 6.9 available.   
  2.   
  3. We would like to stabilize the new infrastructure as much as possible before it will be switch on to be be available by default.You can enable the feature in development build through command line option: -J-Dorg.netbeans.editor.linewrap=true . Do it only with a development build, even if the optoin works in NetBeans 6.9, the new infrastructure is not stable enough there.  
  4.   
  5. So I would like to ask you, if you use a latest development build, run the build with the mentioned option. You can start NetBeans from command line with the option or place the option in the ${nb_dir}/etc/netbeans.conf file (add into netbeans_default_options).  
  6.   
  7. When you started NetBeans with this, there should be Line Wrapping option in the formatter.  
  8.  大小: 51.28 K
尺寸: 500 x 315
浏览: 1752 次
点击打开新窗口浏览全图 
  9. When you find out an issue with it, please report it in our Bugzilla. For such issue the product should be Editor, component Painting & Printing and please mark all reports with the status whiteboard: linewrap so we can easily track them. The tentative plan is to enable this again for M1 of NetBeans 6.10 but this all depends on the additional feedback and testing.  
所以昨天我换过了新版本进行了尝试。只是效果没有想象中的那样好。但,总比不能换行好。这是实际效果:

大小: 8.68 K
尺寸: 290 x 181
浏览: 1732 次
点击打开新窗口浏览全图

只是换行后多了一个回车显示着而且不能消失,看起来有点挫。。

接下来说Editplus,昨天晚上,乔大姐(HonestQiao,乔楚)兴冲冲的在群里说,Editplus支持PCRE的正则了,大家快更新啊,不更新会后悔的。。于是到官方看了一下changelog,然后进行了更新。

再接下来就测试,结果,让人大吃一斤的是,有很多正则条件输进去,立刻就把Editplus给爆了,比如:?\d、.*+?之类的,还有就是.*能够匹配一行,.*?一个也不能匹配。

不过简单的正则匹配还是没问题的(如果你升级了该版本,建议你在正则搜索前,先保存你的代码,否则可能会想哭但是哭不出来)

官方的changeLog: 'Use TR1 regular expression' option ('Preferences'->'General').

据说,最后乔大姐忍不住发邮件去鄙视那位开发者了。

Tags: editplus, netbeans

删除小数点目录

上午某群内好友中了木马,目录名中都是小数点,无法删除。找了一下资料,以做备份吧。。

----start--
这些有小数点的文件夹其实是windows系统存在的一个bug,因为不容易被删除而且很隐蔽,因此经常为一些入侵者利用存放一些木马之类的文件。虽然我们不能像删除普通文件一样删除这种文件夹,但总归有删除办法的。懂得了这种文件的创建原理,删除自然就好办了。有关该原理的介绍具体可以看《建一个别人进不了删不掉的绝密文件夹》这篇文章。

删除办法为:在CMD下通过rd命令+文件名+"./"来删除,如果文件夹下有文件需要先删掉内部的文件(一般为木马文件),那么如何进入这个文件夹呢?可以通过“start+目录的绝对路径”命令进入,如:start d:\web\sites\1..\。
----eof---

后来,朋友是删除了这个目录了。。HOHO,想不到,还有Start这个命令。(百万宝贝告诉我,Start命令失败。。。)

原文:http://www.aspxhome.com/security/20092/760121.htm

笑看:PHP将死 何以为继?

cnbeta上看到篇文章,不敢独乐,全文引用一下,与君共乐。事实上,今天在PHPRPC群里已经被人鄙视了,那位兄台说,现在除了c#和as比较高级外,其他的都不行。一下子觉得好自卑啊,原来我们就是处于边缘线上的人物。那位兄台也说PHP将死,于是我又感觉自己行走在死亡线上,鸭梨真的很大。

上原文:新闻来源:外刊IT评论
是到了PHP落幕的时候了。就在我这个顽固的PHP分子正要把一个现有的Ruby on Rails代码库转换成PHP时,我要说这样的话。历史在重演 我认为PHP将亡,因为我以前见到过。大概十年之前,PHP灭掉了Perl。当然了,并不十分彻底;它还坚守在某些环境里,它还有相当可观数量的顽固粉 丝,遗留下来的应用程序也需要维护,持续几十年。但这种语言对于新一代的人,特别是web开发者,它在1999年就开始灭亡了,到2005年左右几乎完全 死了。 作为在那个时期出现的新的web开发者,事情显的很明白而且水到渠成:Perl已经不适应新的应用开发环境了。在Perl里,页面需要冗长的公 式化的CGI方式实现,而这些在PHP里却可以用基本的、缺省的编程方式实现。Perl语言里到处都是旧时代的特征 — 引用,不方便的数据结构,还有其他许多的小的古怪语法语义 —— 这使得web开发冗长,不稳定,不方便。无怪乎没有一个出色的web应用是用Perl写成的,而用PHP你却能做的又快又简单,尽管PHP存在着在当时就 显而易见的缺陷。

在1999年支持Perl反对PHP的争论有很多:Perl要快的多,有更多的程序库和驱动支持,CPAN是个神奇的地方,里面预先写好的代码能让你绝大 部分任务省去80%的工作量。现在看起来这些就有点可笑了,但“PHP缺乏可扩展性”却是个真正的缺点。但总之PHP赢了,因为上面所说的这些问题并不是 这种语言固有的。PHP解释器可以变得更快,程序库可以被开发出来,PERA和PECL目前已经变得相当庞大,这还不包括各种厂商希望人们去使用他们的 API而提供的非正式的程序库。

时间在推移 十年之后,我可以感觉到历史大潮正在重演。开发人员对语言的期望在前进。如果说Perl最缺乏的是PHP里令人惊讶的灵活的“关联数组”(也就是智能哈希 表),那么PHP现在缺乏的就是lambdas和方法链(method chaining)了。同时PHP往往是用在只要20行代码就能写出一个网页的地方,而如今却是如果你不使用什么MVC框架之类的东西就会被认为没有把事 情做对。公式化的代码表明了问题所在:这种语言需要一个框架来替人们做这些事情。

退回到以前,我认为那些顽固的使用Perl来做web开发的人很傻。现在,经历了十年的PHP开发,我处在相同的位置上了。我可以在一个小时里用PHP敲 出一个不错的网站,在一两天里开发出一个优秀的网站。PHP的性能众人皆知,我可以无限的扩展它。我雇佣过的每个开发人员都会它,我集成过的每个系统里都 有一个用它写出的打包的代码库。我深陷于PHP的方便性,尽管它对于我的任务并不是一个合适的语言。

转向Ruby on Rails 最明显有潜在能力继任PHP的是Ruby on Rails。Ruby是一个新的、干净的语言,具有现代的语言特征,松散、优雅的语法(很像Python)。Rails省去了我们常见的任务,省去了集成 web应用里的公式化的做法,把PHP里三、四行的习惯写法变成了first-class语言结构。这看起来极其像我需要的PHP替代品、能让开发工作再 一次提速的东西。

我每天使用Rails,修改一个喜爱这种框架和语言的有经验的Rails专家所写的Rails应用,七个月后,我却不能断言Rails是一个正确的选择了,原因很难表达。我这篇文章的目的就是想试图把原因说清楚。

我的主要的抱怨,必须要提的,就是性能。我之前就说过这种问题不应该被当作一种语言的致命缺陷,它只是语言实现中的暂时的问题。所以我不能把这当作一个真 正的问题,尽管它是我把现在的应用移植到PHP的最主要的一个原因。我可以让Rails跑的跟PHP一样快,但那需要提供2到4倍高的硬件条件。我估计五 年内将还会这样,五年后我也许不必把程序移植到PHP。但现在,它不能满足我的要求。

第二,我讨厌Active Record。Active Record是一种模式,并不是Ruby固有的,在Rails的最新版本里是可选择的,但是对它的使用和这种模式已经深入到了Rails的DNA里了。我 之前曾解释过为什么我认为这数据库上的ORM不是个好做法,所以我不会再重复解释,但有一点我需要总结的就是你省去了手工写CRUD所获得的效能要大于 ActiveRecord做傻事所损失的效能,要花时间搞清楚它是怎么工作的,顺应框架原则,防止它做这样的事情。

第三,我十分的不信任代码自动生成。工具能帮你生成模板式的代码很有用,但你的程序了却多出了成堆的毫无用处的代码来实现这些目的,这就变的不好了。代码 生成喜欢“神奇推理”,因为生成器并不确定代码某些特别有用的特征究竟是专门写出的还是语言环境固有自带的。神奇推理是危险的。

代码生成让我想到了Ruby on Rails的一个可能是最根本的问题,就是它并不是一种语言。Ruby是一种语言。但Ruby,它在解决了PHP上的一些基本问题外,并没有解决核心问 题,那就是现代web应用需要一系列的改进:像routing,model/view分类,drop-in功能性等都是很常见的特征。Rails里有,但 这跟PHP里的Zend,Symfony 和 Code Igniter之类的MVC框架一样只是绑上去的绷带。

那么缺的是什么? 能够取代PHP的语言必须十分优秀于PHP,就如同PHP优秀于Perl一样。它必须承担起web应用的主要实现任务,就像PHP那样,你的代码的主要功 能就是输出网页 —— 一个有点激进的要求,它要不适合去做其它的事情,例如当中shell脚本语言。我希望有这样一种语言,它能够承担起我开发一个MVC式的web应用时的所 有的任务,所有功能都是核心内置的,不能仅是一个程序包。

问题是,没有这样的一种语言。有一段时间服务器端JavaScript看起来将会成为下一个重要的语言,它能统一web应用前端和后端的编程语言。但是这些JavaScript上的伟大思想总是徘徊在一些跑题的行为上,比如nodejs:事件驱动模式非常的激进和强大,能让你开发出高性能的应用程序,最大化的使用新式硬件,但这是一种开发服务器端应用程序的思路,不是web页面。并且你仍然需要去写一大堆可怕的web页面。另外一些CommonJS的成果例如ejScript开始尝试着取代PHP,但仍没有解决框架问题。

仍在等待 我不得不做出结论,PHP的替代者还不存在。Ruby on Rails很好,但并不比一个PHP之上的类似的MVC框架强多少,更别提由于Ruby自身的效率不高和ActiveRecord的ORM恶搞带来的双重 打击。Python看起来并不感兴趣于作为下一代的web语言,JavaScript的服务器端解决方案还刚刚只是个开始。

我等待下一个大目标的出现。我希望能从PHP上转走,真的。我可不想成为Perl式的古董。但不管怎样,这种语言看起来还不存在。我判断错了吗?

[英文出处]:PHP needs to die. What will replace it?

cnbeta来源:http://www.cnbeta.com/articles/124058.htm

Installing PHP 5.3, Nginx And PHP-fpm On Ubuntu/Debian

Since Apache is most of the time a memory hungy process, people started to look for different ways to host their website. Apache is clearly not the only webserver available. A few good examples are lighttpd and nginx. In this tutorial I will show you how to install it on your Ubuntu server. This tutorial also applies to Debian, though. There is only a very small difference.

Ready? Let's begin shall we.

Step 0 - Preliminary Notes

In order to complete this tutorial, I assume you have installed a base system of Debian or Ubuntu. How this can be done, can be read in different tutorials. This tutorial only focusses on getting nginx+php running without much hassle.

Step 1 - Nginx

Installing nginx is the first step we have to do. This can be easily done by downloading it from the repository.

XML/HTML代码
  1. sudo apt-get install nginx  

The default vhost has to be changed in order to work properly.

XML/HTML代码
  1. sudo vim /etc/nginx/sites-available/default  

A nice starting point for your config is:

XML/HTML代码
  1. server {  
  2.     listen   80;  
  3.     server_name  localhost;  
  4.     access_log  /var/log/nginx/localhost.access.log;  
  5.   
  6. ## Default location  
  7.     location / {  
  8.         root   /var/www;  
  9.         index  index.php;  
  10.     }  
  11.   
  12. ## Images and static content is treated different  
  13.     location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {  
  14.       access_log        off;  
  15.       expires           30d;  
  16.       root /var/www;  
  17.     }  
  18.   
  19. ## Parse all .php file in the /var/www directory  
  20.     location ~ .php$ {  
  21.         fastcgi_split_path_info ^(.+\.php)(.*)$;  
  22.         fastcgi_pass   backend;  
  23.         fastcgi_index  index.php;  
  24.         fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;  
  25.         include fastcgi_params;  
  26.         fastcgi_param  QUERY_STRING     $query_string;  
  27.         fastcgi_param  REQUEST_METHOD   $request_method;  
  28.         fastcgi_param  CONTENT_TYPE     $content_type;  
  29.         fastcgi_param  CONTENT_LENGTH   $content_length;  
  30.         fastcgi_intercept_errors        on;  
  31.         fastcgi_ignore_client_abort     off;  
  32.         fastcgi_connect_timeout 60;  
  33.         fastcgi_send_timeout 180;  
  34.         fastcgi_read_timeout 180;  
  35.         fastcgi_buffer_size 128k;  
  36.         fastcgi_buffers 4 256k;  
  37.         fastcgi_busy_buffers_size 256k;  
  38.         fastcgi_temp_file_write_size 256k;  
  39.     }  
  40.   
  41. ## Disable viewing .htaccess & .htpassword  
  42.     location ~ /\.ht {  
  43.         deny  all;  
  44.     }  
  45. }  
  46. upstream backend {  
  47.         server 127.0.0.1:9000;  
  48. }  
k, we're done here. Now we'll install the needed files for PHP.

 

Step 2 - Installing PHP

Many sites rely on PHP for providing them dynamic content, whether this is a wiki, forum software, weblog or something entirely different.

If you are running Ubuntu, we first have to resolve two dependencies required for the dotdeb packages. If you are running the amd64 version, you should replace i386 with amd64.

For Debian you won't have to do this!

XML/HTML代码
  1. cd /tmp  
  2.   
  3. wget http://us.archive.ubuntu.com/ubuntu/pool/main/k/krb5/libkrb53_1.6.dfsg.4~beta1-5ubuntu2_i386.deb  
  4.   
  5. wget http://us.archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu38_3.8-6ubuntu0.2_i386.deb  
  6.   
  7. sudo dpkg -i *.deb  

Again, this is only required if you're on Ubuntu.

The rest of the tutorial applies to both Ubuntu & Debian.

 

 

 

 

We'll have to add the dotdeb repository to the APT sources, so we can use their packaged PHP 5.3 and php-fpm:

XML/HTML代码
  1. sudo echo "deb http://php53.dotdeb.org stable all" >> /etc/apt/sources.list  

Update apt:

XML/HTML代码
  1. sudo apt-get update  

The resulting text should include dotdeb.

Now we'll install PHP (part 1):

XML/HTML代码
  1. sudo apt-get install php5-cli php5-common php5-suhosin  

We have to install the cli before the rest, because this will cause problems later on.

XML/HTML代码
  1. sudo apt-get install php5-fpm php5-cgi  

If you are planning to use a database or require specific modules (mcrypt, ldap, snmp etc) you can install them as well.

Ok, so now we have nginx and PHP.

One minor remark: If you are using "php short tags" (<?) you should enable them in your php.ini files (for both fpm and cli). If you do not change this, you will see your code in plain text!

Step 3 - Finalizing

Restart nginx in order to catch up with the config changes we made earlier.

XML/HTML代码
  1. sudo /etc/init.d/nginx restart  

The restart should have gone without any problems.

After installing php5-fpm, it should have been started. If you did change your php.ini files, you have to restart php5-fpm.

XML/HTML代码
  1. sudo /etc/init.d/php5-fpm restart  

All right. They should now both be running.

Step 4 - Testing

In order to test if the execution of PHP is working, create an index.php file in /var/www with the following content:

PHP代码
  1. <?php phpinfo(); ?>  

 

 

 

 

Visit your webserver and you should be able to see the generated phpinfo. If not, something went wrong.

Step 5 - Troubleshooting & Final notes

If  you did not see the phpinfo, there might be something wrong. In order to track down what went wrong, you can check the nginx error log:

XML/HTML代码
  1. sudo tail /var/log/nginx/error.log  

Remember, if you did change your php.ini you have to restart php5-fpm. Restarting nginx isn't' necessary.

In my example config I've enabled the fastcgi error interception. If a serious error occurs (for instance a "cannot redeclare class xyz"), nginx can catch this page and show a "nice" error page that something went wrong. This way, there is less information given out in case something is going seriously wrong.

If you do not like this, you can turn it off.

If php5-fpm is not running, your PHP files cannot be parsed and nginx will show the user an error page.

Well, I guess we're done and you are now able to serve PHP with your new nginx based webserver. Nginx is pretty nice and you can configure a lot. If you need rewrites, be aware that nginx does not work with .htaccess files. You will need to change your vhost settings in order for the rewrites to work.

原文地址为:http://www.howtoforge.com/installing-php-5.3-nginx-and-php-fpm-on-ubuntu-debian

事实上,如果你真的按照本文所说的去安装,好象是不能成功的。好象默认nginx不在ubuntu的包里。

原文中还有三篇相关文章,如果有兴趣,可以看一下:

有些东西还是可以看看的,但如果是纯操作没有讲解,其实意义不大,终究只是知其然不知其所以然

 

 

 

为NeatPIC目录直读版建群

虽然neatpic的功能不强大,我的时间也不是特别多。
但我还是准备为它建立一个QQ群,接受需求和发布版本。

目前我本地的版本还没有发布,基本上也就是实现了我在博客里说的一些新功能。
准备发布两种版本,一种是尽量用上PHP5的特性的。一种是面向过程的。(其实所谓用上php5特性的也差不多面向过程)

当然还是采用模版和楥存,也会生成缩略图,方便展示。
同时代码仍然采用开源方式发布,也没有什么授权不授权的。
不管你是商用也好非商用也好,都无所谓了。保留一个版权,留下本站一个链接就行,其他无所谓

QQ群号:4278705,加入时需要暗号:neatstudio
防止茶农进驻。。

Tags: neatpic, qq群