| Connecting to MS SQL problems |
|
 |
Index ‹ java-programmer
|
- Previous
- 2
- Creating class gives "cannot find symbol" errorHelp! I'm trying to do a simple program, where the user is prompted to
input the number of dimensions to specify for a box; then, 1 of 3
classes of box() are implemented:
0 dimensions // then box box1 = new box();
1 dimension // then box box1 = new box(len);
3 dimensions // then box box1 = new box(len, wid, ht)
but when I compile, I get the message:
Z:\Chapter 08\box.java:107: cannot find symbol
symbol : variable box1
location: class box
System.out.println(box1.toString());
The class assignments are done within an if statement (the commented
switch structure also gave me an error, something about how box1 is
already assigned, when it gets to the second case.)
My code is below - any help is greatly appreciated.
**********************************************************
import java.util.*;
import java.io.*;
public class box
{
public static double len, wid, ht, larger;
public static double largerlen, largerwid, largerht;
static String outmsg;
static Scanner console = new Scanner(System.in);
static char dimen;
public double boxVol(double len, double wid, double ht)
{
return len * wid * ht;
}
public double boxArea(double len, double wid, double ht)
{
return (2 * len * wid) + (2 * len * ht) + (2 * wid * ht);
}
public void makeLarger(double larger)
{
this.len = this.len * larger;
this.wid = this.wid * larger;
this.ht = this.ht * larger;
outmsg = "After each dimension is multiplied by " +
String.format("%.2f",larger)
+ ", the box measurements are:\n";
}
public void makeLarger(double largerlen, double largerwid, double
largerht)
{
this.len = this.len + largerlen;
this.wid = this.wid + largerwid;
this.ht = this.ht + largerht;
outmsg = "After length is increased by " +
String.format("%.2f",largerlen)
+ ",\n width is increased by " +
String.format("%.2f",largerwid)
+ ",\n and height is increased by " +
String.format("%.2f",largerht)
+ ",\n the box measurements are: \n";
}
public String toString()
{
String str = "";
str = "Box dimensions:\n"
+ "Length = " + String.format("%.2f",len)
+ " Width: = " + String.format("%.2f",wid)
+ " Height = " + String.format("%.2f",ht) + "\n";
str = str + "Area = " + String.format("%.2f",boxArea(len, wid, ht))
+ " Volume = " + String.format("%.2f",boxVol(len, wid, ht));
return str;
}
public static void main (String[] args) throws FileNotFoundException
{
System.out.println("This program will calculate the dimensions of a
box based on the\n"
+ "values you enter.");
System.out.println("Enter the number of dimensions you want to
specify:\n:"
+ "0 for no dimensions specified (default of 1) or\n"
+ "1 for the same dimension to be applied to all 3 (len, wid, ht)
or\n"
+ "3 to specify each individual dimension\n");
dimen = console.next().charAt(0);
if (dimen == '0')
// switch (dimen)
// {
// case '0':
{
box box1 = new box();
}
// break;
else if (dimen == '1')
{
// case '1':
System.out.println("Enter the length of the box:");
len = console.nextDouble();
box box1 = new box(len);
// break;
}
else
// case '3':
{
System.out.println("Enter the length of the box:");
len = console.nextDouble();
System.out.println("Enter the width of the box:");
wid = console.nextDouble();
System.out.println("Enter the height of the box:");
ht = console.nextDouble();
box box1 = new box(len,wid,ht);
}
// break;
// }
System.out.println(box1.toString());
System.out.println("-----------------------------");
System.out.println();
System.out.println("Enter one value to multiply each dimension by:");
larger = console.nextDouble();
box1.makeLarger(larger);
System.out.println(outmsg);
System.out.println(box1.toString());
System.out.println();
System.out.println("=============================");
System.out.println("Enter a value to add to the length:");
largerlen = console.nextDouble();
System.out.println("Enter a value to add to the width:");
largerwid = console.nextDouble();
System.out.println("Enter a value to add to the height:");
largerht = console.nextDouble();
box1.makeLarger(largerlen,largerwid,largerht);
System.out.println(outmsg);
System.out.println(box1.toString());
System.out.println();
System.out.println("=============================");
}
public box()
{
this.len = 1.0;
this.wid = 1.0;
this.ht = 1.0;
}
public box(double len)
{
this.len = len;
this.wid = len;
this.ht = len;
}
public box (double len, double wid, double ht)
{
this.len = len;
this.wid = wid;
this.ht = ht;
}
}
- 2
- Doubt!!!The method request.getParameter searchs parameter type String and if
will have type Integer?
Conversion of type or serialisation?
- 2
- Java/SQL Developer for a 12 month contract opportunity in Albany, NYPalladian Consulting is seeking a Java/SQL Developer for a 12 month
contract opportunity in Albany, NY. This is a new state agency
position, there is no incumbent.
Start date after contract awarded 9/2/2008
Must submit for consideration to project by 6/10/2008
Candidates must posses the following background:
MANDATORY Requirements:
1. A minimum of four (4) years experience developing in Oracle or
Sybase,
specifically database design, testing and implementation. This
includes
the development of technical database documentation.
2. A minimum of four (4) years SQL experience.
3. A minimum of two (2) years experience in Java IO, specifically
reading
and writing files.
4. A minimum of two (2) years experience coding in Java Database
connectivity (JDBC) to connect to databases.
5. A minimum of two (2) years experience writing Java applications.
DESIRABLE Experience Listed in order of importance:
1. Experience with working with Sybase ASE SQL server version
11.0 or higher or Oracle 9 or higher.
2. Experience in writing C programs and the ability to reverse
engineer existing C programs in order to develop program
specifications.
3. Experience in coding using Java Foundation Classes (JFC)
Swing
technology.
4. Experience in Perl HTML programming.
5. Experience in working with mathematical formulas and
calculations
(financial.
To be considered please contact me immediately at:
Robin Marsh
Palladian Consulting
949-681-8016
email***@***.com
- 4
- strange netbeans glitch not finding java classes
I've just had something strange happen to me in Netbeans 6.1.
I was editing a file when, all of the sudden, Netbeans became unable
to find things like java.awt.event.MouseEvent and java.lang.Runnable.
I have never seen anything like this before. Does anyone have
experience with that kind of thing? Any suggestions?
My guess is that somekind of behind-the-scenes updater or something
ran and broke something (why anyone thinks that behind-the-scenes
processes that modify your computer environment are a good idea is
beyond me). I've re-installed Java and am in the process of re-
installing Netbeans. Anything I should look for?
Gary
- 4
- 6
- "Java everywhere" is for world domination - Server-side work is passe!luke: BORRRRRRRRING......the most interesting initiatives are
happening on the client side - in small wireless devices such as
cellphones and smartphones, where J2ME has become the de facto
standard for application development.
Article from Javaworld.com:
"Java everywhere is for world domination"
http://www.javaworld.com/javaworld/jw-08-2003/jw-0822-wireless.html?
Some quotes:
- As smart wireless device shipment far exceeds PC shipment this year,
the Windows PC is no longer the de facto client platform. In a keynote
speech delivered to Microsoft developers in March 2003, Bill Gates
likened today's wireless market to the "early days of Windows," where
there are huge opportunities for profits and new jobs, and no dominant
player. The opportunity for Java to become a truly ubiquitous
end-to-end platform has finally come.
- What is "Java everywhere"? In technical terms, "Java everywhere" is
a single-architecture, end-to-end solution. The Java platforms on the
server side (Java 2 Platform, Enterprise Edition, or J2EE), client
side (Java 2 Platform, Standard Edition and Micro Edition, or J2SE and
J2ME), and inside embedded devices (J2ME and JavaCard) share the same
basic language features, API designs, libraries, and even development
tools. The value proposition of "Java everywhere" for developers is to
maximize productivity and allow existing developers to enter emerging
markets without extensive retraining.
- As announced at JavaOne, Java runtimes are built into more than 150
devices from more than 20 manufactures. All five major cell phone
manufactures have committed to the Java platform. In addition to
manufacturer support, Java has also gained widespread support from the
wireless carrier community.
- A major effort has been made to support games on J2ME handsets.
Mobile entertainment has proven to be an extremely profitable sector.
In Europe, simple ring-tone download has generated $1.4 billon in
revenue last year. In comparison, the entire global J2EE server market
is $2.25 billion. J2ME games are content rich, over-the-air
downloadable, and micro-payment-enabled. The J2ME gaming sector is
projected to grow explosively and create many new Java jobs in the
next couple of years. In fact, J2ME games are already the second
largest revenue source for Vodafone's content service.
email***@***.com (luke) wrote in message news:<email***@***.com>...
> PC magazine tested five Java (J2EE) app servers (Websphere, BEA
> Weblogic, SunONE, Oracle and the open source JBOSS) as well as
> Microsoft's .NET (using Windows 2003 Server).
>
> BEA's J2EE appserver Weblogic was the number one choice
> IBM's J2EE appserver Websphere was the close second choice.
> JBOSS trailed the pack, with Oracle, .NET, Sun making up the middle.
>
> There's also a case study why a shop chose IBM's Websphere over .NET
> and others (runs on Linux, etc).
>
> Some comments:
>
> - Choosing Microsoft means giving up cross-vendor compatibility, and
> you'll have to forget about running servers on Linux.
>
> - Unlike solutions from BEA and IBM, .NET doesn't offer the
> reliability and security needed for enterprise Web service deployment
>
> - The .NET path offers fewer options in building business logic and
> database components. Microsoft has no official blueprint for business
> objects comparable to Enterprise JavaBeans (EJB), though it recommends
> best practices on the Web (www .microsoft.com/resources/practices).
> The .NET developers have to devise their own component models based on
> these practices, while a J2EE developer just needs to run a wizard to
> get EJB.
>
> - While it is easier to field a .NET solution quickly, the rigidity of
> the EJB specification ensures that large-scale development projects
> can enforce best coding practices and design rules. But this
> stringency comes at the cost of more difficulty for the average
> developer to master. .NET makes development and deployment very easy,
> yet it requires extensive customization if you want to build a
> mission-critical environment in which reliability, transaction
> integrity, and message queue management are essential.
>
> - If your company chooses to develop mission-critical applications in
> .NET, you'll find yourself at Microsoft's mercy regarding upgrades,
> licenses, and support.
>
> http://www.pcmag.com/article2/0,4149,1218682,00.asp
- 6
- Capturing output from a commandI think I may have bitten off more than I can handle here but I thought it
would be interesting to try to write a Java program to parse my firewall log
and do traceroutes on all the IP addresses. I've done pretty well with it
so far, but the command that I am using, while it runs fine from the dos
prompt does not do what I expected it to when I run the code in my class.
Here is the method I have written to do the traceroutes. Basically, there's
an input file containing IP addresses and an output file where I store the
results.
I hate the way OE formats things when they come from Text Pad.
The line where I show what is executing is showing me a command that works
in the dos command window but the file I'm writing to does not
get created when the program runs.... Can anyone give me any ideas why not?
public static void traceIPs(String fileName, String outFileName)
{
if ((fileName == null) || (fileName == ""))
throw new IllegalArgumentException();
String line;
String command;
try
{
BufferedReader in = new BufferedReader(new
FileReader(fileName));
if (!in.ready())
throw new IOException();
while ((line = in.readLine()) != null)
{
try
{
command =
"C:/WINDOWS/system32/tracert.exe " + line + " >> " + outFileName;
System.out.println("Executing:
" + command);
Process tracert_proc =
Runtime.getRuntime().exec(command);
InputStream cmdout =
tracert_proc.getInputStream();
int x;
while (( x = cmdout.read())
!= -1)
{
//System.out.print(x);
}cmdout.close();
} catch (IOException e)
{
System.out.println("I died" +
"\n");
}
}
in.close();
}
catch (IOException e)
{
System.out.println(e);
}
}
- 8
- XML Xalan error on linuxHI all,
I'm getting a tedious problem under linux, using xalan.
[The resource [ org.apache.xml.serializer.XMLEntities ] could not be
found]
at org.apache.xml.serializer.CharInfo.<init>(CharInfo.java:290)
I can't understand what is wrong, since on windows works just fine...
please help me!
Any kind of help would be really appreciated.
GG
- 10
- Natural Language --> Integer ValueHere is a program which generates the integer value of natural language
numbers, e.g. nine hundred twenty eight million two thousand fourteen
--> 928,002,014. The next step is to write a dataset for solving simple
word problem.
http://cypher.monrai.com
Here's the info on the release:
http://blog.monrai.com/2006/08/release-070.html
Cheers,
Sheman
- 11
- setting a new layoutHi all!
I have an applet(the loader applet) that adds another applet (the subapplet)
to itself. I want this subapplet to be able to draw to the screen, so i make
a new border layout for this subapplet. When I load the loader applet, it
loads the subapplet fine, it calls all methods from the subapplet (even the
paint method), but it draws nothing to the screen? Does anyone know what im
doing wrong here:
<snippet from the loader applet>
Class clas = Class.forName(Subapplet);
sub = (Applet)clas.newInstance();
sub.setStub(stub);
//sub.setLayout(getLayout()); doesn't seem to work correctly only draws a
very small square for subapplet
sub.setLayout(new BorderLayout());
add(sub, "CENTER");
//doLayout(); doesn't seem to do anything
//addNotify(); doesn't seem to do anything
sub.init();
sub.start();
Thanks in advance!
Matthijs Blaas
- 12
- 7000 real time software industry interview question ebook....DO not miss it7000 real time software industry interview question ebook....DO not
miss it
================================================================================================
C# and ASP.NET projects book
Download full C# and ASP.NET projects ebook , Covers projects like
Chat application , Job Site application , Accounting module and lot
more with Full SDLC , Estimation , Design documentation and proper
test plans. http://www.questpond.com/
===============================================================================================
.NET Interview Questions Book Index
Introduction , Basic .NET Framework , NET Interoperability ,
Threading , Remoting and Webservices , Caching Concepts , OOPS ,
ASP.NET , .NET Architecture , ADO.NET , SQL SERVER , UML , Project
Management
http://www.questpond.com/#Introduction
===============================================================================================
SQL Server Interview Questions Book Index
Database Concepts , SQL , .NET Integration , ADO.NET , Notification
Services , Service Broker , XML Integration , Data Warehousing/Data
Mining , Integration Services/DTS , Replication , Reporting Services ,
Database Optimization , Transaction and Locks
http://www.questpond.com/#Database%20Concepts
================================================================================================
JAVA Interview Questions Book Index
OOPS and CORE JAVA , Threading , Servlets and JSP , JDBC , EJB ,
Struts , XML and Web Services , JNI , Project Management , UML
http://www.questpond.com/#OOPS_and_CORE_JAVA
===============================================================================================
Software testing interview question Index
Software Testing Basics, Testing techniques, Software process,CMMI,SIX
sigma, Metrics Automation testing ,
Testing estimation and lot http://www.questpond.com/#Software%20Testing%20Basics
===================================================================================================
Software estimations
Do not know how estimations are done here's a complete book on it
http://www.questpond.com/HowtoPrepareSoftwareQuotations.zip
================================================================================================
- 13
- Changing menuitem selection L&F
Hi,
I would like to change the Look&Feel of the
menuitem selection. I know I can change the
backcolor via the following attribute..
MenuItem.selectionBackground
But I would also like to customize it in other
ways, like for instance creating a thin border
around it, or in any other way.
My question is where would I do this? Is it in
the menuitem's paint method, or somewhere else?
I've scanned the Internet with no luck.
Cheers,
Robert Karlsson
- 15
- parallel to HttpServletRequest.getParameterHttpServletRequest.getParameter lets a Servlet analyse a list of URL
encoded parm=values sent to it by an Applet.
I would like to do the reverse. Does this logic exist free standing
anywhere for use in an Applet to analyse a list of parameters sent to
it by a Servlet?
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
- 16
- Java vs. .NETWhat are the pros and cons of Java?
How does Java measure up to .NET in terms of speed?
How about in terms of depth of classes?
I am looking for garbage collection while at the same looking for speed.
Java and .NET seem to be the only two application platforms offering
both, any suggestions?
Thanks all!!
- 16
- Strange behavior with weak referencesContent-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8Bit
Hi folks,
Here's a code snippet showing some strange behavior with weak
references. We insert five strings (also tested with other types) into a
WeakHashMap, while keeping a reference to only the fifth string in a variable
called 'save'. The problem is, if we DO NOT set the value of 'save' to null
before assigning to it, the size of the WeakHashMap is reported as 0 at the
end of execution. If we DO set the value of 'save' to null before assigning to
it, the size of the WeakHashMap is reported as 1 at the end of execution. This
happens consistently over several dozen runs using Java 1.4.1_02 on Linux.
What gives? I can see no reason for this behavior. Any insight would be
appreciated.
Cheers,
-Nick
import java.util.*;
public class crap
{
public static void main (String a[])
{
// If save is NOT set to null, the WeakHashMap will have 0
// items at the end of the run. If save IS set to null, the
// WeakHashMap will have 1 item at the end of the run. WTF?
String save; //= null;
// build the map
WeakHashMap map = new WeakHashMap();
for (int i = 0; i < 10; i++)
{
String s = "a" + i;
// hold a reference to one of the strings we created so
// that it shouldn't be GC fodder later.
if (i == 5)
{
save = s;
}
map.put (s, new Integer(i));
}
// everything should still be in the map
checkMap ("BEFORE", map);
// try to force GC to occur
generateTrash ();
// at least 1 thing should be left in the map
checkMap ("AFTER", map);
}
private static void checkMap (String label, WeakHashMap map)
{
System.out.println (label + ": SIZE:" + map.size());
}
private static void generateTrash ()
{
ArrayList list = new ArrayList();
for (int i = 0; i < 1000000; i++)
{
list.add (new Integer(i));
}
System.out.println ("Took out trash");
}
}
Content-Type: text/x-java; name="crap.java"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="crap.java"
import java.util.*;
public class crap
{
public static void main (String a[])
{
// If save is NOT set to null, the WeakHashMap will have 0
// items at the end of the run. If save IS set to null, the
// WeakHashMap will have 1 item at the end of the run. WTF?
String save; //= null;
// build the map
WeakHashMap map = new WeakHashMap();
for (int i = 0; i < 10; i++)
{
String s = "a" + i;
// hold a reference to one of the strings we created so
// that it shouldn't be GC fodder later.
if (i == 5)
{
save = s;
}
map.put (s, new Integer(i));
}
// everything should still be in the map
checkMap ("BEFORE", map);
// try to force GC to occur
generateTrash ();
// at least 1 thing should be left in the map
checkMap ("AFTER", map);
}
private static void checkMap (String label, WeakHashMap map)
{
System.out.println (label + ": SIZE:" + map.size());
}
private static void generateTrash ()
{
ArrayList list = new ArrayList();
for (int i = 0; i < 1000000; i++)
{
list.add (new Integer(i));
}
System.out.println ("Took out trash");
}
}
|
| Author |
Message |
Luke Webber

|
Posted: 2004-5-20 7:08:00 |
Top |
java-programmer, Connecting to MS SQL problems
"yelp666" <email***@***.com> wrote in message
news:email***@***.com...
>
> Hi all,
> I am trying to connect to MS SQL Server installed on my computer, I
> follow the tutorial, that can be downloaded from sun's web page, but it
> doesn't work. Whatever I try, I get the seme error:
>
> ODBC Driver Menager: Unable to locate the name of data origin, and
> there are no default drivers.
>
> My code:
>
>
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> String url = "jdbc:odbc:Northwind";
> java.sql.Connection con = java.sql.DriverManager.getConnection(url,
> "test", "krowa");
>
> I appreciate any help.
I would recommend that you use the JTDS JDBC driver instead of JDBC.
http://jtds.sourceforge.net/
Luke
|
| |
|
| |
 |
kaeli

|
Posted: 2004-5-20 20:20:00 |
Top |
java-programmer >> Connecting to MS SQL problems
In article <email***@***.com>, yelp666.16iso1
@mail.codecomments.com enlightened us with...
>
> My code:
>
>
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> String url = "jdbc:odbc:Northwind";
> java.sql.Connection con = java.sql.DriverManager.getConnection(url,
> "test", "krowa");
>
> I appreciate any help.
>
You forgot to register the driver with DriverManager.
--
|
| |
|
| |
 |
Eric

|
Posted: 2004-6-12 6:43:00 |
Top |
java-programmer >> Connecting to MS SQL problems
This is from the sun tutorial:
"You do not need to create an instance of a driver and register it with the
DriverManager because calling Class.forName will do that for you
automatically. If you were to create your own instance, you would be
creating an unnecessary duplicate, but it would do no harm.
When you have loaded a driver, it is available for making a connection with
a DBMS. "
What you likely have not done is go to the ODBC data source manager in the
Control Panel and create a new ODBC data source connected to the SQL Server.
If you create a data source name SqlSvr1 and set the default db to
Northwind, then use the con url "jdbc:odbc:SqlSvr1" to get the connection.
"kaeli" <email***@***.com> wrote in message
news:email***@***.com...
> In article <email***@***.com>, yelp666.16iso1
> @mail.codecomments.com enlightened us with...
> >
> > My code:
> >
> >
> > Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> > String url = "jdbc:odbc:Northwind";
> > java.sql.Connection con = java.sql.DriverManager.getConnection(url,
> > "test", "krowa");
> >
> > I appreciate any help.
> >
>
> You forgot to register the driver with DriverManager.
>
>
> --
> --
> ~kaeli~
> She was engaged to a boyfriend with a wooden leg but broke
> it off.
> http://www.ipwebdesign.net/wildAtHeart
> http://www.ipwebdesign.net/kaelisSpace
>
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Continuing downloadingHello,
I should implemed a serverside application that allows clients to
download files. If client's donwload breaks, application should remember
how much and what file client was downloading and then continue downloading
from breaking point to end of the whole download.
What could be the nicest way to implement this?
Should my serverside application store download information to database
(e.g. if downloading needs authentication) and delete download information
from database when download is completed succesfully.
If there is no authentication how should it then be handled.
Any suggestions?
Cheers
jn
- 2
- Reflection problem (parameter subtypes)Hi All,
I believe this has been answered before but I didn't find an answer to
my question, so here we are:
I am using reflection (Class.getMethod()) to find a method of a class
and execute it.
Let's assume I have the following class:
class A
{
public void v(B b)
}
I want to get (and later invoke) v .
This works fine when I am using an instance of B as parameter:
A.class.getMethod("v",new Class[]{B.class});
Whoever, when I try to user a Subclass of B, getMethod fails.
So, let's assume
class C extends B
{
[...]
}
The call
A.class.getMethod("v",new Class[]{C.class});
will fail with a NoSuchMethodException.
Am I doing something wrong, or, if this is just the way reflection
works, any suggestions for workarounds?
Thank you
Daniel
- 3
- Regarding Eclipse Properties WindowHi all,
There had been a lot of discussion regarding eclipse, I would like to
clarify a question which I am trying for last few months in different
forums.
We had created an Eclipse plugin, using the defulat available properties
WINDOW, so that in the top pane when we select something, the properties are
displayed in the bottom right pane. It works funtastic.
When we mevoed to Eclipse 3.0, we have seen that this is not the case. The
properties window will not by default show the properites, instead, the user
need to expand it explicitly.
Anyone solved such an issue, please advise and help. Thanks for your time,
Warmest regards,
Ravi
- 4
- Constant list of strings and numbersHi!
Is it possible to make a constant list of lists of strings and numbers
in Java?
I know that I could make an 2D array of Objects and store String and
Integer objects in it. But that could make a list unnecessary big
and I will need to cast all those elements to proper objects when
accessing them.
Something like:
... = {{"string 1", 1, 2, 3}, {"string 2", 1, 2, 3}, {"string 3", 1, 2, 3}}
Mike
- 5
- JTable Model reset Vector?I have a sigleton class (eg : A), which uses a class(eg : B, reusable-
display objects in table, a tableModel private scope).
Each time I want to enter in the class I need to clear the model.
But it is private (m_vector)
Is is correct to offer a public method to clear the model.? (eg :
m_vector.remove()).
- 6
- Kill Thread Within Java.exe Process
I am monitoring a java application (running as a Windows service) from
a third party.
psinfo shows me all threads, and I noticed there were two that have
been running over 9 hours. It was about 9 hours ago that CPU
utilization on my Windows 2000 Server went up to 50%.
I know I use pskill to stop the entire java.exe -- but is there an
external command or program I can write to kill an individual thread
inside a java.exe ?
- 7
- Javadoc: generating HTML API docsI am working as a technical author with some developers who have
written some Java packages.
I want to generate API docs similar to the ones distributed by Sun --
HTML format using frames. Click on the class name and the info is
displayed.
Is it possible to do all this using javadoc, or do I need some other
tools.
Links to tutorials etc. are welcome.
Bruce
- 8
- CFP OWASP AppSec Conference - Oct 11-12 Call for Participation
The Open Web Application Security Project (OWASP) annual conference is
less than three weeks away, October 11-12. Registration is open.
http://www.owasp.org/conferences/appsec2005dc.html
Paul E. Black (email***@***.com) 100 Bureau Drive, Stop 8970
email***@***.com Gaithersburg, Maryland 20899-8970
voice: +1 301 975-4794 fax: +1 301 926-3696
http://hissa.nist.gov/~black/ KC7PKT
- 9
- Java overriding bug?The code below prints Good Bye and false. Why it does not print Mary and true?
(If you change the var declaration to B obj = new B() - it works fine. )
class A {
public boolean b_flag=false;
public String str_Flag="Hello";
}
class B extends A {
public boolean b_flag=false;
public String str_Flag="Good Bye";
public String toString(){
return "B.toString() String:" + str_Flag + "B: boolean: " + b_flag;
}
}
public class VariableOverridingTest {
public static void main(String[] args) {
A obj = new B(); // Prints Good Bye and false. Why?
// B obj = new B(); // Prints Mary and true
obj.str_Flag="Mary";
obj.b_flag=true;
System.out.println(obj);
}
}
- 10
- javax.scripting, Rhino, and creating sandboxes...I'd like to be able to control the interaction between my script and
the host Java environment. Most specifically, if I don't explicitly
allow something, it shouldn't be available to the script context.
Is there an easy-and-sure way to do that? Do I need to go through the
trouble of setting up a SecurityManager? Can I get away with a
"clever" Bindings implementation? I'm mostly interested in Rhino,
which comes shipped with the JDK 1.6, but if there is a general
approach, that'd be great too.
Thanks,
Daniel.
- 11
- abstract interfacesHi !
In a Java test I noticed code like:
abstract interface IDummy
{
// ......
}
This should trigger a compiler error. Interfaces are abstract
by definition. It is pointless to define an abstract one. Am I right
or not ?
Regards,
Razvan
- 12
- FibrillationIn a previous article, email***@***.com said:
>I just wrote a StateChanged listener to ensure people entered valid
>dates by changing the max value on the day field on the fly and
>corralling errant values back into range.
>
>It occurred to me this might fibrillate. In other words, me setting
>the field triggers an StateChangedEvent which causes me to change the
>field which triggers another StateChangedEvent.
Make sure you don't actually set the field if it isn't going to change.
That will avoid the StateChangedEvent. I had the same problem with trying
to constrain text in a text field to only be integers - if it's already
integers, I don't change it.
--
Paul Tomblin <email***@***.com>, not speaking for anybody
I used up all my sick days, so I'm calling in dead.
- 13
- constructor is invisible? - jdom - format classHi all
I am trying to ouput some XML. I read the XMLOutputter
API(http://www.jdom.org/docs/apidocs/org/jdom/output/XMLOutputter.html),
and the contructor indicated that I can pass in a Format object.
So, I try to do this
Format XMLOutFormat = new Format();
XMLOutFormat.setIndent(" ");
XMLOutFormat.setLineSeparator("\n");
outputter = new XMLOutputter(XMLOutFormat);
However, the compiler says "the constructor Format()" is not visible.
How do I instantiate a Format object then? Please advise.
Thanks.
Howard
- 14
- applet initialisation in IE7Hi,
When using IE7 to browse to a site that uses a Java applet in Vista 32 Home
Premium the site will stall for about 20 seconds while the applet is
initialised. Once initialised the issue is gone unless the browser is closed
in which case Java has to initialise again.
It didn't happen when I used IE7 or IE6 in XP or any time with Firefox, so I
was wondering if it's a known issue or just my setup?
Here is an example site that uses Java and displays the initialisation stall
in my setup...
http://www.internetfrog.com/mypc/speedtest/
Cheers in advance
Andy
- 15
- Short Java Quine.Remove any line-breaks, and this becomes a quine.
enum Q {a("enum Q{a(%c%s%c);Q(String
t){System.out.printf(t,34,t,34);System.exit(0);}}");Q(String
t){System.out.printf(t,34,t,34);System.exit(0);}}
Just thought I'd share.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
|
|
|