ManagementFactory.getRuntimeMXBean().getName()
not yet verified.
ManagementFactory.getRuntimeMXBean().getName()
not yet verified.
How to avoid iptimeout issue when connecting from ur Desktop to a remote machine
In tangosol-coherence-override.xml – under <cluster-config> element add
<tcp-ring-listener>
<ip-timeout>0</ip-timeout>
</tcp-ring-listener>
this disables IP monitor timeout
Add following two lines to /etc/sysconfig/iptables
-A INPUT -m limit –limit 15/minute -j LOG –log-level 7 –log-prefix “Dropped by firewall: “
-A OUTPUT -m limit –limit 15/minute -j LOG –log-level 7 –log-prefix “Dropped by firewall: “
Restart iptables
In /etc/syslog.conf, add
kern.=debug /var/log/firewall
Restart syslogger – /sbin/service syslog restart
[root@lglor060 init.d]# netstat -aovpn | grep 8091
tcp 0 0 172.23.73.60:8091 0.0.0.0:* LISTEN 2149/java off (0.00/0/0)
tcp 0 0 172.23.73.60:8091 172.23.73.60:38490 ESTABLISHED 2149/java off (0.00/0/0)
[root@lglor060 init.d]# ps -ef | grep 2149
To download sources, use – mvn dependency:sources
mvn eclipse:eclipse -DdownloadSources=true
To use maven jetty plugin, add below plugin to your pom,
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
</plugin>
use command mvn org.mortbay.jetty:jetty-maven-plugin:run to start jetty.
To use the truncated command mvn jetty:run, add below lines to your settings file,
<pluginGroups>
<pluginGroup>org.mortbay.jetty</pluginGroup>
</pluginGroups>
To create an Eclipse Web project using maven use - mvn eclipse:eclipse -Dwtpversion=1.5
How to delete entries,
You can delete them based on what they’re doing :
iptables -D INPUT -s 127.0.0.1 -p tcp --dport 111 -j ACCEPT
Or you can delete them based on their number and chain name :
iptables -D PORTSEN 4
This can be a handy tip if you are debugging some java application which cannot be run in single step debug for some reason. Suppose you have a method which is called from many places and you need to know the current caller.
Just capture the current stack trace by making a Throwable object. Now get the 2nd stack trace element from t.getStackTrace() which will have the caller details.
A small example..
public class test {
public static void main(String[] args) {
caller1();
caller2();
}
private static void caller1() {
method();
}
private static void caller2() {
method();
}
private static void method() {
Throwable t = new Throwable();
StackTraceElement ste = t.getStackTrace()[1];
System.out.println(ste.getMethodName() + " called me.");
System.out.println("File Name :"+ste.getFileName());
System.out.println("Line Number :"+ste.getLineNumber());
}
}
Requirement :- I have an HTML form in my current page. When I submit this form, the result should open in new window.
function openNewWin(formName) {
features=”toolbar=no,location=0,directories=no,status=yes,menubar=yes,scrollbars=yes,copyhistory =1,resizable=1,width=980,height=390,left=0,top=100″;
popupWindow = window.open(”, ‘NewWindow’, features);
thisForm = “document.” + formName;
eval(thisForm).target = ‘NewWindow’;
window.setTimeout( thisform + “.submit()”, 0 );
}
cleartool lsco -cview -avobs -short | xargs cleartool ci
#!/usr/bin/perl
sub count_words_in_line {
# use our to declare global variable.
our %word_count;
# below two lines can be combined into one like this - @words = split " ", shift
$line = shift @_;
@words = split " ", $line;
foreach my $word (@words) {
$word_count{$word}++;
}
}
sub count_words_in_file {
my $file = shift;
print $file . "\n";
open (FILE, $file) || die "$0: @_: $!";
while (my $line = ) {
count_words_in_line $line;
}
}
#print @ARGV[0] . "\n";
$file_name = shift;
count_words_in_file $file_name;
print %word_count;