 |
 |
Index ‹ java-programmer
|
- Previous
- 1
- Derived class & objects to parent constructorI've worked around this problem but it's still bugging me a bit so I
thought I'd ask here. In a derived class, I wanted to hold a reference to
a newly created object passed to a parent constructor. The only public
constructor in the parent requires this argument and the parent provides no
methods to later retrieve it. I couldn't find a syntax that would compile.
I'm thinking it's not possible but just wanted to confirm that I wasn't
missing something.
class someobject {}
class parent {
public parent (someobject so) { }
}
class child extends parent {
// someobject so = new someobject(); // Doesn't work
public child () {
// someobject so = new someobject(); // Also doesn't work
super (new someobject ()); // Want to hold a reference
// to someobject in child
}
}
Thanks in advance for any answers.
Doug
- 1
- benchmarks? java vs .netOn Tue, 03 Jun 2008 16:18:34 +0100, Jon Harrop <email***@***.com>
wrote:
>There is no merit in comparing unoptimized code on .NET with optimized Java.
That's why posted it here so you can "optimize it". You fixed
mandelbrot but C# is still twice slower in three other benchmarks:
binarytrees
(the command line argument should be -server -Xms64m binarytrees)
http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=binarytrees&lang=javaxx&id=2
vs
http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=binarytrees&lang=csharp&id=0
revcomp
http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=revcomp&lang=javaxx&id=4
vs
http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=revcomp&lang=csharp&id=2
sumcol
http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=sumcol&lang=javaxx&id=4
vs
http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=sumcol&lang=csharp&id=0
also, C# significantly slower in recursion
http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=recursive&lang=javaxx&id=0
vs
http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=recursive&lang=csharp&id=0
>I have seen is on the Mersenne Twister PRNG where Java is 2x slower than .NET.
Post the benchmark. Let me see...
- 3
- 6
- Question about help systemIs there a quick way to find out information about a particular method when
one doesn't remember to which class it belongs?
Thaks
- 6
- Portal Solutions for developersHello everyone,
For easy to use web clipping and application clipping tools and portal
development follow the link below:
http://clickmarks.com/solutions/portlet_solutions/portlet_factory.html
Cheers.
- 7
- java.lang.NoClassDefFoundError: org/aspectj/lang/SignatureHi,
Can anyone help me for this exception which I am getting whil trying to
conenct to MYSQL server thru TOMCAT.
Thanks
Maneesh
org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver
class 'com.mysql.jdbc.Driver', cause:
java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:730)
at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:518)
at foo.DBTest.init(DBTest.java:23)
at org.apache.jsp.test_jsp._jspService(test_jsp.java:51)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
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:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:595)
- 7
- Why braces around try/catch?In article <3f3393b6$0$150$email***@***.com>,
Jos A. Horsmeier <email***@***.com> wrote:
>
>I beg to differ; catch clauses are optional as in --
>
> try {
> // some statements making
> // up the statement block
> }
> // no catch
I'm not sure what you mean. If I compile the above I will get a
compile error along the lines of
'try' without 'catch' or 'finally'
Cheers
Bent D
--
Bent Dalager - email***@***.com - http://www.pvv.org/~bcd
powered by emacs
- 7
- JNDI/LDAP and PagedResultsControlI've encountered something that has stumped me for the past 2 days.
Perhaps someone on this list has seen this before or can explain why
this might be happening. I'm trying to use the SortControl and
PagedResultsControl classes that are part of the JNDI/LDAP Booster
Pack. In the code below, you can see that I create the 2 Control
object, stick them in an array, and set them as "request controls" for
the LdapContext. Thankfully, both the search and the sort controls do
the right thing - the items come out sorted with a page size of 10.
My issue is trying to get the "response controls" associated with
invoking the search() method on the LdapContext. According to the
JNDI JavaDocs, the getResponseControls() method "Retrieves the
response controls produced as a result of the last method invoked on
this context" (which in my case is the search() method). If I execute
a getResponseControls() call on the LdapContext immediately after the
search(), it returns null. However, after MUCH agonizing I figured
out that if I walk over the enumeration of results returned from the
search() method and do a getResponseControls() afterward, the proper
Control object array is returned (one for the SortControl and one for
the PagedResultsControl). I noticed that this was the common element
in code snippets I found on the Web that worked.
Can someone please explain to me why I have to walk through this
enumeration? I also verified that you have to walk over the entire
enumeration, not just an element or 2. Specifically, the hasMore()
method has to be called to get this to work. If I create a for loop
and walk through my page set (say 10 elements) and then try to get the
response controls, they're still null. It only works when hasMore()
returns false. This is really driving me bonkers?
Thank you in advance for anyone who can help me here!
String sortBy = "sn";
int pageSize = 10;
byte[] cookie = null;
int total;
Control[] requestControls = new Control[]
{
new SortControl(new String[]{sortBy}, Control.CRITICAL),
new PagedResultsControl(pageSize)
};
LdapContext ldapContext = new InitialLdapContext(environment, null);
ldapContext.setRequestControls(requestControls);
NamingEnumeration results = ldapContext.search(contextName,
searchFilter, searchControls);
//IF I DON'T WALK OVER THIS ENUMERATION, THE RESPONSE CONTROLS OBJECT
IS NULL
while(results != null && results.hasMore())
{
SearchResult entry = (SearchResult) results.next();
}
Control[] responseControls = ldapContext.getResponseControls();
if(responseControls != null)
{
for(int i = 0; i < responseControls.length; i++)
{
if(responseControls[i] instanceof PagedResultsResponseControl)
{
PagedResultsResponseControl p = (PagedResultsResponseControl)
responseControls[i];
cookie = p.getCookie();
total = p.getResultSize();
}
}
}
else
{
System.out.println("response controls is null");
}
ldapContext.close();
- 8
- Constraints in JPA (using Hibernate)Hi,
I have some @Entitys in JPA with Hibernate which create the following
relationship:
Brand 1<->* User
User 1<->* CreditCard
(where 1<->* means a bidirectional one-many relationship)
I want to be able to put a constraint on the CreditCard entity such
that the field CreditCard.CreditCardNumber is unique for a particular
Brand.
Without adding a reference to Brand in the CreditCard entity, is there
a way that I can achieve this?
Thanks in advance for any pointers!
Rich
- 9
- Difference between Abstract class and interfaceHi,
Can you let me know the difference between Abstract class and
interface. I did research on the topic and found it helpful. Well, the
refined question I have is
1. Is there any difference between abstract class for which all the
methods are declared abstract and then an interface. I know that with
interface, multiple inhertiance can be achieved.
Can you please tell me in object tree/method invocation view.
thanks in advance
- 9
- Tomcat + Eclipse setupI have a brief question about my Tomcat config. I try to place the
webapps folder structure inside my Eclipse project strutcure, but
outside the Tomcat home directory. Example:
c:\Eclipse\MyProject
c:\Java\Tomcat\webapps
In order to do so I set in the server XML:
<Host name="localhost" debug="0"
appBase="c:\Eclipse\MyProject" unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
mywebapp.xml:
<Context path="/mywebapp" docBase="c:\Eclipse\MyProject\mywebapp">
Question: I would expect mywebapp.war to be automatically unpacked
when I place it in c:\Eclipse\MyProject (it's the appbase). That's the
way it works when I leave the webapp dir unchanged (inside tomcat
home). However, it does not work when I set the dir outside the tomcat
home dir.
Any hints would be appreciated.
Regards HW
PS: Tomcat 5.0.25 on Win2k
- 13
- JSP Tomcat link directoryes from 2 projects, help pleaseHi Everyone,
I have 2 Tomcat jsp projects which use many common directoryes. I wont
the directory from the second project linked to a directory from the
first, so I can change files on a single place. When I use something
like $ln -s ../project1/visualization ./visualization
and then make request from mozilla I get the error The requested
resource (/visualization/grid.jsp) is not available.
Any ideas
- 15
- [ANN] Scala 2.5.0-RC2 releasedWe are pleased to announce version 2.5.0-RC2 of the Scala distribution:
| Scala smoothly integrates features of object-oriented and |
| functional languages and is fully interoperable with Java |
It fixes several bugs found in RC1.
http://www.scala-lang.org/downloads/changes.html#v2.5.0-RC2
Other release candidates may follow this version depending
on bugs reported by the Scala community (no changes/additions,
only bug fixes!); the final release (aka. 2.5.0-final) is
planned in 1-2 weeks.
Bye
-- Stephane
- 16
- Multiple server access jdbc/servletIf I have an applet, which is donwloaded to the local machine from server
A, and calls a servlet on server B.....can that servlet, via JDBC, access a
database on server C, assuming each of server's A, B and C are on separate
machines with separate URLs ?
Thanks, Ike
- 16
- hai dearhai friends,
"each day is a new adventure to dream search and discover"
www.goodhistory5.blogspot.com
|
| Author |
Message |
Duane Bozarth

|
Posted: 2005-8-25 23:59:00 |
Top |
java-programmer, Not debugging?
Phlip wrote:
>
> Duane Bozarth wrote:
>
> >> The define "legacy" as "requires debugging".
> >
> > That's a bizarre (at best) definition of "legacy"...
>
> That's why Greg didn't understand why I used it like that.
I didn't either (and still don't) because it has nothing whatsoever to
to w/ "legacy" or not...
> Me: Strive to never debug.
>
> Greg: What about blah blah blah.
>
> Me: You are using something that you can't design
> fresh from scratch to resist bugs. So you must
> run the debugger more often than greenfield code
>
> Greg: It's not "legacy" it's embedded blah blah blah
In that sense everything is "legacy" -- I can't redesign a commercial
compiler, either.
...
> Just don't leave the emulator out of the loop. Greg implied using it would
> slow down the tail end of development.
At some point in most embedded systems, that <is> true...you get to a
point at which the depth of emulation required isn't worth the effort
that would be required. Once at that point, reverting is rarely
productive use of resources.
|
| |
|
| |
 |
