Tuesday, October 20, 2009

Tips for solving "Too many open files" issue

When I tried to start Eclipse today, my Eclipse just popup an error which points to an log doesn't exists. I kept getting this error when I tried to restart it again.

So I executed it from command line console, and I got this error said:
java.util.zip.ZipException: error in openning zip file

So I removed some of jar files in features & plugins directory, and then the error change to:
and there's a line in frone of error said:
ZoneInfo: /usr/lib/jvm/java-6-sun-1.6.0.07/jre/lib/zi/ZoneInfoMappings (Too many open files)

I use the lsof to check the open file count of eclipse and found it's only 2107, so I use:
ulimit -n 4096 
to change the limitation to 4096, but it still doesn't work.

So I google a little and found someone said that actually eclipse will open files more than 10000, which are all in temporary directory. So I change the ulimit to 65535, and the probem solve.

To make the change permanently:
vi /etc/security/limits.conf

or 
echo 65535> /proc/sys/fs/file-max
echo 65535 > /proc/sys/fs/inode-max

use other number in your case.


Saturday, October 10, 2009

when i saw Micello

I know that digital earth will finally come true.

we just need more people create these kind of fun application.

check micello from video on their website:

I promise this is not an ad.

Saturday, September 26, 2009

那个年代

你一定随着春天温暖的风,又踏着严寒冬天的雪,你经过春风的吹送和踏雪的足迹,已经深入到祖国的高山、平原,也飘进了黄河、长江,经过黄河、长江的运移,你进入了无边无际的海洋

Wednesday, July 1, 2009

Template Toolkit + CGI::Ajax Sample

I would like to say at the beginning that this would be the first and most detail sample for people who wants to use TT and CGI::Ajax together. Because I googled for a long time and cannot find any workable example. So I know the pain and hope this can help someone who has the same pain as me.

This example will not solve every problem of TT and CGI::Ajax integration, only one aspect of it, the basic one, and it's not the best one I think.

Okay, let's directly go to a workable code, the default CGI:
#!/usr/bin/perl

use strict;
use warnings;

use lib qw/ . /;
use vars qw/ $vars /

use Mypackage::User;

use Mypackage::CGI;
use CGI::Ajax;

my $cgi = Mypackage::CGI->cgi; # here we wrap the template into my own CGI so that they can use together easily
my $template = Mypackage::CGI->template;

print $cgi->header;

$vars->{title} = "test ajax";
$template->process( "header.html.tmpl", $vars ) or throw( $template->error ); # just process a html template file
my $ajax = CGI::Ajax->new( 'get_reservation' => 'ajax.cgi');
$ajax->JSDEBUG(1);
$ajax->DEBUG(1);

print $ajax->build_html( $cgi ); # inject CGI::Ajax

$template->process( "b.html.tmpl", $vars ) or throw( $template->error ); # do anything else
$template->process( "footer.html.tmpl", $vars ) or throw( $template->error );


exit 0;
__END__


Here we request the external cgi to deal with the request:

#!/usr/bin/perl

use strict;
use warnings;

use lib qw/ . /;
use vars qw/ $vars /;

use Mypackage::User;


use Mypackage::CGI;
use CGI::Ajax;

my $cgi = Mypackage::CGI->cgi;
my $template = Mypackage::CGI->template;

print $cgi->header;
my @args = $cgi->param( 'args' );
my $team = $args[0]; # you can get more than one parameter from here
print &get_users_func($team);

sub get_users_func
{
my ( $team ) = @_;
my $users = new Mypackage::User();
my $teamusers = $users->get( $team);
$vars->{users} = $teamusers;# vars is the VARIABLES of TT, you can see we use the same way that passing variables in an ajax context
$template->process( "c.html.tmpl", $vars ) or throw( $template->error ); // c.html.tmpl shows a list a user in this team
return $vars->{content}; # we simply return the content of processed template, you can have other way to return the content, but this will be the simplest way I think
}

exit 0;

Here's the codes you need to add into your default html file (b.html.tmpl):
<input type="text" id="team" value="[% team %]">
<div id="users"></div>
<p><input type="button" name="submit" value="show all users" onclick="get_users(['team'],['users'])"/></p>

Thursday, May 14, 2009

Tips for installing Netmeeting on Vista

http://joshuamaher.com/2007/02/21/netmeeting-on-vista/
Thanks Josh.


Why the heck would anyone want to use Netmeeting on Vista? The Windows Meeting Space is built in and is far superior and has a feature set that is much more useful…but if your corporate masters are WAY behind the times (despite the millions of Microsoft investments)…..here’s how to get it working…

Thanks to BlackDiamond’s post at TechRepublic, here is how to do it:

  1. Download NM30.EXE from Microsoft.com
  2. Save the executable to your computer somewhere
  3. Right click on the file and select “Properties”.
  4. Click the “Compatibility” tab.
  5. Put a check in “Run This Program In Compatibility Mode For:”.
  6. Select Windows NT 4.0 (Service Pack 5).
  7. Click “OK”.
  8. Double click the shortcut and install normally.Yeah….NetMeeting now works in Vista.

When you run NetMeeting you will be able to enter all the information as normal and will have to unblock netmeeting in the firewall.

The only thing that does not appear to be working is the Remote Desktop Sharing option, if anyone knows how to make it work, let us know!


Sunday, May 10, 2009

fedora installation options - can be used in most redhat based li

Fedora Installation Options


