| Trouble with KeyListeners in 1.4.2 |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- lose request focushello
I have some buttons on my UI and a textfield.
when the user dont click one of my buttons the focus from the textfiled
is lost
how solve this?
in onEvent(Event event)
{
if(event.target==button1)
do something
else if(event.target==button)
..........
like this is going......
what should I add to the method to catch the event(click somewhere in
UI,but not in my object(buttons......)) properly?
- 1
- JTable select problemHello,
I have a great problem with my JTable. I have a JTable with few lines
and two columns. The user can select one line and with the following
statements
int column = tblSearchResults.getSelectedColumn();
int row = tblSearchResults.getSelectedRow();
Object value = tblSearchResults.getValueAt(row,column);
I retrieve the value with which I display details of a second line in a
new window (when the user presses a certain button). The problem is
when I close this new window and want to select a new line the
getSelectedColumn and the getSelectedRow returns always -1 which
says that no line is marked although I have marked a line.
Does anybody know what the problem can be? - it must concern the open
and close of the detail window, because when I omit the code line which
opens the detail window and only make System.out.println's with the
getSelectedColumn and getSelectedRow it will always output the right
line...
thx
pat
- 2
- Tomcat and Connection HandlingHi,
I have noticed that when you do not return from the doGet() or doPost()
method, for example, by inserting a infinite while loop like this:
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException
{
while(true);
}
that tomcat will run out of connections after a few requests. So it
seems to me, that tomcat is only using a few threads to serve many many
http requests.
Is there any way that I can make sure, that each doGet() and doPost()
will be handle by a dedicated thread?
The problem I'm trying to solve is to keep up to 1000 http connections
alive over a long period of time and to sent information to the clients
once in a while.
I have solved this with basic thread blocking and waiting on objects,
but the problem is that tomcat runs out of threads, because there seems
to be a limited amount of threads, which tomcat uses to serve its http
requests.
any advice is appreciated!
fritz
- 3
- queue management with "application failure management"hi,
I am looking for something which looks like the message queue of the IPC
systemV with java.
my requirements are:
-management of a queue. one application adds data in this queue and
another gets data from this queue.
-simple : no server like JMS. (btw if you know some JMS implementation
without a server it could be what I want). could be in a file.
-no data lost if one application crashes. ie if the application which
gets data from the queue crashes, the other can continue to add data to
this queue and the processing will continue without losing data once the
crashed application is restarted.
do somebody know some libs which implements this?
thanks.
- 3
- Reverse order using Struts iterate tag"Bob" <email***@***.com> wrote
> I am fairly new to struts. Is it possible to iterate backward through
> a collection when using the struts iterate tag? We would like to list
> the values in reverse order on the page.
Yes, I've got things listing in reverse date order in my own Struts webapp.
However, I don't think this has anything to do with Struts. <logic:iterate>
and <c:forEach> are going to return the items in whatever order they come
out of the Iterator returned by the Collection's iterator() method.
To make things sort "backwards", you can override the 'compareTo' method
(and probably equals and hashCode, to be completely correct) on the class of
the objects in your collection. Then call Collections.sort with your
Collection. (I think you can also use a Comparator instead of overriding
compareTo, but that's not how I did it. Actually, looking through my code I
think I may have sorted these on the database side before returning the data
to the DAO! But it's still possible.)
Then when you get to the JSP the logic:iterate tag should display things in
reverse order.
Can you post the JSP and let us know what type of objects you have in your
Collection?
--
Wendy in Chandler, AZ
- 4
- Progress bar in JDialogHi all,
I am a new beginner to Java Programming. In my application I am loading
an xml doc in JFrame, while doc is loading I would like to see a
progress bar above the J frame.
This is what I did:
I created a modal JDialog with a progress bar, to be able to show the
dialog above the frame. But if I do that then it freezes the loading of
the xml doc in my Jframe. In other words, only after I close the
JDialog I am able to load the document in my JFrame. Hence, the whole
point of showing a progress bar while loading the document is missed.
How to get over this problem. Can anyone please help.
Any input is greatly appreciated.
Thanks
Nathan
- 7
- Watch NFL Games OnlineWatch NFL Games Online!
For every one who wants to watch the games online because they dont live in the teams town or are at work i found a site that has basically every game covered. Its perfect if you have afford a monthly $70 direct tv nfl access subscription. they got a bunch of channels
The sites http://nflonline.wizhoo.com
- 7
- JMF Manager.createDataSource() and Resource URLsCurrently I am getting a URL from Class.getResource() for a wav file in
the same directory.
So here is what happens:
If I feed Manager.createDataSource from JMF the Resource URL it fails
and says unable to locate Data Source
If I feed Manager.createDataSource a url to a webserver with the same
file it works fine.
How can I work around this?
Dan
- 7
- compression API available in Java & C++?Apologies if this is slightly off-topic ...
I'm looking for a compression algorithm that works better than gzip
for small (12 bytes or so) chunks of data. Ideally there would be a
free implementation for Java and C++ that we could use for commercial
purposes.
Specifically, we are streaming data from a C++ server to a Java applet
and would love to use as little bandwidth as possible.
We're not using any form of compression right now, but the belief is
that gzip works in blocks, so small chunks of data don't get much
benefit. (Anyone disagree?)
--
monique
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
- 7
- java.util.regex - combining paragraphs separated by blank lineI need to write a regular expression to group lines of text separated
by a blank line.
Ex.
Input:
line1
line2
line3
line 4
line 5
line 6
I tried turning on the MULTILINE and DOTALL flags and used the
following pattern:
(.+?)^$
which is close but prepends a newline to the 2nd and subsequent calls
to Matcher.find().
The first line of every paragraph is the same, if that helps.
Regex's are cool, but frustrating....
- 8
- ant inherifRefs & echo for variablesHi! I'd like to see what ant thinks a variable value is.
<echo>${varname}</echo> just shows me the literal '${varame}'. I was
hoping there was some way to resolve it.
The reason I want to do this is that delegate build.xml's don't seem to
be inheriting refs
<ant dir="subfolder" inheritAll="false" inheritRefs="true"/> doesn't
seem to be working for me. I'm trying to pass a class path down to the
build file that actually compiles. Is this possible? Is there a common
pitfall I'm probably falling into?
- 12
- relative paths for properties files in a web appI want to plug an API in to a web app. The API has a properties file
that has properties defining the relative location of particular
files. The questions I have are
1. where should I store such 'particular files', indeed including the
properties file itself - should I manually load them in to the WEB-INF
directory?
and
2. how do I relatively relate to the path of the files located inside
the web app (for example in the WEB-INF) inside the properties file.
I hope that makese sense.
Thanks
- 12
- HTML Parser Help PleaseHi
I am using HTMLEditorKit.Parser class to parse a HTML file. However, I have
found this Swing HTML parser extremely difficult to use.
I am trying to parse a HTML file and extracting specific information from it
into a table. Consider the snippet of my HTML and the table I like it to
generate:
HTML source:
<HTML>
<TITLE></TITLE>
<BODY>
<PRE>
Identifer: ABCDEFG
</PRE>
data: 123456
<PRE>
</PRE>
</BODY>
</HTML>
TABLE:
ABCDEFG 123456
Here is the code I have so far:
import javax.swing.text.*;
import javax.swing.text.html.*;
import java.io.*;
public class HTMLParser extends HTMLEditorKit
{
public HTMLEditorKit.Parser getParser()
{
return super.getParser();
}
public static void main (String[] args)
{
try
{
Reader r = new FileReader("html_file.html");
HTMLEditor.Parser parse = new HTMLParser.getParser()
HTMLEditorKit.ParserCallback cb =
{
public void handleStartTag(HTML.Tag t, MutableAttributeSet
a, int a)
{
if (t==HTML.Tag.PRE)
{
//print whats between the pre tag
}
}
public void handleText(char[] data, int pos)
{
//print whats between the pre tags
}
};
parse.parse(r, cb, true);
}
catch (IOException e)
{
System.out.println(e);
}
}
}
I would appreciate it very much if someone could solve this problem for me.
I tried the sun tutortial, but the examples aren't that clear enough for me.
Thanks
ZOCOR
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.760 / Virus Database: 509 - Release Date: 10/09/2004
- 13
- Eclipse : JCE problemHi,
I have this exception when I launched an application from Eclipse 2.1.
java.security.NoSuchProviderException: JCE cannot authenticate the provider
SunJCE java.lang.NullPointerException
at javax.crypto.SunJCE_b.a(DashoA6275)
at javax.crypto.SunJCE_b.a(DashoA6275)
at javax.crypto.SecretKeyFactory.getInstance(DashoA6275)
at
cms.security.SecurityConfiguration.getSecretKeyFactory(SecurityConfiguration
.java:196)
at
cms.kms.PBEKeyHandlingService.loadValuesFromSecurityConfig(PBEKeyHandlingSer
vice.java:276)
at
cms.kms.PBEKeyHandlingService.<init>(PBEKeyHandlingService.java:114)
at cms.backend.JCECryptoService.<init>(JCECryptoService.java:129)
at services.CryptoService.<init>(CryptoService.java:68)
...
I'm using JDK ver. 1.4.0. I'm have replaced local_policy.jar and
US_export_policy.jar with an unlimited strength version.
However, this exeception is NOT thrown when I launched the same application from
command line. It only happen when I executed it inside Eclipse environment.
Any advice?
TQ
/lim/
- 14
- but *very* apropos] Future reuse of codeLOL!
I enjoyed reading that...
I think "Nihil Software" was a bit of a giveaway... Maybe some of my posts
in the 90s inspired the author <G>.
I hasten to add that this is NOT what we were intending to do with Dulcinea.
Natural language interfaces are not SO hard to write (I wrote one for MS-DOS
that allowed people who didn't like the command line to communicate in
English.) It was distributed by a computer vendor in North Sydney as an
incentive to buy machines from him. He paid me $10 for every machine he sold
with it on...(It was called "IGOR" - Interactive Guide to On-line Running
<G>.) I did it because someone said it couldn't be done, and wasn't really
interested in it as a money maker.
He sold several hundred machines with it on, before Windows 3.1 came out and
blew it all away.... I received mail from people up to 2 years afterwards
saying how much they liked it. (If they asked IGOR about his life he would
give them my e-mail address, as well as an amusing tale of how he escaped
from Frankenstein's lab <G>)
The concept engine would have used a similar Natural Language simulation for
interaction with the User, but it would have no UNDERSTANDING of what the
language meant (apart from keywords which it would act upon).
Nowadays of course, there are some very good Natural Language interfaces and
they are quantum leaps beyond IGOR.
Don't let the fact that a magazine caught you with a hoax, persuade you that
such software will never be developed.
Thanks for posting it, John.
Pete.
"jce" <email***@***.com> wrote in message
news:XOkYa.17847$email***@***.com...
> Here is a classic gotcha from Software Development magazine that I
consider
> appropriate enough to consider sharing.. you are fortunate enough to have
a
> disclaimer on the online version...those of us who read this back then
(and
> are gullible) actually believed it for a moment :-)
>
> http://www.sdmagazine.com/documents/s=819/sdm0204f/
>
> You may have to register but you can make up a name...you could sign up
for
> the free magazine (maybe not in nz) but it's a pretty interesting magazine
> that doesn't take long to flip through.
>
> Here's the intro:
> Once every decade or so, a technology comes along that changes the
software
> landscape, becoming an indispensable part of the developer's life.
Although
> just about every new software concept touts itself as something that will
> "change the way we work," only a handful truly possess such far-reaching
> consequences. One key advance in our field was object-oriented
programming.
> Another is the increasing level of abstraction in the tools that
developers
> use. What shape might the next advance take?
>
> The R&D folks at Nihil Software believe they have the answer. Their
> innovation is called Natural Language Design (NLD), an approach that
enables
> rapid construction of complex software systems using natural (spoken or
> written) language to specify the program. Using this approach, and the
> accompanying tools that Nihil has provided as reference implementations,
you
> can verbally describe the system you want to build and literally see it
> constructed as you speak. That's right, you heard me, no programming.
> Skeptical? Read on.
>
> John (jce)
>
> "Peter E.C. Dashwood" <email***@***.com> wrote in message
> news:email***@***.com...
> > TOP Post only.
> >
> > Dennis,
> >
> > I have believed for some years now that the lack of ARTIFICIAL
> intelligence
> > to generate systems can be compensated for (until it actually arrives
> around
> > 2020...<G>) by putting a Human (or Humans) in the loop.
> >
> > This was revealed to me in a blinding flash of insight (kind of like
Saul
> > on the road to Damascus <G>) when I was trying some new approaches to
> > Project Management and instigated some RAD type workshops. The keys are
> > INTERACTION and ITERATION. Do something, look at it, discuss it,
evaluate
> > it, change it, look at it again and repeat this process for a finite
> period
> > of time or until the desired goal is attained.
>
>
|
| Author |
Message |
Aaron Davies

|
Posted: 2004-2-24 0:45:00 |
Top |
java-programmer, Trouble with KeyListeners in 1.4.2
I'm having trouble using KeyListeners in 1.4.2. I'm writing a graphics
application, and I'd like to change the behavior of some of the tools when
modifier keys are held down. The problem is that I use a JToolBar, which
seems to have grabbed hold of the focus and won't let go. The KeyListener
I've registered with the main JFrame doesn't pick up any events (unless I
comment out the JToolBar).
I found a fix on the boards at java.sun.com which involves registering a
KeyEventDispatcher with the current KeyboardFocusManager, and that does
allow my KeyListener to work, but any *other* KeyEvents fail to propagate
further--i.e., alt-F4 no longer quits the app, the alt-keys for my menu
mnemonics stop working, etc.
What do I have to do to get both shift-key detection and other key commands
working at the same time? I understand there were some changes to the focus
system in 1.4.x that cause these problems, but there doesn't seem to be any
documentation on how to work around them.
Any help is much appreciated.
BTW, here's the code for the KeyEventDispatcher, in case it helps:
DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDisp
atcher(
new KeyEventDispatcher() {
public boolean dispatchKeyEvent(final KeyEvent e) {
processKeyEvent(e);
return true;
} // dispatchKeyEvent
} // KeyEventDispatcher constructor
);
--
Aaron Davies
email***@***.com
|
| |
|
| |
 |
Kleopatra

|
Posted: 2004-2-24 19:49:00 |
Top |
java-programmer >> Trouble with KeyListeners in 1.4.2
Aaron Davies wrote:
> I found a fix on the boards at java.sun.com which involves registering a
> KeyEventDispatcher with the current KeyboardFocusManager, and that does
> allow my KeyListener to work, but any *other* KeyEvents fail to propagate
> further--i.e., alt-F4 no longer quits the app, the alt-keys for my menu
> mnemonics stop working, etc.
no wonder because...
>
> DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDisp
> atcher(
>
> new KeyEventDispatcher() {
>
> public boolean dispatchKeyEvent(final KeyEvent e) {
>
> processKeyEvent(e);
>
> return true;
... unconditionally returning true effectively blocks all further
processing (see api doc).
Not sure if that's the whole story though.
Greetings
Jeanette
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Cig2u Affiliate Program !cig2u.com - Affiliate Program
Cig2u Affiliate Program! Not only does the site look fantastic, but
they offer competitive prices, and as a cigarette affiliate you will
earn 5% on all sales you make. If you find other people to become
cigarettes affiliates, you will also earn 2% of the total sale value
for all sales they make if they sign up through your affiliate link
Cig2u offer both free and express shipping, with the price of express
shipping being extremely competitive within the industry. Login 24
hours a day to check your sales, traffic, account balance and see how
your banners are performing. You can even test conversion performance
by creating your own custom links! Our program is free to join, it's
easy to sign-up and requires no technical knowledge.
http://affiliates.cigarettes--online.com
- 2
- JScrollPaneI have a file displayed in a JTextArea which is in a JScrollPane. When the
window appears, the scroll bar is all the way down, displaying the end of
the file. How can I set it to have the JScrollPane scrolled up to display
the beginning of the file?
_______
Nechama Shuchatowitz
email***@***.com
- 3
- 4
- getting clipboard content as rawdataI am within a java application (swing), and
I would like to get the content of user clipboard as rawdata (binary
byte array) without trying to figure out what flavor it is. I just
need to get the bytes and post them to a server.
(It can part of word doc or xls - server will try to convert that into
an image)
Does that question makes any sens (since I haven't seen a way to do
that within java.awt.datatransfer api) ?
thanks
- 5
- 6
- not getting an error but this code is not working properly.this code is to delete a record from an access database.there is no
error but the record is not getting deleted from database.
please help me in this regard.
thanks in advance.
code:
if(JTCurrentJobTable.getValueAtJTCurrentJobTable.getSelectedRow),JTCurrentJobTable.getSelectedColumn())
!= null){String ObjButtons[] = {"Yes","No"};
int PromptResult = JOptionPane.showOptionDialog(null,"Are you sure you
want to delete the selected record?","Delete
Record",JOptionPane.DEFAULT_OPTION,JOptionPane.ERROR_MESSAGE,null,ObjButtons,ObjButtons[1]);
if(PromptResult==0){stCurrentJob.execute("DELETE * FROM
tblCurrentJob WHERE CurrentJobIndex= " +
JTCurrentJobTable.getValueAt(JTCurrentJobTable.getSelectedRow(),0));
reloadRecord();
JOptionPane.showMessageDialog(null,"Record has been successfully
deleted.","Comfirm Delete",JOptionPane.INFORMATION_MESSAGE);
}
- 7
- Measuring string bounds in headless serverI have a problem with calculating screen string width for the browser
client.
I'm outputting a stream of content type application/vnd.ms-excel and
sending back an XML spreadsheet. (No complaints about using Mc$oft
products, it's what's needed!)
Excel does not autosize columns which contain string data, so the text
columns are the standard Excel width, and the text is wrapped onto about
7 lines. See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexcl2k2/html/odc_xmlss.asp
for details of the XML format.
Excel does allow you to specify the with of a column in points, so I was
using the awt Font classes to calculate the string bounds in pixels. I
explicitly set the resolution to be used to 72dpi by creating a
FontRenderContext with an AffineTransform with a scaling factor of (1.0,
1.0), so that asking the pixel width, gets the point width.
This worked fine testing it on my windoze machine, but on the Unix
server, it's obviously running in headless mode, and anyway, it doesn't
have the Arial font which I'm specifying in my spreadsheet as the font
to use.
Is there any way of calculating the width of a string in points knowing
its font and the point size of the font? You shouldn't need a graphcs
environment, just the font information. I have all the .TTF files, I
could copy them to the Unix machine if Java could use them and do the
calculation.
I hate leaving the user interface looking so shoddy with wrong sized
columns!
It SHOULD have worked in a headless environment according to
http://java.sun.com/j2se/1.4.2/docs/guide/awt/AWTChanges.html#headless
and we are on version 1.4.2_01. It actually blew up in awt code:
java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
at java.awt.Font.initializeFont(Font.java:308)
at java.awt.Font.<init>(Font.java:344)
That's when I'm trying to instantiate a
new Font("Arial", Font.PLAIN, 10);
Any ideas anyone?
- 8
- What are Good Java books?Hi there,
I'd like to buy one or two Java 2 SE books as
text and reference. I need books with good
examples, exercises, projects and solution.
Yes, I know that there are a lot of good
books in the market, but I don't have time to
compare them.
I already have experience in C and C++
programming and a little bit of Java.
Please reply to the group. Thanks a lot.
Jim
- 9
- DDOS Attacks Coming From www.schestowitz.comEver since I visited www.schestowitz.com I have been getting nmaped,
probed, pinged and now DDOS's with floods of requests from an ip
address that resolves to a block assigned to www.schestowitz.com.
I have reported this to my ISP who is now blocking the range from my
trunk.
They in turn have filed a complaint with Catalyst (?) who hosts the
site.
Is anyone else experiencing this kind of a problem or am I the chosen
one?
- 10
- Focus problem on JListHello,
I made a JDialog with two JButton and one JList. I'd like to get the focus
on my Jlist, but it's always the first button (in declaration order) which
has the focus. An actionListener is added to the JButton and I put the focus
on the Jlist by "JList.requestFocus()".
Any idea ?
- 11
- Wrong default encoding on Linux - solvedMac <email***@***.com> wrote:
> On Tue, 30 Sep 2003 14:22:46 +0000, Bernd Eggink wrote:
>> I installed j2sdk1.4.2_01 on several Linux systems running SuSE 8.2.
>> Normally the default file encoding is correctly set to "ISO-8859-1".
>> On one system, however, the installation script assigns the value
>> "ANSI_X3.4-1968" to this property, which causes nasty problems with
>> german umlauts. I can't see any essential differences between this
>> system and the others, although I guess there must be some. Any ideas
>> what that could be?
> This may be more of a linux question than a java question. Maybe that one
> machine has different locale settings or something, and the jdk picks up on
> that either during the installation or at run time.
I found it at last. A library was missing (package 'glibc-locale').
Everything is OK now.
Bernd
--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
email***@***.com
http://www.rrz.uni-hamburg.de/RRZ/B.Eggink/
- 12
- My app runs too slow (lots of code follows)Let me start out by saying that I'm admittedly not a great programmer.
I'm sure that my problems are my own fault and not really Java's. I
have a program that I had originally written in Perl. For various
reasons I decided to rewrite it in Java, but now that I'm nearly done,
I'm not sure if I want to use it because it's very slow and resource
intensive compared to my Perl version.
Quick summary of what the program does: it performs MD5 sums on a
number of files, stores the sums and compares against them on future
runs -- sort of a cheesy tripwire, checks that some processes are
running, checks the contents of a few small files like /etc/passwd,
/etc/shadow, etc. It's strictly a Unix program for me.
My old perl version generally runs the comparisons, checks file
permissions, reads a couple of files, along with reading the last few
minutes of a few logfiles (something I have yet to really implement in
my new Java version, which will make it run even longer, of course) in
less than a second. My java version does it (minus the logfile
reading) in anywhere between 10 and 15 seconds.
Here's my -Xprof output:
Flat profile of 0.74 secs (37 total ticks): process reaper
Thread-local ticks:
100.0% 37 Unknown: no last frame
Flat profile of 0.69 secs (36 total ticks): process reaper
Thread-local ticks:
100.0% 36 Unknown: no last frame
Flat profile of 0.47 secs (24 total ticks): process reaper
Thread-local ticks:
100.0% 24 Unknown: no last frame
Flat profile of 0.79 secs (41 total ticks): process reaper
Thread-local ticks:
100.0% 41 Unknown: no last frame
Flat profile of 10.98 secs (324 total ticks): main
Interpreted + native Method
1.2% 0 + 2 java.io.UnixFileSystem.getBooleanAttributes0
1.2% 0 + 2 java.lang.System.arraycopy
0.6% 1 + 0 java.io.File.getName
0.6% 0 + 1 ssm.FileStat.getOwner
0.6% 0 + 1 java.util.ResourceBundle.<clinit>
0.6% 1 + 0 java.io.BufferedInputStream.fill
0.6% 1 + 0 sun.nio.cs.US_ASCII$Decoder.decodeArrayLoop
0.6% 0 + 1 java.io.FileInputStream.open
5.8% 3 + 7 Total interpreted
Compiled + native Method
34.7% 59 + 1 java.io.ByteArrayOutputStream.write
27.2% 47 + 0 java.io.BufferedInputStream.read
18.5% 32 + 0 sun.security.provider.MD5.transform
1.2% 2 + 0 java.util.Arrays.mergeSort
1.2% 2 + 0 ssm.MD5Sum.loadByteData
0.6% 1 + 0 java.lang.StringBuffer.length
0.6% 1 + 0 ssm.UnixCrypt.D_ENCRYPT
0.6% 1 + 0 java.lang.String.toString
84.4% 145 + 1 Total compiled
Stub + native Method
0.6% 0 + 1 java.lang.System.arraycopy
0.6% 0 + 1 java.io.FileInputStream.readBytes
1.2% 0 + 2 Total stub
Thread-local ticks:
46.6% 151 Blocked (of total)
0.6% 1 Class loader
7.5% 13 Unknown: no last frame
0.6% 1 Unknown: thread_state
Flat profile of 0.00 secs (1 total ticks): Thread-1
Interpreted + native Method
100.0% 1 + 0
java.security.AccessController.getStackAccessControlContext
100.0% 1 + 0 Total interpreted
Global summary of 11.01 seconds:
100.0% 327 Received ticks
0.3% 1 Received GC ticks
0.6% 2 Compilation
0.3% 1 Class loader
46.5% 152 Unknown code
And, because I'm not really sure what to point anyone at, I'll just
attach
the bulk of my code, sorry...
main:=========================================================
import ssm.*;
import java.io.*;
import java.util.*;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
class SystemsSecurityMonitor {
- 13
- Can I create a Thread directlyHI,
Can I create a thread directly and then start it and run it as the code below?
Thread tt = new Thread(); (or Thread tt = new Thread("thread");)
tt.start();
tt.run();
If this is not possible, what is the use of these two methods?
- 14
- references and a binary treeHello,
I am new to Java. I am filling a binary tree with values using a loop,
so when I need to descend one node deeper at the end of the loop, I
use node=node.right for example. Consider this pseudo code:
//...
while(1) {
node=new Node(new Leaf(),null);
node=node.right;
}
I thought that the node variable will contain reference after this
operation. But it does not, because when I look at the root of the
binary tree, it does not get filled any further after the
node=node.right operation.
So my question is, what actually happens in the node=node.right , I
tought that it should be only copying the references, not the values.
I coded the same in c++ and instead of references I used the pointers
and it worked right as I expected.
- 15
- Univernsal IDIt seems to me any sort of ID that can be forged for under $500 is
worse than useless. Any serious bad guy can easily afford fake id.
For everyone else it is just a hassle if they forget their id.
In our past anonymity was not a right. Everyone knew everyone in the
village/tribe. You could not easily do wrong without others knowing
it was you.
If we got serious about a Universal ID, what are its characteristics?
1. costs over $1,000,000 to forge.
2. not useful to anyone other than the true owner.
3. can be scanned in under a second.
4. cannot be scanned without permission from the owner.
5. Should not need to be replaced unless lost. Additional photos
could be digitally added as you age.
6. it should be useful as a credit/debit card, id card, door key,
proof of age, link to medical records. It might even capture most of
the information needed to compute your taxes in a way that the
government has to believe you.
7. It would have to be based on encryption technology and digitally
signing information such as DNA, retinal patterns, fingerprints,
photo.
It might be reasonable to design such a card presuming the card will
have the CPU and memory of a laptop running Java.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
|
|
|