Duane Bozarth

|
Posted: 2005-8-25 23:59:00 |
Top |
java-programmer >> Not debugging?
Phlip wrote:
>
> Duane Bozarth wrote:
>
> >> The define "legacy" as "requires debugging".
> >
> > That's a bizarre (at best) definition of "legacy"...
>
> That's why Greg didn't understand why I used it like that.
I didn't either (and still don't) because it has nothing whatsoever to
to w/ "legacy" or not...
> Me: Strive to never debug.
>
> Greg: What about blah blah blah.
>
> Me: You are using something that you can't design
> fresh from scratch to resist bugs. So you must
> run the debugger more often than greenfield code
>
> Greg: It's not "legacy" it's embedded blah blah blah
In that sense everything is "legacy" -- I can't redesign a commercial
compiler, either.
...
> Just don't leave the emulator out of the loop. Greg implied using it would
> slow down the tail end of development.
At some point in most embedded systems, that <is> true...you get to a
point at which the depth of emulation required isn't worth the effort
that would be required. Once at that point, reverting is rarely
productive use of resources.
|
| |
|
| |
 |
Phlip

|
Posted: 2005-8-26 13:04:00 |
Top |
java-programmer >> Not debugging?
George Neuner wrote:
> In principle you're right ... but it's rarely that simple.
Yes it is. You are considering the harder task of retrofitting
acceptance-level tests to the outside of finished APIs. Not the simpler and
more direct task of writing tests that fail so you can write a line or two
of behavior to pass them.
> I support testing and assertions wherever possible, including
> intra-procedure if there is some meaningful test that can be done on a
> partial result - but testing line by line is ridiculous. It may be
> extremely difficult or quite impossible to figure out what would
> happen if a particular line of code is wrong or missing.
That's why you run the test and ensure it fails for the correct reason,
before writing the code to pass the test. The test doesn't have to be
exact - it doesn't need to constrain your code to only one possible new line
[or two]. You write more tests until all of them constrain.
> It's also
> unwieldy because such tests frequently can't be batched but must be
> executed in-line due to following code altering the test conditions.
Design-for-testing implies you have just a little more API, and you use it
to detect these intermediate states. The requirement to write tests first
makes such API adjustments easier.
> I didn't agree with this "line by line proof" approach in 1981 when
> Gries proposed it in "The Science of Programming" and I don't agree
> with it now. YMMV.
That was probably something different, and TDD is not a "proof" system.
> I use to do image processing in which the processing was a dependent
> chain of fuzzy logic. All the possible answers were wrong in some
> absolute sense - and the object was to find the answer that was least
> wrong. If I missed a minor step or had a bug in a calculation
> somewhere, the chances are I wouldn't be able to tell by looking at
> the intermediate results.
Right. Such tests can be very fragile and hyperactive. Hence, run them
_more_ often, and if they fail unexpectedly use Undo to back out your
change, then think of a smaller change that doesn't change an irrelevant
side-effect. Tests that constrain too much are better than ones you run
infrequently.
--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
|
| |
|
| |
 |
