Is pretty sweet:
http://www.mojavelinux.com/projects/domtooltip/
Programming solutions, source code, solutions to tech problems and other tech related stuff.
Thursday, August 31, 2006
Thursday, August 17, 2006
Hiding all Checkboxes on a HTML Page with Javascript
Iterating through all the checkbox elements on a page using the javascript getElementsByTagName() command.
var inputs = window.document.getElementsByTagName('input');
for(var i=0; i < inputs.length; i++){ //iterate through all input elements
if (inputs[i].type.toLowerCase() == 'checkbox') { //if the element is a checkbox
inputs[i].style.display = "none";
}
}
var inputs = window.document.getElementsByTagName('input');
for(var i=0; i < inputs.length; i++){ //iterate through all input elements
if (inputs[i].type.toLowerCase() == 'checkbox') { //if the element is a checkbox
inputs[i].style.display = "none";
}
}
Wednesday, August 16, 2006
Methods in JSP
It isn't really all that tricky but nice to know anyway:
Just use the exclamation mark to declare the method. Note that request and response objects are not available. However, that doesn't stop you from hacking around it and passing the request or response as a parameter to the method:
<%!
public String myMethod(HttpServletRequest req){
//do something really cool with the req
return "Boo!";
}
%>
Just use the exclamation mark to declare the method. Note that request and response objects are not available. However, that doesn't stop you from hacking around it and passing the request or response as a parameter to the method:
<%!
public String myMethod(HttpServletRequest req){
//do something really cool with the req
return "Boo!";
}
%>
Monday, August 14, 2006
Two Tomcats, One Apache.
Running two tomcat installations one different ports via one apache server and mod_jk.
In apache's httpd.conf
------------------------
<IfModule !mod_jk.c>
LoadModule jk_module "c:/Progra~1/Apache~1/Apache2/modules/mod_jk.so"
</IfModule>
JkWorkersFile "C:/tomcat/conf/workers.properties"
JkLogFile "C:/tomcat/logs/mod_jk_new.log"
JkLogLevel info
JkMount /* ajp13
JkMount /*.jsp ajp13
JkMount /Tomcat2 tomcat2
JkMount /Tomcat2/* tomcat2
JkMount /Tomcat2/*.jsp tomcat2
In server.xml for the second tomcat instance
--------------------------------------------
- Change the SHUTDOWN port to another port that doesnt conflict with the first instance.
- Change the AJP 1.3 Connector port to another that doesnt conflict with the first.
- Set the connector port to something other than 8080, which you want to run your second tomcat from.
In C:/tomcat/conf/workers.properties
------------------------------------
workers.tomcat_home=C:/tomcat
workers.java_home=C:/jdk1.5.0_02
ps=worker.list=ajp13, tomcat2
#first tomcat
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
#second tomcat
worker.tomcat2.port=8007
worker.tomcat2.host=localhost
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp13
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)server$(ps)lib$(ps)catalina.jar
worker.inprocess.cmd_line=start
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)server$(ps)jvm.dll
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
In apache's httpd.conf
------------------------
<IfModule !mod_jk.c>
LoadModule jk_module "c:/Progra~1/Apache~1/Apache2/modules/mod_jk.so"
</IfModule>
JkWorkersFile "C:/tomcat/conf/workers.properties"
JkLogFile "C:/tomcat/logs/mod_jk_new.log"
JkLogLevel info
JkMount /* ajp13
JkMount /*.jsp ajp13
JkMount /Tomcat2 tomcat2
JkMount /Tomcat2/* tomcat2
JkMount /Tomcat2/*.jsp tomcat2
In server.xml for the second tomcat instance
--------------------------------------------
- Change the SHUTDOWN port to another port that doesnt conflict with the first instance.
- Change the AJP 1.3 Connector port to another that doesnt conflict with the first.
- Set the connector port to something other than 8080, which you want to run your second tomcat from.
In C:/tomcat/conf/workers.properties
------------------------------------
workers.tomcat_home=C:/tomcat
workers.java_home=C:/jdk1.5.0_02
ps=worker.list=ajp13, tomcat2
#first tomcat
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
#second tomcat
worker.tomcat2.port=8007
worker.tomcat2.host=localhost
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp13
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)server$(ps)lib$(ps)catalina.jar
worker.inprocess.cmd_line=start
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)server$(ps)jvm.dll
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
Thursday, August 10, 2006
Changing or renaming the ROOT folder in Tomcat
1.
Look for this...
<Context path="" docBase="ROOT" />
and change it to
<Context path="" docBase="NEW_FOLDER_NAME" >
If it is not there as default. Then it needs to be added inside the <host> tag. (which is inside the <engine> tag)
2. Stop tomcat
3. Delete the files in
work\Catalina\localhost
4. Start tomcat
Look for this...
<Context path="" docBase="ROOT" />
and change it to
<Context path="" docBase="NEW_FOLDER_NAME" >
If it is not there as default. Then it needs to be added inside the <host> tag. (which is inside the <engine> tag)
2. Stop tomcat
3. Delete the files in
work\Catalina\localhost
4. Start tomcat
Monday, August 07, 2006
Virtual hosts in Apache
Getting apache to host two different domains on the same server, but redirecting them to different sites.
In httpd.conf... APACHE_HOME/conf/httpd.conf
Uncomment:
LoadModule vhost_alias_module modules/mod_vhost_alias.so
Then add this to the vhosts section.
NameVirtualHost *
<virtualhost>
DocumentRoot "C:/website1"
ServerName mywebsite1.com
ErrorLog "C:/website1/error.log"
</virtualhost>
<virtualhost>
DocumentRoot "C:/website2"
ServerName mywebsite2.com
ErrorLog "C:/website2/error.log"
</virtualhost>
and for redirecting...
<virtualhost>
DocumentRoot "C:/website3"
ServerName someothersite.mywebsite1.com
ErrorLog "C:/website3/error.log"
Redirect permanent / http://othersite.com:8080
</virtualhost>
In httpd.conf... APACHE_HOME/conf/httpd.conf
Uncomment:
LoadModule vhost_alias_module modules/mod_vhost_alias.so
Then add this to the vhosts section.
NameVirtualHost *
<virtualhost>
DocumentRoot "C:/website1"
ServerName mywebsite1.com
ErrorLog "C:/website1/error.log"
</virtualhost>
<virtualhost>
DocumentRoot "C:/website2"
ServerName mywebsite2.com
ErrorLog "C:/website2/error.log"
</virtualhost>
and for redirecting...
<virtualhost>
DocumentRoot "C:/website3"
ServerName someothersite.mywebsite1.com
ErrorLog "C:/website3/error.log"
Redirect permanent / http://othersite.com:8080
</virtualhost>
Mark's Tech Stuff Blog
Welcome to my newest blog.
Here I shall post any tricky technical issues that I come across and manage to solve somehow.
I really hope it can help people who are in the dilemma of banging their head against the wall. Cheers!
Here I shall post any tricky technical issues that I come across and manage to solve somehow.
I really hope it can help people who are in the dilemma of banging their head against the wall. Cheers!
Subscribe to:
Posts (Atom)