Eclipse can not add tomcat 6 server

July 4th, 2009

While working with the system installed tomcat6, we have to change files in /usr/share/tomcat6/conf to global read/write.

  • Share/Bookmark

Eclipse can not start after installed WTP

July 4th, 2009

It is because open file limit is not enough. After change open file limit to 10000, it works fine.

  • Share/Bookmark

How to change file limit in Fedora Linux

July 4th, 2009

Add a file in /etc/security/limits.d/, say nofile.conf

*    soft    nofile    1024
*    hard    nofile    65535

Edit /etc/pam.d/login, adding the line:

session required pam_limits.so

we can change the open limit by:

unlimt -n 10000
  • Share/Bookmark

ulimit command

July 4th, 2009

show current file limit:

ulimit -n

show all limit:

ulimit -a

show all hard limit:

ulimit -aH
  • Share/Bookmark

15 days to Fedora 11, still buggy

May 12th, 2009

There are only 15 days left for Fedora 11 hitting the road. However, there is still a major bug for me have not fixed: both svnkit and javahl not working, this renders eclipse without svn support.

  • Share/Bookmark

Fedora 11 in 16 days

May 10th, 2009

After today update of my rawhide, now it shows fc11.

[jeffye@linux ~]$ uname -a
Linux linux.home 2.6.29.2-126.fc11.x86_64 #1 SMP Mon May 4 04:46:15 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
  • Share/Bookmark

Zend Framework 1.8 alpha

April 11th, 2009

Zend Framework now approching version 1.8. Yesterday, it put the 1.8 alpha available for download. Also, the reference guide document has been updated including the feature of version 1.8.

It added 4 new components: Zend_Application, Zend_CodeGenerator, Zend_Tool_Framework, Zend_Tool_Project. Also, It supports more service like Zend_Service_Twitter and may be more.(I am not sure, because I have not checked what services included in previous versions).

Zend_CodeGenerator, Zend_Tool_Framework, Zend_Tool_Project looks like make up a tool chain to support Zend_Tool_Project, which looks like a command line tool can create the Zend Frame project sketch. In 1.8 alpha, it is hardly functional. What I can find out is just a zf.sh included in the bin folder, which you run

zf.sh create project ~/workspace/test

will create a default site struct in the given folder. However, the code generated has syntax error. (doule <?php), also, I can not figure out how to create projects using modules.

Most interesting part is the Zend_Application. It abstracts and wrap the common bootstrap procedures, so you don’t have to code the almost the same bootstrap file for each project.

I am doing a test project using Zend_Application bootstraping. Check out at:
http://code.google.com/p/yaz/source/browse/#svn/trunk

  • Share/Bookmark

PHP object assign alway by reference

April 4th, 2009

Different from what we discuss before about regular variable type, object assignment always by reference:

class A {
        public $a = 'a';
}

$a = new A();
$b = clone $a;
$c = $a;
$b->a = 'b';
echo $a->a, "\n";
$c->a = 'c';
echo $a->a, "\n";

Output:

a
c

We use clone to make a copy of object. Please note that default clone operation is shallow copy. You have to overload the __clone method if you want deep copy of the object.

  • Share/Bookmark

PHP return by reference

April 4th, 2009

We can ask a function return by reference by adding a & before function declare. See example:

function & pass(& $a) {
        return $a;
}

function duplicate(& $a) {
        return $a;
}

$a = array('a'=>'a');
$b = duplicate($a);
$c = & pass($a);
$b['a'] = 'b';
echo $a['a'], "\n";
$c['a'] = 'c';
echo $a['a'], "\n";

output is:

a
c

You will see, the trick here is: don’t forget to put an ‘&’ before the function of assign operation. Otherwise, the assign operation will make a copy of the returned reference.

  • Share/Bookmark

PHP assign by reference

April 4th, 2009

See codes below:

$a = array('a'=>'a');
$b = $a; // $b is a copy of $a
$c = & $a; // $c is a reference of $a
$b['a'] = 'b'; // $a not changed
echo $a['a'], "\n";
$c['a'] = 'c'; // $a changed
echo $a['a'], "\n";

The output is:

a
c

Also, we know that when we use [] to get a data from an array, this return the reference to the internal data. So it we pass in a reference of data to array, and then we get the data from the array. This operation will change the original data.

See below:

$a = array('a'=>'a');
$b = array();
$b[] = $a;
$b[] = & $a;
$b[0]['a'] = 'b';
echo $a['a'],"\n";
$b[1]['a'] = 'c';
echo $a['a'], "\n";

output is:

a
c
  • Share/Bookmark