Peter Ammon

|
Posted: 2005-8-26 13:29:00 |
Top |
java-programmer >> Not debugging?
Phlip wrote:
> Tim X wrote:
>
>
>>I'm guessing he was referring to the irritating development of
>>programmers who are not able to debug code without a high level IDE
>>which includes a debugger which allows them to step/trace through the
>>code one line at a time and watch what happens to variables in a watch
>>window.
>
>
> No. I'm talking about developers who don't write unit tests as they write
> code. These provide the option of using Undo, instead of debugging, when the
> tests fail unexpectedly.
>
> This leads to a development cycle with highly bug-resistant code, and
> without proactive debugging to implement new functions.
>
> Yes, you still need the debugger - typically for legacy situations - and you
> still need elaborate debugging skills. New code stays ahead of them.
>
> The idea that we can implement without debugging is incomprehensible to most
> programmers. But that really is what I meant.
I've been waiting for someone to make this claim about unit testing.
Guess I'll pick on you :)
I don't believe that unit testing eliminates debugging. I'll give a
real life example.
We had a bug where an update to our library disabled some features of a
client program. After some investigating, it was determined that the
client program was doing this:
if (library_version == 3)
instead of this:
if (library_version >= 3)
Our fix for this bug was to detect the client and report 3 for the
version if the client was the offending program, and otherwise report
the true version.
This is the sort of bug that gets caught in integration testing. I
can't think of any way that unit testing would have helped this
situation. I'd be very interested in hearing how this sort of bug would
be approached in the test-first "no debugging" philosophy.
-Peter
--
Pull out a splinter to reply.
|
| |
|
| |
 |
Phlip

