 |
 |
Index ‹ java-programmer
|
- Previous
- 4
- struts: Multipage formHi,
I'm collection data across several pages using one Form per page. The scope of
each form is set to session. Let's say I have form1, form2 and form3 and the
corresponding action classes. In the jsp corresponding to form3 I can access
form1 using form1 as bean name.
But how can I access form1 from the Action class corresponding to form3?
Hope that was not to confusing.
Thanks in advance,
phi
- 4
- 5
- Stateless Session Beans and a Stateful Singleton? (Sharing dataI am interested in solving the same problem.
I currently have a solution involving JMX and WebLogic cluster.
1-create dynamic Mbean with synchronized methods
2-register with WL admin server as MBean agent/manager
3-all managed servers/users in cluster have access to this singleton
4-as clients log in/out they can invoke addUser/deleteUser methods on
dynamic mbean. They can also read currentUserCount.
PROBLEM:Single point of failure on admin server.
Looking for a simpler solution as you described above, OR
figuring out how to have dynamic MBean replicated in cluster so that each
managed server uses a local replicated copy--not sure how to achieve this
yet...
- 8
- Refinement of a Java prog called by PHPAfter listening to everybody's replies, I rephrase my problems as follows:
I modify my program from my client:
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection ( "jdbc:mysql://127.0.0.1/" +
dbstr, "root","");
...
after a series of search in the db "dbstr",
I want to return result from the search obtained by this Java program by
simply using System.out.printIn because I tried a C program and printf
simply works.
In order to make sure the java program can be called by PHP successfully, i
place it under the php directory instead of calling
system(java_prog_absolute_path/the_java_prog);
And the error returns from the java "slave" prog to the "master" php prog
is:
the error is:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at
java.net.URLClassLoader$1.run(URLClassLoader.java:200) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:188) at
java.lang.ClassLoader.loadClass(ClassLoader.java:306) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at
java.lang.ClassLoader.loadClass(ClassLoader.java:251) at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at
java.lang.Class.forName0(Native Method) at
java.lang.Class.forName(Class.java:169) at
SearchDatabase4.(SearchDatabase4.java:74) at
SearchDatabase4.main(SearchDatabase4.java:344)
And the file SearchDatabase4.java is:
74: Class.forName("com.mysql.jdbc.Driver");
344: new SearchDatabase4(args[0], Double.parseDouble(args[1]),
- 8
- rapid development web interface to a databaseI am looking for the easiest web interface to a database. By easiest,
I mean most rapid development. Because the requirements are so simple
and standard, I'm hoping that something can take care of the grunt
work. Easy maintenance, possibly by non-programmers (or at least
"junior" programmers) would also be nice.
I'm open to Perl, PHP, Java in that order (best solution wins, equal
solutions go with the preferred language). I'm also open to anything
that doesn't require code to be written to get the job done, as long
as there's some way to extend it if I get stuck.
The design is simple and is an age-old story:
I have a database with about 15 tables. 5 contain data with the same
primary key, 2 have their own primary key but still a 1-to-1 mapping
to the "main" primary key, and 8 are master lists that the other
tables reference (site id, customer id, that sort of thing). I need
the following screens:
simple search based on a couple fields
advanced search based on most available fields
search results simple display, showing a reasonable set of fields
search results advanced display, showing large or configurable set of
fields
simple display, showing most commonly desired fields
advanced display, showing all data
add new record simple, requesting most commonly entered fields
add new record advanced, allowing all fields to be manipulated
edit existing record simple
edit existing record advanced
editing for each of the 'master' tables
All edit/add screens need pulldowns for master lists allowing one to
be selected, search screens need pulldowns allowing multiple to be
selected. The user should not be burdened by the underlying layout of
thed tabase.
I want something to do most of the grunt work of:
all the CGI stuff, of course
authentication and maintaining the session
building the forms. ugly is ok as long as it's usable. optional
templating would be nice.
working with the database
After everything is done modifying the interface to accomidate a new
table or new column in an existing table should be trivial.
I appreciate any advice about the most efficient way to develop such
systems.
- 8
- WSIF and format:typemapping questionsHi to all of you,
I have to use wsif to call java, ejb and jms bindings. I wonna use
<format:typeMapping> extension to convert from xml to my custom Java
object. But somehow I cann not. Samples in WSIF zip are not enough to
solve my problems. Could someone give good tutorial or share his/her
experiense.
10x jajoo :)
- 9
- Bug#348398: Make her horny for youThe real trophy for her is what lies in your pants.
http://www.Steiplas.com/
Please don't forget this
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
- 9
- Jruby and script loadingI am looking for different ways to load jruby scripts from java. Has
anyone been doing this. JRuby 1.0 and Java 1.6
Berlin Brown
- 10
- How often to get a reference to my cached bean?Hi I have an entity bean which caches data. It could sit in the
container for a very long time.
This entity bean has references to other similary beans that cache.
Should I get a single reference to the other beans once - on startup or
should I lookup the bean every time I need it?
MyClassHome refhome = MyHomeHelper.getHome();
MyCacheClass reference = refhome.find();
The only reason I can think of for looking it up may be if the resource
(bean) moved to another server due to a crash/failover etc?
thanks
Tim
- 12
- is it possible to use a backslash as a StringTokenizer delimiter?I am trying to tokenize a file path to compare it to another.
i.e tokenize: ways\gov\marketing.fls
to compare each directory seperately.
Is it possible to use the "\" (backslash) character as a StringTokenizer
delimiter, and if so how?
if not, any ideas on how to seperate this string?
Any help greatly appreciated
Thanks
Greenz
- 12
- How can I do a barebones version of a source file?I need to create a barebones version of my Java source files.
What I mean when I say "barebones" is this: I have, for example, this class:
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
package cl.cl.cl;
import cl.lc.*;
import java.util.*;
public class demo {
public String salute="Hello, World!";
private String somethingElse="";
public void SayHello() {
System.out.println(":::"+salute+":::");
// ... a lot of code ...
}
public int RealAge(Person p) {
// ... a lot of code ...
return theStuffIJustCalculated;
}
public Person[] Friends(Person p) {
// ... a lot of code ...
return theArray[];
}
}
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
The barebones version would be:
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
package cl.cl.cl;
import cl.lc.*;
import java.util.*;
public class demo {
public String salute="Hello, World!";
public void SayHello() { }
public int RealAge(Person p) { return 0; }
public Person[] Friends(Person p) { return null; }
}
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
It would keep all the public/protected (not the private) attributes, methods,
etcetera, but only the declarations and no code inside the methods. The methods
that return something return a zero or a null value.
My intention is to be able to compile the entire set of source files, even if
there isn't any "meat" in them.
I wrote a Perl script, using pattern matching, but it's pretty crude and won't
handle properly stuff like more than one modifier for an attribute or a method,
or inner classes.
I'm wondering if this has been solved before. Do you know about a tool that does
what I'm trying to do?
Thanks in advance.
--
Miguel Farah
email***@***.com
- 12
- Tomcat classpath and servlets outside of WEB-INFHi,
Does anybody know if it is possible to execute servlets outside the
WEB-INF directory? Somebody at work thinks that setting the classpath
would help. But I have had no luck so far. I'm currently on a
Win2000 box running Apache, Tomcat 4.1.18, j2sdk 1.4.2. And I found
out (to my dismay) that symbolic linking doesn't work with Windows. I
don't even know if symbolic linking would work if it was a linux box.
People at work say that Tomcat has worked and it was executing
servlets outside the WEB-INF directory. They are very sure on this
point. But it broke, and they decided to deleted the entire
installation (conf file and all). And the person who got it to work
is no longer here. So I'm at square one. Jserv had been running the
servlets, but the company wants to move forward. The servlets had
been mapped to Jserv through the classpath.
Any help or ideas would be greatly appreciated.
Jim
- 14
- grant execute file permission to a JSP? I'm trying to run an external command from a JSP and instead get
the exception:
java.security.AccessControlException: access denied (java.io.FilePermission /usr/bin/killall execute)
which seems clear enough. (The code runs and works from within a
console application.)
The OS is Linux and the application server is the one that
installs with the J2EE sdk from Sun. It is installed within my
home directory and runs under my user ID exposing deployed JSPs
at http://localhost:8080/
I've added the following code to both my ~/.java.policy file and
the ${java.home}/jdk/jre/lib/security/java.policy file:
grant codeBase "http://localhost:8080/-" {
permission java.io.FilePermission "/usr/bin/killall", "execute";
permission java.security.AllPermission;
};
Neither of the entries in either of the files makes any
difference. The only change I've made that has any affect at all
is to change the command from 'killall ...' to '/usr/bin/killall
...' which changed the file reference in the exception from "<<ALL
FILES>>" to "/usr/bin/killall".
Each time I made a change in the policy files, I restarted the
application server to make sure it was using the new file contents.
I'm clearly overlooking something or have something wrong. Any
suggestions on how to resolve this would be most welcomed!
thanks,
hank
- 14
- CFP - IT Underground 2006, Prague, Czech RepublicHello,
I'd like to announce the call for papers for the IT Underground 2006, a
two-day conference organized by Software Conferences and hakin9.lab team in
23-24 February 2006, Prague, Czech Republic.
IT Underground 2006 is a fifth edition of a conference dedicated to IT
security issues, where remarkable authorities will share their knowledge and
experience with IT specialists.
In previous editions we had pleasure to listen to: Ofir Arkin, Maximillian
Dornseif, David h1kari Hulton, Chuck Willis, Charl Van der Walt, Shalom
Carmel, Martin Herfurt, Adam Laurie, Marcel Holtmann, Alexander Kornbrust,
Saumil Udayan Shah, Robert Lee Ayers, Dave Aitel, Stefano Zanero, Thorsten
Holz, Joanna Rutkowska, Michael Shema, Piotr Sobolewski, Michal Szymanski,
Paul Wouters, Rakan El-Khalil, Wojciech Dworakowski, K.K. Mookhey, Pawel
Krawczyk.
The dead line for lecture proposals is the 15th of January, 2006.
All the detailed information you can find on http://www.itUnderground.org/
We hope that you find our offer interesting. Please, contact me to discuss
further details of our cooperation.
IT Underground 2006 - basic characteristics.
When: 23-24 February 2006
Where: Prague, Czech Republic
Topic: IT Security
We assure:
- hotel accommodation and transfer,
- full support for your presentation, both before and during the conference,
- providing the necessary technical facilities for the presentation,
- assistance in acquiring and publishing presentation materials, information
about your lecture in the conference brochure,
- supervising and directing the overall progress of the conference.
--
Piotr Sobolewski
email***@***.com
- 14
- Tomcat4 RMI class loading bermuda triangleHi every body,
I'm trying to fix this problem for one week and i'm turning crazy
right now.
I have this servlet working perfectly, finding every package i put in
/var/tomcat4/shared/lib except that it doesn't find my RMIServer class
for casting
i get a
[java.lang.ClassNotFoundException] - myRMIServerClass
org.apache.catalina.loader.StandardClassLoader.loadClass(Unknown
Source)
org.apache.catalina.loader.StandardClassLoader.loadClass(Unknown
Source)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:141)
all classes are in the jar with the stub and skeleton (i tried to put
classes in WEB_INF/classes of my servlet but same problem... so i
guess this is not the real problem)
I have set in catalina policy file a:
grant {
permission java.security.AllPermission;
};
to be sure there's no problem of security. i changed the
init.d/tomcat4 script to add -security to the starting line to be sure
that it is started the right way
i used to try the same code with tomcat 3 and i changed to tomcat 4
because of a rmi jni problem reported on mailing lists (i spent so
much time on tomcat4 that i can't remember what was the previous one)
but i can't even get that far with tomcat4
my version is a rpm 4.2.1 for Red Hat
does someone understand what's going on
|
| Author |
Message |
bee

|
Posted: 2008-3-26 17:45:00 |
Top |
java-programmer, Hi iam bavani
Hi iam bavani
life is the first gift
love is thesecond
understanding is the third
****************************************
htt:"my profile 22 blogs pot.com
**********************************************
username:bavanikumar22
***********************************************
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- simplifying use of properties"Stefan Schulz" <email***@***.com> wrote in message news:<opsg4x3eg6q1fd9p@localhost>...
> The change you describe is inherently incompatible, though.
Not if you change reflexive field access to match the hardcoded
equivalent.
> In fact, the
> VM you describe is fundamentally different and incompatible to the current
> JVM.
> What you argue for is effectively another language with
> wholely different concepts.
I don't think so.
> I'll not say that these concepts in themselves
> have no merit, but in the Java programming language, they are not
> appropriate, since they run against several other principles of the
> language's
> design.
Like what?
> >> > No merit? Properties are supported in many languages like Python,
> >> > Ruby, C# and (I think) VB.
> >>
> >> So what? They are in java too (see the public modifier for fields) ;)
> > Once you have a public field in Java, you can't later replace it with
> > accessor methods without breaking clients. But in Python, Ruby & C#,
> > you can. That is what I meant by "properties" as opposed to "fields"
> > or "instance variables".
>
> No, you can't. Think about reflexive invocation - Will work with a public
> method, will not work with a inaccessable field, and getter/setter pairs.
That's not a problem; I wasn't proposing changing the semantics of the
invokevirtual instruction for somebody to complain that the parallel
using reflection behaves differently from a hardcoded invocation. What
we do need to change is reflexive field access: it should invoke the
getters & setters when the field isn't found. But that's pretty
logical.
>
> >> It will however make it even more of a living hell to explain tonovices
> >> that a setter/getter pair need not be backed by one andonly one field
> >> of the arguemnt type.
> >
> > Getter/setter pairs that are not backed with fields are used all the
> > time in Java. I'm only proposing an easier syntax for their use.
> > Regarding the novices bit, OO theory says that when you call a method,
> > you should *not* be concerned with how it's implemented. I feel you
> > should not be telling novices that a getter/setter pair always has to
> > be backed with a field.
>
> This is what i said. Most assume it has to be backed by a field, and if
> you use field access syntax, you reinforce that notion.
Maybe, but I still think it's straightforward for novices to
understand that what looks like a field access may be an invocation,
once you explain it to them. There are tougher concepts novices must
understand.
- 2
- Code generation aplicationOn Mon, 11 Aug 2003 21:55:14 +0100, Alexandre Cotta Godinho wrote:
> Hello there !
>
> I need some help in increasing productivity. Do anyone knows about a
> code generation tool, as customizable as possible allowing to generate
> from UML dynamic diagrams as well. There is a nicely referenced product
> of name Codagen Architect (www.codagen.com), but it runs on Windows only.
>
> Thank you in advance
>
> Alexandre Cotta Godinho
TogetherJ or Rational Rose.
Both are -1 imo.
-c
- 3
- Pre-Populate a Form that nested tagsI have a Struts action form which contains a bean. I am trying to
display a bean retrieved from the database in this form using the
nested tag. Can anyone help me? I continue to get an error message
see end for stack trace.
Struts config
<form-bean name="newBean" type="com.NewForm" />
.....
<action path="/new-action" type="com.NewAction"
name="newBean" scope="session">
<forward name="blah" path="/New.jsp"/>
</action>
Bean
public class Program implements Serializable {
private int prg_pk;
private String prg_prog_name = null;
private Set courses;
getters()/setters()
Form
public class NewForm extends ActionForm {
private Program program;
/**
* Returns the program.
* @return Program
*/
public Program getTheProgram() {
return program;
}
/**
* Sets the program.
* @param program The program to set
*/
public void setTheProgram(Program program) {
this.program = program;
}
public void reset(ActionMapping mapping, HttpServletRequest
request) {
HttpSession session = request.getSession();
setTheProgram((Program) session.getAttribute("PROGRAM"));
}
}
JSP
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<nested:form action="/new-action.do">
<nested:nest property="program" >
<nested:write property="prg_prog_name"/>
</nested:nest>
</nested:form>
Stack Trace
java.lang.NullPointerException
at java.util.Hashtable.get(Hashtable.java:315)
at org.apache.jasper.runtime.PageContextImpl.findAttribute(PageContextImpl.java:303)
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:663)
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:710)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:290)
at org.apache.struts.taglib.nested.bean.NestedWriteTag.doStartTag(Unknown
Source)
at org.apache.jsp.New$jsp._jspService(New$jsp.java:114)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:479)
- 4
- Failed to load or instantiate TagExtraInfo classI am using struts-1.3.8 tiles together with Spring, now I wanted to
implement my own custom tag. Following a book example, I wrote a
TagHandler that extends "SimpleTagSupport". Eclipse told me I needed
to import the jsp-api.2.0.jar from tomcat, so I did.
However, this always results in the error:
org.apache.jasper.JasperException: /WEB-INF/jsp/myjsp.jsp(1,1) Unable
to read TLD "META-INF/tld/struts-tiles.tld" from JAR file
"file:myFileLocation": org.apache.jasper.JasperException: Failed to
load or instantiate TagExtraInfo class:
org.apache.struts.tiles.taglib.UseAttributeTei
I did some research on the web, there it's said not to include the jsp-
api.2.0.jar (but not why not to), and yes, this solves the problem -
but how can I implement my Tag handler without using this jar file?
Eclipse doesn't find the required classes otherwise...
Thanks in advance,
Christine
- 5
- Announcement: PerfectJPattern first release 1.0.0 available ...hi,
After long working hours have been able to finally put together a first
release of PerfectJPattern. The aim of PerfectJPattern is to build a
library of componentized (reusable and context-free) Design Patterns
in Java.
Please visit the home page under: http://perfectjpattern.sourceforge.net
Feedback most welcome!
Best regards,
Giovanni
PS: I still have plenty to work on the documentation again any feedback
with corrections/suggestions will be most welcome.
- 6
- Problems in xml parsingHi,
I am using XMLTool.java to convert an xml file into an xml document
and
I am parsing the xml file using Nodelist and Nodes.
NodeList ls = getElementsByTagName("xxx").
Its working fine when I am running my application in windows.
But when I am running the same application in unix, I am getting
exceptions while parsing. Its giving null value and I cannot proceed
further.
Can anybody pls suggest where I am doing wrong?
I appreciate your help.
Regards,
Hari.
- 7
- Swing Applet, JDBC and MySQL Connector ConfusionI believe your applet must be run from a signed jar, and the MySQL database
must also be resident on the same server as the applet. I'm not 100% sure of
this in your case....but I am 99% sure. -Ike
- 8
- 9
- C++ to Java aplet, need help to understand.Hi,
I have a c++ application that uses Direct X to get images from my webcam.
Now I want to stream images from my application to the internet.
I just want to make sure I understand how a java applet would, (should?),
work.
When the user load the page where the java applet is located, the applet
makes a request to my machine for an image.
The applet then displays the image at a certain location in the page.
So a java applet does not really 'stream' videos, instead it makes a request
for an image every 'x' seconds.
All the applet needs is address and port where my application is located,
(and the name of the function that will return the frame).
Sadly I have no knowledge of Java, (well a little maybe).
Where could I find some code for an applet that would make a request to my
application.
How can a java applet make a request to a win 32 c++ application?
And what would the code look like in an html page?
Many thanks in advance for any help/code.
Simon
- 10
- log4j with OpenJMS
Anybody got sample code for sending log4j messages specifically to OpenJMS?
In particular I'd like to do it all programmatically, since I'm working with a fairly complex pre-existing build system and would rather not start introducing too many new properties files. I have a log4j.properties file, but I'm trying to avoid having to create a jndi.properties file.
I stuck this code from OpenJMS in my Logging utility (which wraps log4j):
Hashtable properties = new Hashtable();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.exolab.jms.jndi.InitialContextFactory");
properties.put(Context.PROVIDER_URL, "rmi://localhost:1099/");
Context context = new InitialContext(properties);
and log4j.properties has a simple:
log4j.myLogger=DEBUG, JMS1
log4j.appender.JMS1=org.apache.log4j.net.JMSAppender
log4j.appender.JMS1.TopicBindingName=testtopic
log4j.appender.JMS1.TopicConnectionFactoryBindingName=JmsTopicConnectionFactory
I keep getting the error "javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial" which leads me to believe that my block of code is not storing the InitialContext in a way so that log4j can get at it.
Thanks!
- 11
- improve J2EE performanceI have installed on my computer Sun J2EE server to use IMQ.
Normally after boot I digit :
./[path]/bin/asadmin start-domain domain1
but the performance aren't good , because I use an application with (more
or less) some hundreds msg/minute.
How Can I improve this server's performance ?
I can start this server on another runlevel or I can allocate to him more
resources ?
--
Ciao Flex
________________________________________________
Chi sa ascoltare non solo e' simpatico a tutti ,
ma prima o poi finisce con l'imparare qualcosa
- 12
- repeating program codeI've created a program that calculates real estate commission. The person
inputs the sale amount and then enters a letter which represents a certain
commission rate. It then calculates the commission and displays it. After
the commission amount is displayed i want it to prompt the user for
another transaction. When there are no more transactions i want the
program to display the total amount of the properties entered, and the
total amount of the commissions calcualted. I'm not too sure what to do.
Should i use a while loop? Here is what i have done so far.
// RealEstateCommission.java: Calculates real estate commissions
import javax.swing.JOptionPane;
public class Calculator {
/** Main method */
public static void main(String[] args) {
double salePrice;
double commissionRate = 0;
// Enter sale price
String salePriceString = JOptionPane.showInputDialog (null,
"Enter sale price",
"Calculator Input", JOptionPane.QUESTION_MESSAGE);
salePrice = Double.parseDouble(salePriceString);
// Enter property code (residential, multidwelling or commercial)
String propertyTypeString = JOptionPane.showInputDialog (null,
"Enter property code (residential (R), multidwelling (M) or
commercial(C))",
"Calculator Input", JOptionPane.QUESTION_MESSAGE);
if (propertyTypeString.equals ("R"))
commissionRate = 0.070;
else if (propertyTypeString.equals ("M"))
commissionRate = 0.060;
else if (propertyTypeString.equals ("C"))
commissionRate = 0.035;
// Calculate commission
double commission = salePrice * commissionRate;
// Format to keep two digits after the decimal point
commission = (int)(commission * 100) / 100.0;
// Show results
JOptionPane.showMessageDialog(null,
"the commission is" + commission,
"Cakculator Output",
JOptionPane.INFORMATION_MESSAGE);
String transactionString = JOptionPane.showInputDialog (null,
"Would you like to do another transaction (YES or No)",
"Calculator Input", JOptionPane.QUESTION_MESSAGE);
while (transactionString.equals ("YES"))
System.exit(0);
}
}
- 13
- Overheads involved in repeated acces to a database using JDBCI have an application that inserts words and their associated values
into a hashtable. If the word already exists in the hashtable, the
value associated with the word is increased in the hashtable. When the
hashtable is complete, I write its contents into a simple, two-column
table in a singer-user database using jdbc.I'm using MS Access at the
moment because my database doesn't need to support multiple -users or
very complex queries.
-Would I be better to take the hashtable out of the equation all
together? (i.e. read, write and update the values in the database as I
go along).
-Do you know if there is much overhead involved in contacting a
database in this way, as I would need to do it about 4,000 times?
I'm not sure how jdbc works.
-Can you alter the result set repeatedly and do a mass write to the
database at the end?
-Would another type of database suit my needs better?
Thanks in advance
~M
- 14
- IP-HOSTNAME Conversion ProblemHi,
I found many utilities in the web or rather the internet to resolve ip
address and host names , i took this example
host name : mp3.box.sk whose IP was resolved to be 69.31.81.51
now i took the same ip and tried to resolve the host name, for my
surprise i found that to be
colo-69-31-81-51.pilosoft.com which is not mp3.box.sk for sure, can
anyone explain as to why this problem is caused?
- 15
- executing data needs mprotect with PROT_EXECThis is a multi-part message in MIME format.
I've been trying to run some FreeBSD4 packages
inside a jail on a FreeBSD6 / amd64 box; and I've
hit a problem with ports/jdk.
A couple of places the VM uses an array of
integers, puts code in it, and executes it.
This doesn't work on machines where the CPU
honors the PROT_EXEC settings; this can be
different on different machines (depending on
BIOS settings probably).
The right fix is to call mprotect() from jdk to allow
execution of the memory in question, something like this:
--- ../../hotspot/src/os_cpu/bsd_i486/vm/os_bsd_i486.cpp Tue Feb
14 21:12:46 2006
+++ ../../hotspot/src/os_cpu/bsd_i486/vm/os_bsd_i486.cpp Wed Feb
15 16:30:49 2006
@@ -561,6 +562,9 @@
}
#else
static void (*fixcw)(void) = CAST_TO_FN_PTR(void (*)(void),
code_template);
+
+ ::mprotect((void *)code_template, sizeof(code_template),
+ PROT_EXEC | PROT_READ | PROT_WRITE);
#endif
fixcw();
--- ../../hotspot/src/cpu/i486/vm/vm_version_i486.cpp Thu Sep 11
03:40:14 2003
+++ ../../hotspot/src/cpu/i486/vm/vm_version_i486.cpp Tue Feb 14
23:34:40 2006
@@ -9,6 +9,8 @@
# include "incls/_precompiled.incl"
# include "incls/_vm_version_i486.cpp.incl"
+#include <sys/types.h>
+#include <sys/mman.h>
int VM_Version::_cpu;
int VM_Version::_cpuFeatures;
@@ -145,6 +147,10 @@
ResourceMark rm;
// Making this stub must be FIRST use of assembler
CodeBuffer* c = new CodeBuffer(address(stubCode), sizeof(stubCode));
+
+ ::mprotect((void *)stubCode, sizeof(stubCode),
+ PROT_EXEC | PROT_READ | PROT_WRITE);
+
VM_Version_StubGenerator g(c);
getPsrInfo_stub = CAST_TO_FN_PTR(_getPsrInfo_stub_t,
g.generate_getPsrInfo());
patches also attached in case the mail client mangles them :-)
- Arne H. J.
|
|
|