RECORDING MY FANTASY

Thursday, May 20, 2010

奇妙的面试经历 from 水母

99年大学毕业,找工作,找了一圈,没结果
年后,去济南招聘会,我乱投简历了,老夫
顺时钟的转,到门口时简历没了。
刚好看到中创的摊了,走上去:
我:
我没简历了,给你看看原件吧(推荐表)
hr_A:
这是你的么?
我:
靠,给你看我的学生证,身份证
hr_A:
我看看。。。恩。好,下周三你来面试吧。

下周三:
面试菅(女),群殴,共4人(省著名大学本1(A)
另一所大学 本1(B),硕1(C)),老夫算D
开始问:
你们都做过什么?
那三个都blabla..写过几万行代码。什么汇编,c
都写过。
问我:
没写过大的,也就一两百行。倒是经常写着玩
数值代数和分析上的计算题都是写程序算的,
没计算器。
对老夫没兴趣了。
。。。。。
然后问到:
你们打牌不?(山东流行打勾级)
那三个家伙
A:不打,
B:不打
还是硕士聪明C:偶尔打打,休息一下
我当时心想。你们他妈的,山东的大学有不打牌的?

D:打!经常打

hr_b:
那你谈谈你打牌的感受吧。
D:打勾级不全在牌好坏,配合很重要,配合好了能赢

然后hr_b兴奋了:
对,我们写软件就是要讲究合作,讲究配合。

走出门,1分钟接到hr_b电话
这周或下周你可以来签三方了。

bash: read file into array (from experts-exchange.com)

#!/bin/sh   exec< $1 echo "data in $1 will be processed now." input=[] i = 0 while read line do         input[$i] = $line;         i = $i + 1; done   echo {$input[*]} 

Sunday, May 16, 2010

Install JSON for PHP5.x (less than 5.2)

Scott Hebert wrote on its blog, http://slaptijack.com/system-administration/lets-install-json-for-php-5/

I recently started messing around with building my own Facebook application. I figured the best way to start learning was to download the demo application and get it working on the Slaptijack web server. I quickly ran into a problem:

PHP Fatal error:  Call to undefined function json_encode()

The problem is that PHP 5.2 includes the json_encode() and json_decode()functions built right in. Unfortunately, I'm running on PHP 5.0 which doesn't include native JSON support. Here's how I resolved that.

  1. Install json – This was actually trickier than expected. I assumed I would be able to install this via pear. Apparently, a PEAR Services_JSON package was developed, but it has never been accepted into the official repository. The trick instead is to use thePECL json package. This was as easy as running pecl install json and watching the compiler do its thing. When it's done you should have a json.so file in your PHP modules directory. (Mine is/usr/lib/php/modules/.)
  2. Add json.ini file to /etc/php.d/ – This file is pretty simple. Simply add extension=json.so to this file and that will enable the extension.
  3. Restart Apache – Not much more to add here. Without the restart, the extension won't be loaded.
  4. Profit!

That's all it took. Now my PHP 5 installation is kicking along happily with the required JSON functions.

That's very useful to install json_encode on RHELS5.x, they are using the PHP which version is less than 5.2.


Fedora 12 + Httpd + Userdir + SElinux Works (From Albertux~# ./Blog)

Fedora 12 + Httpd + Userdir + SElinux Works

First install LAMP stack see the guide on HowtoForge

replace $USER for your username

 mkdir $USER/public_html firefox http://localhost/~$USER/

If you see only Forbidden (403), don't worry, do this:

I made a patch file (if you made custom changes on httpd.conf don't use this file, do manual changes)

Install patch on your system and patch httpd.conf

 yum install patch

my patch file:

 --- httpd-patch.conf	2010-01-30 14:59:51.811850034 -0800 +++ httpd.conf	2010-01-30 14:25:04.527864263 -0800 @@ -349,14 +349,15 @@      # of a username on the system (depending on home directory      # permissions).      # -    UserDir disabled +    #UserDir disabled +    UserDir enabled $USER        #      # To enable requests to /~user/ to serve the user's public_html      # directory, remove the "UserDir disabled" line above, and uncomment      # the following line instead:      #  -    #UserDir public_html +    UserDir public_html    </IfModule>   @@ -364,18 +365,18 @@  # Control access to UserDir directories.  The following is an example  # for a site where these directories are restricted to read-only.  # -#<Directory /home/*/public_html> -#    AllowOverride FileInfo AuthConfig Limit -#    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec -#    <Limit GET POST OPTIONS> -#        Order allow,deny -#        Allow from all -#    </Limit> -#    <LimitExcept GET POST OPTIONS> -#        Order deny,allow -#        Deny from all -#    </LimitExcept> -#</Directory> +<Directory /home/*/public_html> +    AllowOverride FileInfo AuthConfig Limit +    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec +    <Limit GET POST OPTIONS> +        Order allow,deny +        Allow from all +    </Limit> +    <LimitExcept GET POST OPTIONS> +        Order deny,allow +        Deny from all +    </LimitExcept> +</Directory>    #  # DirectoryIndex: sets the file that Apache will serve if a directory

next do:

 patch /etc/httpd/httpd.conf < patch1.txt chmod 711 /home/$USER chmod 755 /home/$USER/public_html chcon -R -t httpd_sys_content_t /home/$USER/public_html setsebool -P httpd_enable_homedirs 1

now:

 firefox http://localhost/~$USER/

Done.