|
Posted: 2005-8-26 14:32:00 |
Top |
java-programmer >> Not debugging?
Peter Ammon wrote:
> I've been waiting for someone to make this claim about unit testing. Guess
> I'll pick on you :)
Oh goody 'cause I didn't claim it. [I think.]
> I don't believe that unit testing eliminates debugging. I'll give a real
> life example.
Some TDD authors prevaricate and say "/virtually/ bug free". My emphasis. I
prefer to prevaricate more accurately and usefully.
TDD produces bug-resistant code, with reduced the odds of long bug hunts.
The kind that typically require debugging and/or trace statements.
> We had a bug where an update to our library disabled some features of a
> client program. After some investigating, it was determined that the
> client program was doing this:
>
> if (library_version == 3)
>
> instead of this:
>
> if (library_version >= 3)
>
> Our fix for this bug was to detect the client and report 3 for the version
> if the client was the offending program, and otherwise report the true
> version.
TDD works in tiny steps. Upgrading a library is a big step (and another
"legacy" situation). Fortunately, your tests let you roll back to the
previous library version for frequent sanity checks (and emergency
releases), until you debug the situation.
> be approached in the test-first "no debugging" philosophy.
There is no test-first "no debugging" philosophy. Test cases make an
exquisite platform for debugging. For example, in VB[A] I use Debug.Assert
in a test case, and failure raises the debugger. Then I move the current
execution point back to the called method, step inside it, fix the code to
pass the test, and resume running the remaining tests.
Without TDD, this is the Unholiest of Unholies - programming in the debugger
to generate spaghetti code. With TDD, it's nothing more than leveraging your
tools effectively.
When people use TDD, they generally report surprise that the incidences of
_punitive_ debugging, with absolutely no other recourse, go way down. And
some teams (in greenfield projects with user-level code) indeed never turn
on their debugger, and code for years without it.
--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
|
| |
|
| |
 |
dalamb

|
Posted: 2005-8-27 3:34:00 |
Top |
java-programmer >> Not debugging?
In article <email***@***.com>,
George Neuner <gneuner2/@comcast.net> wrote:
>On Thu, 25 Aug 2005 01:24:01 GMT, "Phlip" <email***@***.com> wrote:
>
>>
>>If you can think of the next _line_ of code to write, you must perforce be
>>able to think of a complementing test case that would fail if the line were
>>not there. Just make writing the test case part of writing that line.
>>
>
>In principle you're right ... but it's rarely that simple.
>
>I support testing and assertions wherever possible, including
>intra-procedure if there is some meaningful test that can be done on a
>partial result - but testing line by line is ridiculous. It may be
>extremely difficult or quite impossible to figure out what would
>happen if a particular line of code is wrong or missing. It's also
>unwieldy because such tests frequently can't be batched but must be
>executed in-line due to following code altering the test conditions.
You left out the important sentence in Phlip's original where he said "It's
not white box testing." From this I deduce he's talking about providing
inputs to the unit (method), not adding lines of code to what's being tested.
There remains the problem of "figuring out what would happen if a particular
line of code is wrong or missing". Once again I plead ignorance of TDD
(thankfully Phlip is kind to me when I make mistakes!), but it seems to me
that Phlip is talking about the simplest form of "test coverage" which gives
us two tests for "if A and B then S" -- one for if true, one for if false.
There are more complex forms of coverage such as checking all possible
combinations of truth values, and others which look at number of repetitions
of loops (somewhere I have an old reference to an article defining a hierarchy
of test coverage approaches, which I will try to find if anyone needs it). It
seems to me that the line-by-line approach would have to suffer from the same
limitations as test coverage: number of test cases grows exponentially as the
program gets longer and more complex. I suppose "small methods" helps limit
that problem, but isn't it still present?
--
"Yo' ideas need to be thinked befo' they are say'd" - Ian Lamb, age 3.5
http://www.cs.queensu.ca/~dalamb/ qucis->cs to reply (it's a long story...)
|
| |
|
| |
 |
Greg Menke

|
Posted: 2005-8-28 5:23:00 |
Top |
java-programmer >> Not debugging?
"Phlip" <email***@***.com> writes:
> Greg Menke wrote:
>
> >> You describe a legacy situation - someone else invented this bizarro
> >> hardware, and legacy situations require debugging to learn their
> >> characteristics.
> >
> > No I don't. I describe a realtime system- or even a simple device
> > driver. There are lots of those, new and old.
>
> The define "legacy" as "requires debugging".
Bizarre.
> > Say you wrote some subsystem on this embedded system, and you
> > implemented some kind of test framework to help you get it as
> > functionally debugged as possible. What you've tested is your inputs,
> > outputs and algorithms work in an fairly abstract and simplistic
> > situation. Thats helpful for first order easy debugging, but you're
> > going to be doing it the hard way along with everybody else once the
> > software is on the hardware and some of the unknown idiosyncracies of
> > the system start showing up. More of the unknown idiosyncracies will
> > appear over time. And at this stage, your emulator is pretty much
> > useless because nobody cares about what it says when the real thing is
> > sitting in the lab & thats were the bugs are.
>
> This sounds like the code went through an emulation phase and then a real
> thing phase.
Nope- went through breadboard designs of the hardware using inputs &
outputs first from emulation hardware and eventually from the real
hardware. The breadboard designs are used to work up hardware and
software designs and implementations, feeding back changes & bugfixes,
etc into the evolving specs. Ideally, the working software meets the
working hardware later on in the project. Low fidelity emulation is
pretty handy for easier classes of bugs early on; mismatched or unpacked
structs, endian stuff, etc.. But race conditions and pathological i/o
states (the harder problems) often depend on the real hardware in the
real operating environment (maybe interrupt timing changes because
capacitors & clocks drift when the system goes below freezing, for
example).
> Ideally, I would configure one button on my editor to run all tests against
> the emulator, then run all possible tests against the hardware. If the code
> fails in the hardware I would trivially attempt to upgrade the emulator to
> match the fault, so the code also fails with the emulator. But this is
> speculation, and of course it won't prevent the need to debug against the
> hardware.
Neat. Who's going to pay for the emulator (build it & prove that it
matches the hardware- and keep it matching) when we also have to do the
real system?
Now one place that emulators are really handy are for working up smaller
subsystem elements; ie logic in a single fpga or related fpga's- then
excercising the i/o is a bit easier.
>
> Realistically, you are apparently relentlessly testing, and admittedly in a
> "legacy" situation that prevents you from using tests to make the hardware
> more bug resistant. Carry on!
>
We don't get many opportunites to make hardware more bug resistant. If
software discovers a discrepancy in the documented interface we can
sometimes get fixes back into hardware, but it has to be well proven.
Early in the hardware lifecycle its easier to get changes to the
interface specs, but later on the software people pretty much have to
lump it.
Gregm
|
| |
|
| |
 |