Boot time command args:
-----------------------

expert Turns on special features:
- allows partitioning of removable media
- prompts for driver disk

noshell Do not put a shell on tty2 during install.

lowres Force GUI installer to run at 640x480.

resolution=<mode> Run installer in mode specified, '1024x768' for example.

nousb Do not load USB support (helps if install hangs
early sometimes).

nofb Do not load the VGA16 framebuffer required for doing
text-mode installation in some languages

nofirewire Do not load support for firewire devices

askmethod Do not automatically use the CD-ROM as the install
source if we detect a Red Hat Linux CD in your CD-ROM drive.

nousbstorage Do not load usbstorage module in loader. May help with
device ordering on SCSI systems.

noparport Do not attempt to load support for parallel ports

noprobe Do not attempt to detect hw, prompts user instead.

nopcmcia Ignore PCMCIA controller in system.

skipddc Skips DDC probe of monitor, may help if its handing system.

graphical Force graphical install. Required to have ftp/http use GUI.

text Force text mode install.

vnc Enable vnc-based installation. You will need to connect
to the machine using a vnc client application.

vncpassword=<password> Enable a password for the vnc connection. This will
prevent someone from inadvertantly connecting to the
vnc-based installation.

Requires 'vnc' option to be specified as well.

vncconnect=<host>[:<port>] Once installation is up and running, connect to
the vnc client named <host>, and optionally use port <port>.

Requires 'vnc' option to be specified as well.

updates Prompt for floppy containing updates (bug fixes).

isa Prompt user for ISA devices configuration.

dd Use a driver disk.

driverdisk Same as 'dd'.

mediacheck Activates loader code to give user option of testing integrity
of install source (if an ISO-based method).

rescue Run rescue environment.

nomount Don't automatically mount any installed Linux partitions
in rescue mode.

nopass Don't pass keyboard/mouse info to stage 2 installer, good for
testing keyboard and mouse config screens in stage2 installer
during network installs.


serial Turns on serial console support.

ksdevice Takes an argument like 'eth0', tells install what network
device to use for kickstart from network.

ks Kickstart over NFS.

ks=cdrom: Kickstart from CDROM

ks=nfs:<path> Kickstart from NFS.

ks=<url> Kickstart via HTTP.

ks=hd:<dev> Kickstart via harddrive (dev = 'hda1', for example)

ks=file:<path> Kickstart from a file (path = 'fd0/ks.cfg')

ks=ftp://<path> Kickstart from FTP.

ks=http://<path> Kickstart from HTTP.

kssendmac Adds HTTP headers to ks=http:// request that can be helpful
for provisioning systems. Includes MAC address of all nics in
a CGI environment variable of the form
HTTP_X_RHN_PROVISIONING_0, HTTP_X_RHN_PROVISIONING_1, etc, for
all nics.

dhcpclass=<class> Sends a custom DHCP vendor class identifier. ISC's dhcpcd can
inspect this value using "option vendor-class-identifier".

upgradeany Don't require an /etc/redhat-release that matches the
expected syntax to upgrade.

lang=<lang> Language to use for the installation. This should be a
language which is valid to be used with the 'lang' kickstart
command.

keymap=<keymap> Keyboard layout to use. Valid values are those which can be
used for the 'keyboard' kickstart command.

ip=<ip> IP to use for a network installation, use 'dhcp' for DHCP.

netmask=<nm> Netmask to use for a network installation.

gateway=<gw> Gateway to use for a network installation.

dns=<dns> Comma separated list of nameservers to use for a network
installation.

method=nfs:<path> Use <path> for an NFS installation.

method=http://<path> Use <path> for an HTTP installation

method=ftp://<path> Use <path> for an FTP installation

method=hd://<dev>/<path> Use <path> on <dev> for a hard drive installation

method=cdrom Do a CDROM based installation.

vnc Do graphical installation via VNC. Instead of
starting a normal X server, vncserver will be started
and you can then connect remotely to do the
installation.

vncpassword=<password> Set a password for the vnc session.

vncconnect=<host>[:<port>] Once installation is up and running, connect to
the vnc client named <host>, and optionally, on port <port>.
Requires 'vnc' option to be specified as well.

Something else:
test
debug Start up pdb immediately
nofallback If GUI fails exit
rootpath= Where to install packages (default /mnt/sysimage)
pcic= Specify pcmcia controller
overhead= Override LVM overhead calculation
testpath=
mountfs
traceonly Don't run, just list modules we use
kickstart= Set serial install and kickstart file
kbdtype= Set the type of keyboard
module= Load additional kernel modules
class= Choose install class to use
autostep Make kickstart non-interactive
noselinux Disable Security Enhanced Linux
selinux Enable Security Enhanced Linux
vnc=
cmdline Use command line installer
headless Automate install for machines with no display
virtpconsole=
xfs Allows the creation of a xfs filesystem
reiserfs Allows the creation of a reiserfs filesystem
jfs Allows the creation of a jfs filesystem
syslogd

Friday, May 8, 2009

GWTAE first try

I just try the Google AppEngine with GWT. The eclipse plugin is pretty cool and simple to use.

But it's not perfect in:
  1. i want to use servlet context listener, but it doesn't support --> use filter to do it instead
  2. i want to share my data with other applications but seems it's hard to do that, except I use external database service like Amazon S3
  3. i want to add some big file but it has a memory restriction for big files < 1M ....

or i need more tries