| how to do synchronization profiling and RepaintManager and performance issues |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- 3
- Something a bit goofy about Generics
Iterable<? extends JavaFileObject>
You'd think a JavaFileObject[] or a JavaFileObject... would fullfil
that requirement, but it doesn't. It fills it sufficiently to do a
for:each but not to satisfy this parameter.
That is like a piece of purple lint on a white sweater.
People say arrays and generics don't mix, but they damn well SHOULD.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
- 5
- -Xmx---m getting smaller and smallerHi,
I have Windows XP SP3 with 4GB memory (I know Windows only allows apps to use
about 3.25GB.) I have no applications running. I ran System Mechanic 7 to
defrag the memory with the result of the largest contiguous block of memory
being 2.74GB.
However, everytime I started Eclipse 3.3.2, the JRE 1.6.0_04 JVM terminated
with a -1 code. I started at -Xmx1024m and continually decremented until I
reached -Xmx600m when Eclipse started okay. This morning I was running
Eclipse with -Xmx900m okay.
The only changes I made were to (1) set the system variable JAVA_HOME to
reference JDK 1.6.0_04 and replaced java.exe, javaw.exe, javaws.exe in c:
\WINDOW\System32\ with the JRE 1.6.0_04 files. They were 1.4.2_07.
Does anyone have any idea why the JVM terminates because of not enough memory
when there is more than enough contiguous memory? This is really
frustrating.
Thank you,
Don
- 6
- change defaultsHi,
How do you change the default font for all components ( frame, label, etc )
in swing ?
regards
Johan
- 6
- Check class file for annotationDoes anyone know of a simple way to determine whether a marker
annotation is present in a given class file?
TIA
--
========================================================================
Ian Pilcher email***@***.com
========================================================================
- 6
- sentmail problemhi
i am doing a project using JavaMail API with JSP and James server
i have implemented sendmail,compose. but i wanna know how can i
implement sentmail as it is seen in the real application.
I wanna know what can i should do to retrieve the mails sent from an
account using James
- 7
- Update of JProgressBarHi,
in my program i use a JProgressBar. I know, that i have to use another
Thread for updating the progressbar.
But with the following code it isn't working. What's wrong?
public class Parser1CheckVisitor{
int iCount = 0;
JFrameJRespCheck m_JFrameJRespCheck;
ResponseFile m_ResponseFile;
public Object visit(ASTrecord node, Object data) {
if (data != null) {
m_JFrameJRespCheck.jProgressBarPanelStatus.setMinimum(0);
m_JFrameJRespCheck.jProgressBarPanelStatus.setMaximum(m_ResponseFile.
m_iCount);
makeProgressThread().start();
for (iCount = 0; iCount < m_ResponseFile.m_iCount; iCount++) {
m_ChipFile.readRecord(iCount + 1);
data = node.childrenAccept(this, data);
}
}
return "OK";
}
Thread makeProgressThread() {
return new Thread() {
public void run() {
while (iCount != m_ResponseFile.m_iCount) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {}
m_JFrameJRespCheck.jProgressBarPanelStatus.setValue iCount);
//System.out.println(iCount);
}
}
};
}
}
- 7
- Proposal. Sort should return a boolean.Here is an idea. I would like it if Collections. sort and Arrays.sort
would return a boolean. true means something actually changed. false
means the array was already in order.
Further there would be an additional boolean parameter to the sort to
say "items probably already in order". The sort would then do a quick
check to make sure the items were in order, and if so, bypass the full
sort.
This would be useful when you have to avoid needlessly calling
fireTableDataChanged after a sort.
It would also allow you to use sorts in an assert to ASSURE the data
are already sorted, and explode if they are not already sorted.
Since the sort is void now, all existing code would still work. You
would just have an additional method call with the optional boolean
parameter, or perhaps only in would get the boolean return.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
- 7
- Little ProblemI have three numbers - 1, 2 & 3.
A randomly selected one of the three are stored in 'var1', and another
randomly selected one is in 'var2'.
How do I find out the number that is left over?
I tried a while loop but I couldn't get it to work...
TIA
- 8
- [ANN] SwingEmpire FormBuilder - New Preview 0.9.4
SwingEmpire FormBuilder helps in quickly building GUIs with JGoodies
Forms.
The new/updated features include:
* pluggable custom layout styles for grid elements and borders
* enhanced support of custom component factories
The preview is available at
http://www.swingempire.de/palace/FormBuilder
For your convenience a summary of "old" features
* rapid visual design of form-oriented GUIs
* targeted on JGoodies Forms
* re-usable layout data
* immediate preview in choosable LookAndFeels
* persisting layout data separated from application code
* persisting via standard XMLEncoder
* pluggable custom components
* pluggable persistence format
Test and (hopefully :-) enjoy - I'm eagerly awaiting your feedback.
Regards
Jeanette Winzenburg, Berlin
- 9
- Swing Worker Pause/ResumeHello all,
I am dealing with a class that extends SwingWorker and Inside that
class there is another class defined. I'll refer to the inside define
class as the "helper class" for sake of clarity.
What i am try to do is to pause/resume the class that extends
SwingWorker, when i used flags to do that it outputed errors from the
"helper class". These errors came from a method that fires Custom
Events and they were NullPointerExceptions. After the errors were
printed the classes continued executing.
How can i pause/resume successfully ?
Thanx in advance for any help :D
Ahmed Ashmawy
- 12
- JNI Trouble calling FindClass from Worker threadHello
I am able to get the class object when i call FindClass in the main
thread. Now when i spawn a worker thread and attempt the same call
after caching the JVM and creating a new Env . it fails and triggers an
exception on the Java side .
My code for a DLL looks like this
JMVM *jvm = NULL ;
..
DLLMain()
{
}
JNIEXPORT jint JNICALL Initialize
(JNIEnv *pEnv, jclass)
{
pEnv->GetJavaVM(&jvm);
ASSERT(jvm!=NULL);
jclass cls = pEnv->FindClass("demoflashplugin/views/Objfactory");
if(cls!=NULL)
AfxMessageBox("cls found");
AfxBeginThread(WindowThread , NULL);
}
UINT WindowThread(LPVOID p)
{
JNIEnv *env = NULL ;
jclass cclass ;
if(jvm!=NULL)
{
if (0==jvm->AttachCurrentThread((void**)&env,NULL))
{
if ((env)->ExceptionOccurred()) {
AfxMessageBox("Exception occured");
(env)->ExceptionDescribe() ;
}
if(env!=NULL)
{
AxMessageBox(getenv("CLASSPATH"));
cclass = env->FindClass(demoflashplugin/views/Objfactory");
if(cclass!=NULL)
{
AfxMessageBox("Class is not Null");
}
else
AfxMessageBox("Class is s Null");
}
else
{
AfxMessageBox("env is NULL ");
}
AfxMessageBox("Finished checking for string");
}
else
{
AfxMessageBox("JVM IS Null");
}
}
}
- 16
- 16
- PAAppViewer3 (AppViewer3)?Hello,
Might anyone please kindly answer my question? Thank you very
much.
I can't read the result of performing bootstrapping in Amos 6.0.
In the Amos text output, on the left hand side, there are two
sections. The lower section is the result of performing bootstrap,
including estimates/bootstrap, estimates of bootstrap standard error,
estimates of bias-corrected percentile method.
However, I can't read any of them. Nothing shows up.
Also, I find this message,
Error number: 70
Source: PAAppViewer3 (AppViewer3)
Description: Permission denied
Call stack: frmMain hdoc_ onmouseover
How can I be able to read the result of performing bootstrapping in
Amos 6.0.?
Thank you very much and look forward to your kind reply.
Please take care
Best wishes to your life
Caroline
- 16
- debrisW a t c h o u t!
ALLIACNE ENTERPRSIE (A ETR)
Currnet Prcie: 0.80
Add this g e m to your w atch list, and w atch it tard closely!
Nwes Releaes!
Taeocrp announces breackrough in removing deadly l andmines.
Mill Valley, California August 25, 2006 - The Alliance Etnerprise Corpoartion announced today a breakthrough in developing an Areial Lnadmine Sysetm aimed at locating, detecting and mapping deadly landm ines.
TeaCorp's mission is to reclaim lands around the globe embedded with l andmines that victimize countries and their stakeholders.
More than 100 m i l l i o n landm ines in 83 countries are holding international communities and industries hostage, preventing the inv estment in and development of product ive lands and the re-building of infrastructure. A broad variety of landmine s have been scattered over pro ductive areas effectively crippling the eco nomy and disabling thousands of children and adults. There are no reliable records that accurately show where these d e v a s t a t i n g landmine s lie in wait for their v ictims.
With the present day c osts to clear a single land mine ranging between $1,000 to $1,500, solving the problem of de-mining lands will reach billions of dol lars. TaeCorp has developed a technology based, cos t effective solution to this problem using its three tiered approach to scanning, mapping and removing la ndmines. TaeCorp's System will provide many social and eco nomic benef its to countries and their industries including oil and gas, mining, agriculture, roads and infrastructure development.
About TaeCorp.
TaeCorp's vision is to be the recognized leader in providing Aeiral Deteciton Systmes including global de-mining, clearing a path to a safer planet for all humankind.
Here comes the big one!
All signs show that AET R is going to Explode!
Concl usion:
The examples above show the awesome, earning potential of little known companies that explode onto invesotr's radar screens; Many of you are already familiar with this. Is A ETR poised and positioned to do that for you? Then you may feel the time has come to act... And please watch this one trdae tomorrow! Go AE TR.
Pen ny sotcks are considered highly speculative and may be unsuitable for all but very aggressive investros. This prof ile is not in any way affil iated with the featured company. This report is for entertainment and advertising purposes only and should not be used as invesmtent advice. If you wish to stop future m a i lings, or if you feel you have been wrongfully placed in our membership, send a blank e m a i l with No Thanks in the subject to
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
|
| Author |
Message |
Dimitri Ognibene

|
Posted: 2006-4-25 17:10:00 |
Top |
java-programmer, how to do synchronization profiling and RepaintManager and performance issues
Some day ago I've posted about a problem with
javax.swing.SystemEventQueueUtilities.queueComponentWorkRequest
and some performance problem.
(http://groups.google.com/group/comp.lang.java.programmer/browse_frm/thread/afcd152d02c4d4cb/#)
My doubt is that the system spend too much time in symchronization
problems.
Someone suggested that it can be all the repaint stuff, but I've tried
to reduce it...(the paint component method in the reduced version is
something like
{ super.paintComponent..
draw an oval}
while in the complex versions is {
{ super.paintComponent..
draw 400 lines
draw 400 oval
}
and the first one takes the 20% of resources while the last the 40%
Moreover the time spent in the paint method is less and the repaint
manager should be decoubled from the component...
so how can I do a better profiling of the system?
I was thinking to override the repaint method and using directly the
invoke later paint..
but I'd like that the new method would be able to merge more call to
repaint in only one paint.. if the last paint hasnt stopped...
I hope that this info will sufficent, otherway askme
Thanks to all
Dimitri
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Asking help for a java io problemHello, guys! I have a problem running the following code with eclipse
showing that:
java.io.IOException: Stream closed
at sun.nio.cs.StreamDecoder.ensureOpen(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at HtmlFileParser.parseHtmlDoc(HtmlFileParser.java:32)
at HtmlFileParser.main(HtmlFileParser.java:52)
//code here:
try{
FileInputStream fin = new FileInputStream("test.html");
InputStreamReader fr = new InputStreamReader(fin);
for(i=0; i<2048; i++) buf[i] = '0';
fr.read(buf, 0, 2048); //problem here (line 32)
FileWriter fw = new FileWriter("bufWriteTest.txt");
fw.write(buf);
fw.flush();
}
catch(FileNotFoundException e) {
e.printStackTrace();
}
catch(IOException e) {
e.printStackTrace();
}
There are no syntax erro in the above code, it just dosen't work,
please help me finding out what the problem is, thank you.
- 2
- Riddle me thisOn Mon, 07 Nov 2005 11:35:27 GMT, "Sharp Tool"
<email***@***.com> wrote, quoted or indirectly quoted someone
who said :
>All these distribution dont include negative numbers?
A normal is clustered about a mean, nominally 0, with symmetric tails
left and right.
Poisson is a distribution of positive numbers.
Just what do these numbers measure?
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
- 3
- JavaHelp and root nodehi,
Simplifying i have a java help set as this
ROOT -> C
-> B -> b1
-> b2
-> b3
->C
I can set B as current visualized node with these instructions:
helpBroker =(DefaultHelpBroker)coreHelpSet.createHelpBroker();
helpBroker.setCurrentID(B);
my problem is that i'd like to hide the other nodes setting B as tree
root node so that i could only see B and its children b1,b2,b3.
This is because entire help set is recovered from a big manual
describing a lot of applications and i'd like to show only one referred
by node B avoiding to show others that couldn't be installed.
Can you help me?
thanks
- 4
- how to mail a form in JSPhi this is ravin. i m a last year IT student and i am doing my project
at a govt. organization. i have to do one thing in my project that:
> there is a feedback form which is to be filled by any user.
> it is having four fields.
1) name
2) tel.no
3) e-mail address
4) comments
> i simply have to mail this fields to the org.'s mail address when user hits submit button. there is nothing to do with this fields.
please send releated help as early as possible.
- 5
- Reflection and access to type parameter?Given the SSCCE below, the need to pass A.class and B.class in
lines 25 and 25 seems redundant. However, I can find nothing in
the language that would let that be done in the constructor,
between lines 18 and 19. The obvious would be
Class<T> x = T.class;
but that of course does not work. Is there any bridge at all
between reflection and generics? I suspect the answer is no
and the code below is the best that can be done, but I'm
not sure.
1 import java.lang.reflect.Method;
2 public class TestEnums
3 {
4 public static enum A
5 {
6 V1,
7 V2;
8 }
9 public static enum B
10 {
11 X1,
12 X2,
13 X3;
14 }
15 public static class C<T extends Enum<?>>
16 {
17 public C(Class<T> x) throws Exception
18 {
19 T[] eVal = x.getEnumConstants();
20 for (Enum<?> v : eVal) System.out.println(v.toString());
21 }
22 }
23 public static void main(String[] args) throws Exception
24 {
25 C<A> ca = new C<A>(A.class);
26 C<B> cb = new C<B>(B.class);
27 }
28 }
- 6
- Applet using jdbc (ms sqlserver)Hi,
After reading lots of docs, a got the impression that it is possible to
write an Java Applet, that uses jdbc to connect to MS SQLServer (Without
flushing all security permissions down to drain).
Here is what I've done:
1. Downloaded the Microsoft JDBC driver for SQL Server 2000 SP 3.
2. Downloaded the app from Microsoft's site:
http://support.microsoft.com/default.aspx?scid=kb;en-us;313100
3. Tried to compile.
I get the java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC]Error establishing socket.
I have tested every possible error that I can find in MS's site. I have
tried to alter policies granting "permission java.net.SocketPermission",
with no luck. I think that before granting this permission, I also got
some security exceptions..
So here's my question: is it possible to create an applet (UnTrusted)
that uses SQL server, that can be run in browser, that doesn't need any
security alternations?
Best Regards,
Mika
- 7
- 8
- looking for a Java decompilerHello!
Is there a good byte-code de-compiler in the ports? It does not
need to be fancy/GUI -- just a straghtforward .class->.java utility.
Thanks for any pointers. Thanks!
-mi
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 9
- Printing EPS (embedded postscript) from Java.
Hello all,
I need to print .eps (also called .epsf, .epi, .epsi) from inside a
java program. My target platforms are windows and mac-- although
windows is first.
The new 1.4 printing API has aupport for printing normal postscript
but does not have .eps support.
I've been looking around the internet to see what solutions people
have come up with and unfortonately I didn't get what I would call a
solid answer by doing this....
I looked at the source of two open source programs the support .eps.
They both have origianal source but esstenially did it almost exactly
the same way. They took the .ps file the the standard Java classes
generated and just stuck an .eps header on it. They then stick the .ps
inside a box as required. They then searched the .ps file for commands
that are illegal in the .eps and if they are there they just die.
I've got some serious problems with this:
(1) It assumes that the Sun classes are going to generate a .ps that
is easily converted to an eps. Maybe they do now but what about future
versions of Java?
(2) It makes big assumptions about future .ps and .eps formats.
(3) It stinks of just being a hack. Does anyone really know this is
going to work all the time and on all platforms?
Does anyone have any experience with making .eps from Java that has
any sugestions? I want to translate my Garphics2D objects to .eps. I
want the .eps to be accepted by major publishing programs on windows and
mac.
Thanks
Glen Pepicelli,
http://www.glenp.net
(reply to group)
- 10
- 11
- Programatically deducing VARCHAR2 length?Hi,
I'm using WebLogic 5.1 sp12 and Oracle 8.1.7 with JDBC 1.2 drivers.
I was wondering, if I know that a column is a vARCHAR2 column, how
could i deduce the maximum length of that column, short of repeatedly
inserting larger and larger strings until I genertae an exception. I
know with SQL*Plus I can describe the table and find out lengths that
way, but I was hoping for a more general automated method.
Thanks for any help anyone can provide - Dave
- 12
- Java Training QuestionI am an unemployed web developer with php, perl, and asp programming
experience and in order to be able to widen my job search I am considering
getting some formal training in Java. I am looking for training
recommendations in order to be able to do Java web development. Also will
this training be appealing to prospective employers or just a waste of my
time and money. Any feedback I get will be greatly appreciated.
- 13
- JTable(A few more queries )I had a couple of more queries -
1) how to prevent swapping of the columns as in, by default the columns
in the JTable are not fixed in terms of their placement. They can be
very well swapped with one another. I want to prevent this.
2) Also after feeding the JTable with the data in database, i want to
be keep one row always empty so that a row can be inserted. It's like
we have in MS-Access.
hope i was clear in explaining the query properly.
Thanx,
Ankur
- 14
- Problem in connecting to a proxyHi,
i need to see if a user enters the correct username/password to
authenticate to a proxy. My problem is... through the following code,
i am
able to connect to a proxy with even invalid username/passwords.
Suppose
if the valid username and password to a proxy is test/test , i am able
to connect to the proxy using x/x . the response code returned is
always 200. Please advice..
################################
public static boolean isValidProxyAccount(String proxyServer,String
proxyPort,String proxyLogin,String proxyPassword) throws IOException
{
String go_url = new String ("http://www.google.com/");
boolean VALID_STATUS = true;
try{
URL url = new URL(go_url);
System.getProperties().put("proxySet",
"true");
System.getProperties().put("http.proxyHost", proxyServer);
System.getProperties().put("http.proxyPort", proxyPort);
HttpURLConnection con = (HttpURLConnection)
url.openConnection();
Base64Encoder b1 = new
Base64Encoder(proxyLogin+":"+proxyPassword);
con.setAllowUserInteraction(true);
String enStrProxy = "Basic "+ b1.processString();
con.setRequestProperty("Proxy-Authorization", enStrProxy);
int code = con.getResponseCode();
String retMsg = con.getResponseMessage();
System.out.println("code::"+code);
System.out.println("retMsg::"+retMsg);
System.getProperties().put("proxySet", "false");
System.getProperties().remove("http.proxyHost");
System.getProperties().remove("http.proxyPort");
con.disconnect();
if (code != 200){
VALID_STATUS = false;
throw new IOException("Failed to connect to CCO: "+retMsg);
}
}catch (Exception ex){
System.out.println(ex.getMessage());
throw new IOException(ex.getMessage());
}//catch
return VALID_STATUS;
}
- 15
- Clients are bad ?Hello John Bailo , You say :
" Open source is just about old style client software
catching of to the Web economy "
You obviously don't believe that yourself ,
otherwise you'd be using Google ... Not Moz .
|
|
|