Phlip

|
Posted: 2005-8-28 8:19:00 |
Top |
java-programmer >> Not debugging?
Greg Menke wrote:
>> Then define "legacy" as "requires debugging".
>
> Bizarre.
Then define "foo" as "frequent punitive open-ended debugging causing
occassional schedule risk". Some teams use "legacy" as a casual shorthand
way to say "foo". Please substitute my definition for "foo" wherever I wrote
"legacy", so we can address the actual points raised.
> Nope- went through breadboard designs of the hardware using inputs &
> outputs first from emulation hardware and eventually from the real
> hardware. The breadboard designs are used to work up hardware and
> software designs and implementations, feeding back changes & bugfixes,
> etc into the evolving specs. Ideally, the working software meets the
> working hardware later on in the project.
Sorry to interrupt; why is that "ideal"? Does the software match up even
later sometimes?
> Low fidelity emulation is
> pretty handy for easier classes of bugs early on; mismatched or unpacked
> structs, endian stuff, etc.. But race conditions and pathological i/o
> states (the harder problems) often depend on the real hardware in the
> real operating environment (maybe interrupt timing changes because
> capacitors & clocks drift when the system goes below freezing, for
> example).
As you stated before, in that space you often must research the nature of
faults, and that research will occupy significant development time.
>> Ideally, I would configure one button on my editor to run all tests
>> against
>> the emulator, then run all possible tests against the hardware. If the
>> code
>> fails in the hardware I would trivially attempt to upgrade the emulator
>> to
>> match the fault, so the code also fails with the emulator. But this is
>> speculation, and of course it won't prevent the need to debug against the
>> hardware.
>
> Neat. Who's going to pay for the emulator (build it & prove that it
> matches the hardware- and keep it matching) when we also have to do the
> real system?
In my experience, many teams are too busy doing "foo" because they did not
carefully plan a development environment that reduces the odds of "foo". I
suspect your team does have a good development environment, so we may be
talking past each other now.
But that's no reason to stop!
--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
|
| |
|
| |
 |
Greg Menke

|
Posted: 2005-8-28 20:30:00 |
Top |
java-programmer >> Not debugging?
"Phlip" <email***@***.com> writes:
> Greg Menke wrote:
>
>
> > Nope- went through breadboard designs of the hardware using inputs &
> > outputs first from emulation hardware and eventually from the real
> > hardware. The breadboard designs are used to work up hardware and
> > software designs and implementations, feeding back changes & bugfixes,
> > etc into the evolving specs. Ideally, the working software meets the
> > working hardware later on in the project.
>
> Sorry to interrupt; why is that "ideal"? Does the software match up even
> later sometimes?
I'm not proposing that it is. But theres not much alternative to
something like that when both the hardware and software are being
developed.
> > Low fidelity emulation is
> > pretty handy for easier classes of bugs early on; mismatched or unpacked
> > structs, endian stuff, etc.. But race conditions and pathological i/o
> > states (the harder problems) often depend on the real hardware in the
> > real operating environment (maybe interrupt timing changes because
> > capacitors & clocks drift when the system goes below freezing, for
> > example).
>
> As you stated before, in that space you often must research the nature of
> faults, and that research will occupy significant development time.
And for these hard problem, you have to test with the real thing because
any emulator is going to miss some (many) of these subtle issues. For
the many easy bugs, an emulator (or maybe simulator) makes a good deal
of sense, but its no panacea.
> >> Ideally, I would configure one button on my editor to run all tests
> >> against
> >> the emulator, then run all possible tests against the hardware. If the
> >> code
> >> fails in the hardware I would trivially attempt to upgrade the emulator
> >> to
> >> match the fault, so the code also fails with the emulator. But this is
> >> speculation, and of course it won't prevent the need to debug against the
> >> hardware.
> >
> > Neat. Who's going to pay for the emulator (build it & prove that it
> > matches the hardware- and keep it matching) when we also have to do the
> > real system?
>
> In my experience, many teams are too busy doing "foo" because they did not
> carefully plan a development environment that reduces the odds of "foo". I
> suspect your team does have a good development environment, so we may be
> talking past each other now.
How do you reduce the chances of bugs by writing an emulator thats as
least as complicated as the real system, and that is essentially
guaranteed to have different & unknown bugs which will limit its
fidelity at some ill-defined point? Do you really think that teams
working on systems like this don't spend a lot of time trying to
minimize the opportunities of bugs showing up? There is lots of
code-reuse, walkthroughs, reviews, etc... on both the hardware and
software- emulators and simulators where feasible; for example, opnet
may be used to evaluate task and network schedulability in all sorts of
circumstances before the software is even started.
As we speak, I'm helping deal with a crash-on-reset problem on the
production hardware that doesn't happen on the development hardware,
plus weird edac behavior to go along with it. Analyzing this problem
requires a top to bottom analysis of the system will all sorts of
inter-team documentation of whats going on. How is an emulator going to
help here? At best it will exhibit the same problems (but we still
don't know what the problems are), at worst it will not duplicate the
behavior. It hasn't gotten us any closer in the former case, in the
latter its worse because project management is now nervous because its
presenting another difference from the real system yet they're (supposed
to be) relying on it to help them test.
Now if you're talking about a high-level app that can afford to ignore
hardware issues, then a low-fidelity emulator doesn't have to address
the hard problems and so offers greater coverage.
Gregm
|
| |
|
| |
 |
Phlip

|
Posted: 2005-8-29 0:56:00 |
Top |
java-programmer >> Not debugging?
Greg Menke wrote:
> As we speak, I'm helping deal with a crash-on-reset problem on the
> production hardware that doesn't happen on the development hardware,
> plus weird edac behavior to go along with it. Analyzing this problem
> requires a top to bottom analysis of the system will all sorts of
> inter-team documentation of whats going on. How is an emulator going to
> help here?
The outer topic is your development environment. Yours is resisting this bug
as we "speak".
(You also had few opportunities to _prevent_ the bug.)
The inner topic is an emulator.
> At best it will exhibit the same problems (but we still
> don't know what the problems are), at worst it will not duplicate the
> behavior.
Here's a completely unrelated topic. When you use "make menuconfig" to build
Linux, you get a zillion options for all kinds of hardware peripherals. You
can freely mix and match all the options, and build a stable Linux.
How could Linux possibly be stable if you activate some combination of
options that nobody ever activated before? The odds increase as you plug in
weird hardware combinations.
The answer is those combinations are not a zillion opportunities for bugs,
they are a zillion forces against bugs. Each cross-constraint, passing its
tests, reduces the odds of bugs in parallel situations. Constraint spaces
with a high number of dimensions are naturally sparse, so a viable Linux
kernel can only exist in very few states.
I would prefer code that passed both emulation tests and tests in real
hardware. Cross-testing is good, even when the emulator doesn't exactly
match the hardware. Sometimes it's good _because_ they don't match. Run such
tests more often.
There are indeed many reasons why an emulator might not be ideal for every
kind of embedded situation.
In _theory_, for each bug you debug in the hardware, you should force the
emulator to exhibit the same bug before killing it.
The decision to do that should be per-bug, not per-emulator.
> It hasn't gotten us any closer in the former case, in the
> latter its worse because project management is now nervous because its
> presenting another difference from the real system yet they're (supposed
> to be) relying on it to help them test.
Ah, so you are exposing your managers to implementation details.
Pay no attention to the little emulator behind the curtain!
--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
|
| |
|
| |
 |
Ray Dillinger

|
Posted: 2005-8-31 23:32:00 |
Top |
java-programmer >> Not debugging?
Greg Menke wrote:
> "Phlip" <email***@***.com> writes:
>>Greg Menke wrote:
>>>Ideally, the working software meets the
>>>working hardware later on in the project.
>>Sorry to interrupt; why is that "ideal"? Does the software match up even
>>later sometimes?
> I'm not proposing that it is. But theres not much alternative to
> something like that when both the hardware and software are being
> developed.
Forgive me for asking, but if you are part of a team that is
developing both specialized hardware *and* software to run on
it, don't you have an accurate emulator in the first place in
your HDL file for the new hardware? I mean, if you're
designing the hardware, you've got the design in a Hardware
Description Language (such as VeriLog) and your HDL
development environment will support some excruciatingly
exact simulations that you can test software against.
At least, I've never seen a Verilog environment that didn't
have a simulation mode you could test software against.
Bear
|
| |
|
| |
 |
rem642b

|
Posted: 2005-9-3 11:29:00 |
Top |
java-programmer >> Not debugging?
> From: Russell Shaw <email***@***.com>
> You can only write tests before the code if you are very familiar
> with what you want and have thought about it for hours/days/weeks.
I disagree with most of that.
When unit-testing single lines of code, the test consists of two parts,
the data going in, and the data going out. The data going in is already
there before I write that one line of code to deal with it. The data
going out is immediately checked by eye upon executing that one line of
code. No hours/days/weeks of prior thought are necessary to perform
that single-line unit test.
When unit-testing single functions, the input part is already there
before even the first line of code is written, which is long before the
function is put together. The output part is already there immediately
after the last line of code is tested, which is immediately before
putting the function together. That's for the first unit-test for that
function. Other unit tests are then constructed immediately after
running the first unit test. The whole bunch of them are finished a few
minutes after the function is put together. No hours/days/weeks of
prior thought are necessary to set up and perform those single-function
unit tests.
> In the process of making the solution of a very tedious problem clear
> to me, i can do a *lot* of throwing away of code and refactoring for
> weeks at a time. The amount of extra churn from rewriting unit tests
> would be hopeless.
I don't see it that way. I test just about every single line of code,
and every function, regardless of whether it's a brand-new function or
a refactoring of something. Unit testing is no burden, it's how I make
sure my code works before I move to writing the next part of my code.
> Write code that works, then write unit tests to make sure it
> keeps working.
So you don't test your code until after you're sure it's working?
How can you be sure it works when you havne't yet tested it??
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- constructor inheritance/overriding?If I have a base class with some over-loaded constructors
that perform significant work before calling the
"main" constructor, what is the best way of achieveing
the same set of constructors in a sub-class?
e.g.
class B {
B(A a) {
... lots of stuff ...
}
B(D d) {
this(get an A from the d);
}
B(S s) {
this(get an A from the s);
}
}
class E extends B {
E(A a) {
super(a);
addition 'E' specific code
}
}
How do I implement E(D d), and E(S s)?
As I understand things, constructors are not inherited (unlike C++),
so I do need an explicit implementation of each constructor. But the
"obvious" minimal implementation:
E(D d) {
super(d);
}
would call B(D d), which would then call B(A a).
Thus the extra 'E' specific code would NOT be called.
I don't (unless I must) want to expose the inner workings
of the other constructors in 'B', for reasons of data hiding
and code maintainance.
This question must have arisen before, but my googling failed
me.
Anyone have a solution?
BugBear
- 2
- IDE for JFSWhat IDE you would recommend for JSF based J2EE development using JBOSS
AS.?
- 3
- jikes dependenciesHi,
I try to find all the dependencies of a class file (which are the
class to recompile when I modify just one java file).
According to Jikes website, "C depends on D if and only if the
constant pool for C contains a reference to D".
So, for a particular class, E, I found with Jikes the following
dependencies :
A, B, C, D.
At the same time, I used the BCEL library from apache to have a look
at the constant pool and I just find references to the class A, B and
C.
The class C is a parameter of one method of my class E and the class C
implements the interface D.
I understand why the class E depends on the class D.
Is the Jikes assertion incomplete or should I understand "C depends on
D (and all its ancestor/interfaces) if and only if the constant pool
for C contains a reference to D" or maybe even "C depends on D (and
all its dependencies) if and only if the constant pool for C contains
a reference to D"??
Thanks for your help.
Eric Deshayes
- 4
- exe within a jar fileI want to package and run an exe within an executable jar file. I've
tried using the getClass().getResource("relative/exe/location"), but
receive the following error when running the jar
java.io.IOException: CreateProcess:
jar:file:\E:\test\TestProgram.jar!\myexe.exe error=2
this occurs when I run the following code:
Runtime rt = Runtime.getRuntime();
Process proc =
rt.exec(this.getClass().getResource("/myexe.exe").toString());
I would appreciate any help or suggestions on the subject. We've
considered extracting it an running it from a temp location and
cleaning up the directory, but we would like to avoid this. Thanks!
- 5
- Linking native libraries in Win2KHi there,
I'm trying to get some 3rd party "Kit" working and I'm struggling
with a java.lang.UnsatisfiedLinkError.
What I use is IBM's Visual Age 3.5.3 (JDK1.2.2) and the library in
question is IBM's OnDemand 7.1.0.7.
What I did was to copy all the DLLs and INIs etc. from the
"IBM\OnDemand Web Enablement Kit" into my WINNT\system32 folder -
where they should be found by any app, because it is listed in my
PATH.
However, I get an UnsatisfiedLinkError and I don't even know which
library it is actually looking for, as the stack trace
java.lang.UnsatisfiedLinkError
java.lang.Throwable()
java.lang.Error()
java.lang.LinkageError()
java.lang.UnsatisfiedLinkError()
int com.ibm.edms.od.ArsWWWInterface.initialize(java.lang.String,
int)
int com.ibm.edms.od.ArsWWWInterface.initialize(java.lang.String,
int)
int com.ibm.edms.od.ArsWWWInterface.init(java.lang.String, int)
void com.ibm.edms.od.ODServer.initialize(java.lang.String,
java.lang.String)
does not really help and I found when trying to catch this and dump
the name of the library was "null".
I somehow can't believe I'm the first one to struggle with this.
Any help is greatly appreciated.
Thanks,
Martin
- 6
- focus gained received twice for the same buttonI have two buttons in a JPanel (default FlowLayout), which is nested in a
BorderLaout panel's SOUTH slot. The panel implements a FocusListener, and
I'm using the focus gained event to as follows:
/**
* 1) To ensure the next widget, if it has selectable contents (i.e.,
like a JTextField),
* has it's content completely selected.
* 2) To update the status bar with any tool tip text.
*
* @param event
*/
public void focusGained(FocusEvent event)
{
Component c = event.getComponent();
// debug
getStatusHandler().setStatus(c.getClass().getName());
// displayToolTipText( (JComponent) c);
if(c instanceof JTextField) {
((JTextField) c).selectAll();
}
}
For some reason, when the last button in the panel has the focus, it takes
two tabs to get it off. While there is no visual indication after the first
tab as to where the focus is, the debug trace I put in is displaying that
the Component in the focusGained method is still a JButton. The only
modification I made to the KeyboardFocusManager is to add the ENTER & shift
ENTER keys to the forward and backward traversal keys.
Thanks in advance,
- Eric
- 7
- algorithm - how to estimate time to completeNot a problem as such, just a question about estimating time for producing
algorithms.
I recently had to write a class with a method that was to convert digits
(int) into their 'word' representation.
To begin with, converting say, 234, into "two three four", was easy enough.
But the method was also to 'sound english'
So, 234 now had to be converted to:
"two hundred and thirty four"
Some other examples:
"six million, three thousand and fifty six"
"six billion and one"
"eight billion,six million, three thousand, fourhundred and fifty six"
(like the way a person may write on a cheque underneath the digit amount.)
I wrote such a method. (which was actually a little more invoved than this
as it supports currencies, floating point number etc;) But, only after badly
underestimating the time involved for me to do so. There were were a few
elemenst about it that were not so obvious until I sat down to write it. I
ended up scratching a lot of stuff down on paper, and wrote it 3 times till
I was happy with it.
I have two questions here:
What is the best way to estimate time for rather small tasks like this? How
to you determine if a job will take an hour, a day, or a week? I know it
seems like a silly question - but I am just keen to see what sort of
responses come back from it.
Secondly, how long do you think it would take you to write a method such as
this? Personally, I allowed an hour and a half, and, like I said, was badly
mistaken. I know I took longer because I trivialised the problems till I ran
into them in live code, but still, it took way longer than I expected. (It
took me a whole day and a bit of the next day)
TIA
- 8
- addRow error when further editing is doneHi All,
Quick question (hopefully an easy answer).
Using JBuilderX--a GUI with a JTable component, I click a button
calling a method that adds a new row to a TableDataSet table in the
Database. This code in a datamodule class method:
openIMTable();
DataRow item = new DataRow(imTable);
item.setString("COLUMN1", "SOME TEXT");
imTable.addRow(item);
Returning to the GUI, the row is visually added, everything is fine.
The new row is highlighted in the JdbTable component. I click on an
empty column field in the new row and type some info--press Enter and
get the following error message: "Unable to set value because could
not post or leave row 0". If I select a different row with the mouse
and then reselect the "new" row I can add other fields with no
problem.
What am I missing?
TIA
Mark
- 9
- Castor XML Question: How to ignore wrapping elementsI have an xml file that looks something like:
<Response>
<Invoice>
<PrimaryKey>239</PrimaryKey>
<OrderTotal>5893.03</OrderTotal>
</Invoice
</Response>
I am trying to map <Invoice> to my Invoice.java class. How do you get
Castor to ignore the outer <Response> tag? I could always do
pre-processing, but I would like to know if it's possible to do this
in the mapping xml file.
Thanks,
Ankur
- 10
- How to start default browser when clicking on a labelHi,
I was wondering how I can implement a JLabel that references to a http link.
When I click that label the default browser should open and loading the webpage.
This is for a JDialog 'About' window.
I've seen this several times, but I've no idea how to implement this with
Java/Swing.
Regards,
Helmut
- 11
- A bafflement moment on enumI have written enum code that works, but suddenly I had a sinking
feeling that it has no business working. I did a little disassembling
and sorted out the mystery.
let's say I create an enum with method next().
Then I override the next() method with custom code in the various
enum constants.
These methods live in anonymous inner classes of the enum (though
oddly they decompile as static).
Then I do something like this:
Breed d = Breed.DALMATIAN;
d.next();
How on earth does Java know to use DALMATIAN.next() rather than
Breed.next()?
The answer is that d contains a reference to the DALMATIAN inner class
that EXTENDS the Breed enum class as well as being an inner class of
it. So the next() method overrides the one in the Breed class.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
- 12
- struts action quiestionHello,
I have a short question concerning struts action context stack. I have 3
views. View A, B and C
To view C, I can get from view A, or B. In view C I have button "BACK",
Whenever I click BACK button, I want to go back to page that called view C
(A od B).
Is there any way to do it (remember calling view), or I have to implement my
own context stack mechanizm ?
thank you,
fera
- 13
- "error: cannot read:" (use the list file name written in a file)Hello:
When I compile the java source using command
javac javatest\kernel\*.java
it's perfectly work
but I have a lot of source code and distribute over many directories
So I write a file that contains:
javatest\data\*.java
javatest\kernel\*.java
...
names this file as "makefile.txt"
and use the command
javac @makefile.txt
but I got a error
error: cannot read: javatest\data\*.java
please help me
Eric Chen
- 14
- (J2ME) CLDC1.0 and equalsIgnoreCase?When I try to compile a class using this method under WTK2.5 with a
CLDC1.0 target, I get:
cannot find symbol
symbol : method equalsIgnoreCase(java.lang.String)
location: class java.lang.String
The source compiles fine under JRE 1.5 and I can't see any mention
that equalsIgnoreCase was only added in CLDC1.1. Is the method not
available or am I doing something wrong? Thanks.
- 15
|
|
|