 |
 |
Index ‹ java-programmer
|
- Previous
- 1
- writing java daemon server: start and stopDear everyone,
I am trying to write a server program to do some monitoring.
I am using Windows 2000 platform.
I've seen that there is some server program can start server by
specifying command like "server start" and stop it like "server stop".
I am wondering how to do it in java language since java is running in
the JVM.
1. Is it prossible to send signal to kill the process just like c lang
?
2. Do java have process ?
3. How about if java thread can be killed by those deprecated method
like thread.stop(), can I find the current running thread and stop it
?
4. Any suggested method to do the server stop which can stop the
current running java program in JVM ?
Thank you for helping
Calvin
- 1
- want to sort tables inside a complex mechanism, what can be the approach?I have a situation where first we are fecthing some ids(list of say
version ids using hibernate form database)
then keeping those list of data in a Pager Object(Paging mechanism
displays 100 rows per page out of complete sa 100 or so.)
This pager class does two things one takes whole list of ids
(Collection of version_id).
(Every time based on search criteria it changes. For searching in
hibernate values are hardcoded. Want modification with minimal changes
as many things are interrelated here.)
and other thing it checks no. of contents based on that displays data
per page(100 here).
It means stores all data from database and send it oage by page.(First
thing to notice)
Next all this is getting stored in Report page where it searches other
column names based on ids(version_id) the other column names are
getting changed for different requests so what we do is take all other
columns collectAllExtraFields(this is also getting changed everytime
based on what is getting searched.)
Now all this is getting accumulated while displaying but as we know
what to display we hardcoded all fields required to display based on
search. But all fields are searched based on the id fetched from
database first time which Pages is storing.
like this
Search for product user information & retrun results in the form of a
paged table for components used by specific product
ComponentVersion versionObj =
versionHandler.getComponentVersion(versionId);
String CAUsers = ctHelp.getCAUsersSection(versionId);
tableBody = tableBody + ((i%2 == 0) ? "<tr
class='table_banded_row' valign='top'>" : "<tr class='table_row'
valign='top'>");
tableBody = tableBody + "<td class='table_data'>" +
procHelper.getCompVersionLink(versionId,
versionObj.getCompName(), versionObj.getCompVersion()) + "</td>";
tableBody = tableBody + "<td class='table_data'>" +
CAUsers + "</td>";
tableBody = tableBody + "<td class='table_data'><span
class='data'>" +
versionObj.getComponent().getType() + "</span></td>";
tableBody = tableBody + "<td class='table_data'><span
class='data'>" +
versionObj.getComponent().getVendor() + "</span></td>";
tableBody = tableBody + "<td class='table_data'><span
class='data'>" +
versionObj.getRecommendationType() + "</span></td>";
tableBody = tableBody + "</tr>";
/** Get ComponentVersion ID with hyperlink to ComponentVersion Detail
page
*/
public String getCompVersionLink(long versionId, String compName,
String compVersion){
return "<a class='datalink' title='" +
this.getComponentFlyOverText(versionId) + "'
href='/techstacks-v2_1/content/components/componentDetail.jsp?versionId="
+ versionId + "'>" + compName + " " + compVersion + "</a>";
}
this is getting called by Report.jsp to display.
As this is getting changed everytime its called form classes not used
in jsp directly i think.
Now original objective is to sort all these displayed columns.
If user clicks on any of the column name everything sholud get sorted
on that basis.but sholud not call databse for same again by using same
id and mapping with any new column name this sholud be done. Paging
mechinasm to be used as it is if possible without major changes.
i don't know where to start with as started looking on this code just
2-3 days back only.
Vj
- 1
- ArrayList
Why this doesn't work:
ArrayList l = new ArrayList();
l.add(new String("aaa")));
String[] s = l.toArray();
JavaClassCast exception I got. What should I do?
- 1
- Help sought trying to add java to mozilla 1.5
I've downloaded and gotten mozilla 1.5 to work on my desktop machine.
However, when I visit Java enabled sites, I get a popup that tells
me I am missing the plugin for the java-vm applet type. When I say
"download it", the only links are for windows and linux, and I'm
not using either of these.
In the java 1.4.2_01 directory I have on my machine is a rje/plugin/sparc/ns610
directory in which there is a .so file. But I don't see any instructions
on what all I need to connect things together.
When I try to copy that .so file into my $HOME/.mozilla/plugins directory,
mozilla 1.5 crashes attempting to access the java applets. If I
remove the .so, then I get a popup telling me I need a plugin.
Can anyone provide additional ideas on what might be missing?
--
<URL: http://wiki.tcl.tk/ > In God we trust.
Even if explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
<URL: mailto:email***@***.com > <URL: http://www.purl.org/NET/lvirden/ >
- 2
- Can I restrict permissions at runtime?I have an editor application that I've writen that needs to read and
write XML files to disk. I'd like to extend this program by allowing
users to extend my editor by plugging in custom code they compile using
certain interfaces. My editor will call their code to gain use of
their functions.
However, this plugin code is untrusted, and I don't want it to access
the filesystem or network. Is there some way I can create a sandbox
within my program in which I can run this custom code and be sure that
it cannot do things like write to the filesystem? Perhaps create a
separate thread with special restricted permissions?
Mark McKay
- 2
- Help with JavaPOS pleaseHi there,
I have made an application that uses a POS printer device to print out a
receipt,
but there are genereal problems printing out .....
sometimes it prints out sometimes it doesn't (??) this is not the most major
of the
problems. The most major problem has to do with setting the style and the
layout of the printing.
After I have opened my device, claimed it everything should be ready or ??
I have checked to see what the method getFontTypefaceList()); returns
and my guess was that these numbers return different numbers that are
representatives for character sets eg fonts!!!! So I take one of these
numbers to try it out, put a number inside the method setCharacterSet(850);
yes .. 850 for instamce ... then I restart my application to see if the
output
is different, but it is not. I wonder why.
and yes I have tried several other methods in the POSprinter class and
by means of the POSprinterConst class too.
Does anyone have any experience with this or am I left to keep
experimenting?
I also need to find out how to set Linebreaking, linedistancing etc etc bold
italic and so on.
Regards
Carl
- 8
- 9?. Steps To Improve Your FlyingThere are many things that you can do when you fly to make yourself a
safer and better pilot. Too many pilots get careless and stop doing
fundamental things that could save their lives. Here are some simple
things that you can do to improve your flying.
1. Use your rudder pedals.
It seems simple, right? Well, too many people neglect to get in the
good habit of using them. Use them during taxi, takeoff, climbs,
cruise, maneuvers, descents, and landing. Get the picture - Use them
all the time.
You can know exactly how much to use them during flight by looking at
the slip/skid indicator. That is the ball of the turn coordinator. As
long as the ball is centered between the lines, you are using the
right amount of rudder. If the ball is outside the lines, add rudder
in the direction that the ball is located.
For instance, if the ball is to the right, add right rudder. An easy
way to remember this is to "Step on the ball." Add enough pressure to
re-center the ball.
There are a lot of things happening when you are airborne. Correctly
using your rudder will make you a better pilot, keep your passengers
happy, and show your piloting professionalism (something you need to
have, even if you are not a professional pilot). Remember, step on the
ball.
2. Use Your Checklist
As you are flying, make sure that you use your checklist for each
portion of the flight. There are checklists for everything from
preflight to securing the airplane. Most airplanes have a checklist in
the owner's manual that you can use during your flights. Also, when
you learn to fly most flight schools have checklists that are
available for their students.
But checklists aren't put there to look pretty. Your job is to use
them. If you get in the habit of using one each flight, you will be
that much safer. It's not going to do you any good in your flight bag.
Even if you know the items by heart, still double check yourself
anyway.
Another thing, if you need to add something personal to your checklist
(like don't forget your sunglasses, or turn off your cell phone so the
battery won't run down as it searches for a signal in flight) do this
as well. As long as you have all the required items included, add any
that will help you personally during your flight.
3. G.U.M.P.S.
Whether you use G.U.M.P.S. as your landing checklist or not, get in
the habit of using a memorized checklist for your return to earth. In
a complex airplane, Gumps is; Gas, Undercarriage, Mixture, Propeller,
and Seatbelts. In a non-complex airplane, Gumps could be; Gas,
Undercarriage, Mixture, Power, and Seatbelts. Of course you don't
actually have to lower your gear on a fixed gear plane, but it is best
to remind yourself anyway. That way, when you do transfer to a
retractable gear airplane, you won't have to add anything to your
checklist. This also happens to be one of the most important checklist
items of the whole flight. So you will already be in the habit of
checking your landing gear when you get to the point where it really
matters.
4. Weight and Balance
Never ever forget to precisely calculate your weight and balance for
each flight. Too many people have gotten lazy and careless, and have
added extra weight in the form of passengers or cargo to their
airplanes, thinking that everything is ok. Isn't there room for error
- a little safety cushion, if you will - in the maximum useful load?
Why would you even want to know? If you take this attitude with your
flying, you are putting yourself and your passengers in a very
dangerous situation. Never operate out of the manufacturer's set
limitations for your airplane. They are there for a reason; to keep
you safe!
5. T.O.L.D.
Takeoff and Landing Data should be calculated for every flight as
well. Make sure that you are very familiar with all of the runways of
intended use and their lengths and widths. If it is not something that
you or your airplane can handle, don't make the flight. Don't get in
the habit of assuming that just because you are in a Cessna 172 that
every landing strip is suitable for your flight. Calculate your
takeoff and landing distances for each flight, taking into
consideration the density altitude and aircraft performance.
6. Appropriate Radio Calls
One flying safety item that can easily be performed is making sure
that you make your radio calls at the appropriate time. Whether you
are flying out of a towered or uncontrolled airport, be professional
with your radio calls. One common error is made at uncontrolled
airports, when after an airplane lands, the pilot calls clear of the
runway while part or all of the airplane is on the runway side of the
hold short line. This is dangerous! What if your airplane malfunctions
and you are stuck on the runway and another airplane thinks it's safe
to land? This is a hazardous situation that can easily be avoided. At
non-towered airports, it's better to not make any radio call at all,
than to make a dangerous one. Get it right!
7. Complete Runup
You have done a complete preflight inspection and are now ready to
takeoff. Make sure you do a complete engine runup as well. Check every
aircraft system while you are still on the ground before you get in
the air. Determine that all of your radios, comm and nav are
functioning. Check your vacuum and electric gyros. Check your flight
controls and your engine gauges. Know that when you take off, you are
as safe as you can be. There is no reason to rush through your runup.
8. Situational Awareness
Situational awareness is when you know exactly what is happening with
your flight and with what is going on around you. On the ground, you
need to make sure that you are aware of other airplanes that are
taxiing and using the runway. In the air, use the radio and your eyes
to know exactly where other airplanes are in relation to you as well
as their intentions. But situational awareness is not just limited to
knowing where other airplanes are. You also need to know exactly what
is happening with your airplane, the weather, airspace, the winds,
your location, what you would do in an emergency, etc. Regardless of
whether you are flying cross country or local, for fun or for
training, don't assume everything is alright. Know what is happening
around you.
9. Fly the plane from engine start to shutdown
When it comes to flying, make sure that you are maintaining vigilance
at all times in the airplane. Too many times pilots zone out at some
point in the flight. For many pilots, that time is before takeoff and
after landing. Make sure that even when you are on the ground, you are
flying the airplane. Keep a watchful eye out for other aircraft and
don't rely on the tower to separate ground traffic. Position your
flight controls so that you have the proper crosswind correction,
regardless of the wind speed. Even if the wind is calm, look at the
wind sock and taxi as if the wind is really blowing in the direction
indicated by the sock. Although you are on the ground, your control
surfaces are still somewhat effective. Treat them as if your safety
depends on their position.
9?. Have Fun
Even though it sounds simple, keep your flying fun. When you are in
the air, you are living a dream. Don't forget it!
http://cncarrental.cn/html/goodspeech/20060924/633.html
- 8
- Send ARPHello everyone,
I want to verify if an IP is in my local net or not.
If I send an ARP request and get a MAC from that then the IP is in the
local net.
That's why I need to send an ARP request in Java under Windows XP and
NT.
Can anyone tell my how this is done?
Doing this native with the Windows iphlpapi.dll seems to be a bit
complex.
Any ideas for any easy way?
Thanks.
bye bembi
- 8
- Arrays - component type vs Element typeCan anyone explain to me the difference between an element type and a
component type?
In the java literature, arrays are said to have component types, whereas
collections from the Collections Framework are said to have an element
type.
http://java.sun.com/docs/books/jls/second_edition/html/arrays.doc.html
states:
> The *component type* of an array may itself be an array type. The components of
> such an array may contain references to subarrays. If, starting from any
> array type, one considers its component type, and then (if that is also an
> array type) the component type of that type, and so on, eventually one must
> reach a component type that is not an array type; this is called the *element
> type* of the original array, and the components at this level of the data
> structure are called the elements of the original array.
Reading that - I thought I'd 'got' the difference, but then in 10.1 (a
para later) the terms seem to used synonomously!
> An array type is written as the name of an *element type* followed by some
> number of empty pairs of square brackets []. The number of bracket pairs
> indicates the depth of array nesting. An array's length is not part of its
> type.
> The element type of an array may be any type, whether primitive or reference.
> In particular:
>
> € Arrays with an interface type as the *component type* are allowed. The
> elements of such an array may have as their value a null reference or
> instances of any type that implements the interface.
> € Arrays with an abstract class type as the *component type* are allowed.
> The elements of such an array may have as their value a null reference or
> instances of any subclass of the abstract class that is not itself
> abstract.
When describing collections from the Collections framework there is
never any of this ambiguity/distinction - it is always "element type",
even when talking about a collection whose elements are themselves
collections.
Am I missing a "big idea"?
Any thoughts greatly appreciated.
Rob
email***@***.com
- 9
- Toward more efficient ArrayListsRoedy Green (email***@***.com) wrote:
: IIRC Arraylists are about 10 times slower than plain arrays. This is
: quite a penalty to pay for not knowing ahead of time how many items
: you will have.
Can you give a pointer to a benchmark that shows this?
Or can you build a benchmark that shows this?
Can you give proof that this really is your hot spot? Most guesses
about what to optimize is wrong.
Anyway I find it hard to believe that arraylist is 10 times slower
since the methods (get and set) does something like
{ RangeCheck(index); return elementData[index]; }.
Ok the range check is unneccasry, it will be checked by the jvm also.
If you use add a lot then it will check the size of the array and
expand if neccessary. If you know in advance how many objects you will
store this should not be a problem (you do create the list with the
size), if you dont know in advance it will be hard to write something
that is a magnitude faster...
/robo
- 11
- Making a soundcard objectI have this idea of making a modem, that requires the soundcard to act
as my A/D and D/A, and in the middle will be my attempts at DSP. I
came up with this object, and it seems to test OK, but I could use
some constructive criticism, as I am definately at the OO 101 stage.
Merry Christmas, and a Happy New Years soon!
/**
* SoundCard.java
*
* @version 1.0, 1 December 2007
* @author Steve Sampson, K5OKC
*
* Public Domain (p) December 2007
*/
package modem;
import javax.sound.sampled.*;
import java.io.*;
public class SoundCard {
private static AudioFormat format;
private static TargetDataLine targetLine;
private static SourceDataLine sourceLine;
private static AudioInputStream sound;
public void SoundCard() {
}
/*
* Initialize Sound Card
*/
public boolean initPCM(double dblSampleRate) {
/*
* Encoding,
* Sample Rate (float),
* Sample Size (In Bits),
* Channels,
* Frame Size,
* Frame Rate (float),
* BigEndian (Boolean)
*/
format = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,
(float)dblSampleRate,
16,
1,
2,
(float)dblSampleRate,
false);
DataLine.Info targetInfo = new
DataLine.Info(TargetDataLine.class, format);
DataLine.Info sourceInfo = new
DataLine.Info(SourceDataLine.class, format);
try {
/*
* A source data line is written to
*/
sourceLine =
(SourceDataLine)AudioSystem.getLine(sourceInfo);
sourceLine.open(format); // Typical buffer size is same
as samplerate in bytes
sourceLine.start();
/*
* A target data line is read from
*/
targetLine =
(TargetDataLine)AudioSystem.getLine(targetInfo);
targetLine.open(format); // Typical buffer size is same
as samplerate in bytes
targetLine.start();
}
catch (LineUnavailableException e1) {
return false;
}
catch (SecurityException e2) {
return false;
}
catch (IllegalArgumentException e3) {
return false;
}
catch (IllegalStateException e4) {
return false;
}
if(!AudioSystem.isLineSupported(targetInfo)) {
return false;
}
sound = new AudioInputStream(targetLine);
return true;
}
/*
* Stop, flush, and close the soundcard interface
*/
public void closePCM() {
sourceLine.stop();
targetLine.stop();
sourceLine.flush();
targetLine.flush();
try {
sourceLine.close();
targetLine.close();
}
catch (SecurityException e)
{
}
}
/*
* Provide a block of Signed 16 bit PCM sound data
*/
public int getPCM(int[] intSampleArray) {
int intBytesRead;
byte[] byteData = new byte[intSampleArray.length * 2]; //
Convert count to bytes
/*
* Read bytes into array. This call will block if there aren't
* enough requested bytes.
*/
try {
intBytesRead = sound.read(byteData, 0, byteData.length);
} catch(IOException e) {
return -1;
}
/*
* This is designed for Little-Endian Intel machines
*/
for (int i = 0, j = 0; i < intBytesRead; i += 2, j++)
intSampleArray[j] = (byteData[i + 1] << 8) + byteData[i];
return intBytesRead / 2; // convert count to words
}
}
- 12
- 14
- arrays of generic typesEclipse tells me that arrays of generic types are not legal, e.g.: it
won't allow the following:
QuadTree<MyNodeType> [] allQuadTrees;
Anyone know why this is the case?
- 15
- Beans with JSFI'm pretty new to programming with JSF and beans, and have been
reading up the documentation in the book "Core JavaServer Faces"
by D.Geary and C. Horstmann as well as online, and managed to
get some simple programs to run, so at least I now understand
some of the basics.
However, I've got quite a lot of existing code in HTML and
JavaScript that works, although not fully cleaned up yet, and I want
to make as few changes as possible in order to modify it for using
beans with JSF. Specifically, some months ago I wrote some
client-side code which is backed up online at
http://csharp.com/simulator/simulator.html, which I'm in the process
of modifying for JSF. The links at the bottom take you to
.../option1.html and .../option2.html, with the original source code
at
respectively .../option1.txt and .../option2.txt. At the moment the
code is not linked to code on a server, so only the JavaScript works
with the forms.
The index page didn't need much work, with the main change being
to include the JSF tags at the top (I'm leaving work on the counter
until later). The option1 page is mostly one large form, and what I
have since done is to keep the form as it is, except that it only
operates with JavaScript, with the post, action, and JavaScript
function calls at the beginning removed, together with the "Submit"
and "Reset" buttons at the end. I put these two buttons together
with calls to the JavaScript in a JSF form immediately below the
end of original form, and after making a few changes to the
JavaScript, got the JavaScript to work correctly and validate the
form.
My question is how do I send to the server the contents of the
original form, including the hidden fields? Do I have to create a
hidden field in the JSF form for each value entered in the main form,
and create a bean for each of these values, or is there some way
of sending the whole contents of the form to a bean, which can then
parse the values. I want to avoid turning the original form into a
JSF form, as it would probably mean making many changes to the
JavaScript, which would require extra work and debugging.
Exactly the same will be done with the option2 page once option1
has been sorted out, and I would be most grateful for some advice.
Christopher Sharp
- 16
- What will be your DAO design ?For the following tables, which is a general rdbms design, what classes will
you create for accessing these tables ?
Table 1 : Group
group_id (PK)
group_desc
Table 2 : User
user_id (PK)
user_name
Table 3 : Group_User
group_id (FK)
user_id (FK)
|
| Author |
Message |
Peter Kirk

|
Posted: 2005-1-7 18:10:00 |
Top |
java-programmer, History of objects?
Hi
a relatively complex project I am working on now has a need for
"versioning". I mean, we have a system for administration of data (creating
and updating) in a database, and this data needs to be saved as separate
versions each time it is updated - a lot like a CVS.
The data is in the main "bridges", which have lots of data (name, location,
height etc), and lots of related data: persons (controller, supervisor);
tasks to be performed...
It should for example be possible for a user to view a "bridge" as it looked
on a certain date in the past, with all its related data (as they also were
at that date).
Does anyone have some good ideas about how we can save a history of versions
of all our objects? Where can I start to look for good ideas? Could we use
CVS via some sort of java api?
Thanks,
Peter
|
| |
|
| |
 |
Chris

|
Posted: 2005-1-8 0:43:00 |
Top |
java-programmer >> History of objects?
> a relatively complex project I am working on now has a need for
> "versioning". I mean, we have a system for administration of data
(creating
> and updating) in a database, and this data needs to be saved as separate
> versions each time it is updated - a lot like a CVS.
>
<snip>
> Does anyone have some good ideas about how we can save a history of
versions
> of all our objects? Where can I start to look for good ideas? Could we use
> CVS via some sort of java api?
I presume you're using a SQL database. I've handled this in the past by
having a set of history tables that parallel my app's tables. For example,
table bridge (id, name, location)
table bridge_history (id, version#, user_id, timestamp, name, location)
Make the primary key of the history table the id + the version #. The
user_id tells you who made the change, and the timestamp tells you when it
happened.
If your database is not large, it's easiest just to create a complete
snapshot of the record in the history table. If saving space is important,
then just save the *old* values of the fields that changed. That's a lot
more work, though, if you want to recreate a snapshot of the data at a given
point in time.
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Regular expressions question!I'm trying to parse HTML tables, so I need to find following pieces of text!
<table .....anything between this ..... /table> and
<tr ........ /tr> and
of course
<td> 'part that I need' </td>
I do not know how to put that into regular expression!
Thanks!
- 2
- Opportunities in U.K./Great Britain?I have a friend who recently moved to Madrid. He had a Dutch passport
so EU access was relatively easy for him. We both lived in D.C., but
I remain US citizen by birth.
My question is, he says it's becoming more popular for J2EE
development in Great
Britain and the UK. I'm wondering how good is the market? (in
relation to US) How good is it for US programmers? (any demand for US
borne skills) And if any of these are true, how hard it is securing
work permit? (etc) Finally is there any idea what standard of living
might be like?
Given all of this would there be sacrifices, or would it just be
better overall simply to stay in US?
- 3
- jni gcc mangled names//Crapo.java
public class Crapo {
static {
System.loadLibrary("Crapo");
}
native public static int magicNumber(int n);
public static void main(String... args) {
System.out.println(magicNumber(246));
}
}
//Crapo.c
typedef long long __int64;//gcc doesn't recognize __int64
#include "Crapo.h"
/*
* Class: Crapo
* Method: magicNumber
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_Crapo_magicNumber(JNIEnv * env, jclass c,
jint n) {
return 47;
}
//run gcc -mno-cygwin -Wl,--add-stdcall-alias -shared -o Crapo.dll -I
"C:\Program Files\Java\jdk1.6.0\include" -I "C:\Program
Files\Java\jdk1.6.0\include\win32" Crapo.c
//output of nm Crapo.dll
10003040 b .bss
10003020 b .bss
10003000 b .bss
//............ 30+ lines of this crap
1000505c i .idata$5
//..........................
100011d0 T _DllMain@12
10001000 T _DllMainCRTStartup@12
100011c0 T _Java_Crapo_magicNumber@12//<-----------------
10001360 T __CTOR_LIST__
10001368 T __DTOR_LIST__
U __RUNTIME_PSEUDO_RELOC_LIST_END__
U __RUNTIME_PSEUDO_RELOC_LIST__
//................... more crap; to me at least
//it was my understanding that --add-stdcall-alias when passed to the
linker should remove the @12 of _Java_Crapo_magicNumber@12
//run gcc -mno-cygwin -shared -o Crapo.src -S -I "C:\Program
Files\Java\jdk1.6.0\include" -I "C:\Program
Files\Java\jdk1.6.0\include\win32" Crapo.c
//remove @12 from Crapo.src
//run as -o Crapo.obj Crapo.src
//run ld -shared -o Crapo.dll Crapo.obj
//run nm Crapo.dll
U .bss
U .data
10001000 t .text
10001000 T _Java_Crapo_magicNumber
10001010 T __CTOR_LIST__
10001018 T __DTOR_LIST__
10002000 A __RUNTIME_PSEUDO_RELOC_LIST_END__
10002000 A __RUNTIME_PSEUDO_RELOC_LIST__
10001010 T ___CTOR_LIST__
10001018 T ___DTOR_LIST__
//... more crap
// by manually removing the @12 from the assembly source produced by
gcc and then separately assembling and linking solves the problem.
//I like the fact that their are far fewer unnecessary symbolic names.
Yet I was hoping their was a one step command-line option to be sent,
like --add-stdcall-alias? Any reason that doesn't seem to work for me?
//It's my understanding that -Wl,--add-stdcall-alias command-line
option is sent to the linker by gcc, and then subsequently sent to
dlltool where the option should result in the @nn's being removed from
the table of symbolic names. Is this correct?
- 4
- ... to see if I can post ...
I attempted to respond to the response to my latest post,
or to thank him twice, but not shown. What is going on?
- 5
- List helpHi,
I am new to Java.
I've been working on this project for some time now and I cannot get it
to work.
This is supposed to be a linked list.
I need to use an insert method that alphabetically adds a new title to
the list. This code I have here doesn't have a working compareTo method
but only a test to add node to the list.
This code was provided to me and I must add an insert that will put a new
item in alphabetically order. Don't tell me the answer - I just don't
understand why this doesn't work. I hope that what I've written here is
clear.
Thanks
John
Main looks like this something like this:
main(String [] args){
BookList book = new BookList();
book.add (new Book ("title of book"));
}
// ----------------Test compareTo
public int compareTo(Node a, Node b){
// Since I couldn't get this to work either, I test to see if I can get
any value.
println(a.book.compareTo(b.book)); // doesn't work I don't know how to
compare the titles
return 0;
}
public class BookList
{
private BookNode head;
//----------------------------------------------------------------
// Sets up an initially empty list of books.
//----------------------------------------------------------------
BookList()
{
head = null;
}
//----------------------------------------------------------------
// Creates a new Book object and adds it to the end of
// the linked list.
//----------------------------------------------------------------
public void insert (Book newBook){
BookNode node = new BookNode (newBook);
BookNode current;
BookNode prev;
if (head == null)
head = node;
else
{
current = head;
while (current.next != null){
// Orignally this method looped through the whole list until it found the
end, then add the new
// to the bottom.
// I did a test here to see if I could move the list around.
// This is what I think should happen: save current in prev. get next with
current.
// try to put node in from of current.next. It seems no matter what I try
there's a null pointer
// error. I just can't figure this out.
prev = current;
current = current.next;
node.prev = current.prev;
node.next = current;
node.prev.next = node;
current.prev = node;
}
current.next = node;
}
}
//*****************************************************************
// An inner class that represents a node in the book list. The
// public variables are accessed by the BookList class.
//*****************************************************************
private class BookNode
{
public Book book;
public BookNode next;
public BookNode prev;
//--------------------------------------------------------------
// Sets up the node
//--------------------------------------------------------------
public BookNode (Book theBook)
{
book = theBook;
next = null;
prev = null;
}
}
}
- 6
- 7
- tomcatI just installed Tomcat 5.5 and went to http://127.0.0.1:8080/. Then I
clicked on Servlet Examples to see what examples it comes with, but I
got a 404 File not found error. Anyone know what the deal is? Are the
servlet examples separate?
- 8
- using jsp:setProperty on non-simple types.Hi,
I'm currently having a small problem with my application. I'm using
some simple classes that wraps simple types to help me provide multiple
representation. For example, a DateCBO calls wraps the Date type and
gives me the oportunity to have various 'getters' like
getDateShortFormat(), getHtml(), getDateLongFormat() and so on.
My beans are using this kind of wrappers as their properties.
I have already made a custom tag to retrieve information that i use
instead of the standard jsp:getProperty
Now, i'm trying to use the jsp:setProperty to initialise the bean
property, but i have 'Could not coerce String to non-primitive type
StringCBO without bean property editor (JSP 1.2: 2.13.2.1) at line 13'
error.
Is there an interface that i can use to allow direct usage of
'jsp:setProperty', or should i create a custom tag as well.
thanks.
- 9
- Problem with IN parameters to an Oracle stored procedureHello all
I had earlier posted the same problem I am having on
comp.java.lang.programmer earlier and someone suggested this post
would probably fall better under this group. Here is the link to the
original post with the original post copy pasted below.
http://groups.google.co.in/group/comp.lang.java.programmer/browse_thread/thread/b0b845981c3e403a/#
Since then I have changed the IN parameter to my stored procedure to
read as
clID IN TABLEA.CLIENTID%TYPE
instead of clientID, based on a suggestion to the earlier post and
have still had no luck.
Any suggestions are welcome.
Thanks
Swetha
- 10
- ain't java grand ?I just got this error message from the java 4.2 compiler.
---
Consulting.java:152: cannot resolve symbol
symbol : variable $
location: class Consulting
perchance you meant '.'
---
Ain't it just the coolest message you've ever seen?
- 11
- JDialog focusHi,
Is it possible to ensure that, upon setVisible(true), a JDialog pop-up
jumps on top of all other windows including other applications?
Many thanks in advance!
Aaron Fude
- 12
- How to convert a C++ Object to a JNI jobject in order to use GetObjectClassI have an interface object of type ISubscribe and I am trying to cast
the ISubscribe object to a jobject so I can call GetObjectClass in
order to proceed with a callback using JNI.
ISubscribe * s
jclass cls = env->GetObjectClass(s);
Does anyone know how I can do this in C++? I tried using
reinterpret_cast<jobject>(s) but GetObjectClass does not like that. Any
ideas would be appreciated.
Thanks,
Vijayk
- 13
- load servlet mappings at runtime in tomcatCan anyone suggest a way to achieve dynamic servlet mappings in tomcat 5.5.
What I want to do is run a web app with any number of paths all pointing to
one servlet. These paths would be loaded from a database and extra paths
can be added at runtime by the user. So an example would be
www.domain.com/sample and www.domain.com/anothersample would both execute
the same servlet.
Another option I thought of was having a custom 404 servlet that would check
the request supplied and then redirect.
- 14
- Play audio clip in an ApplicationI'm trying to play an audio clip by using Applet's newAudioClip()
method. That method takes a URL. The .wav file is located in a jar file
(the only jar file). For example:
if myJar.jar is the only jar file
"java -jar myJar.jar" launches the application correctly and everything
is wonderful. My audio clip won't play because I don't know how to
access the .wav file from the jar file.
This code snippet works fine when I'm not running from the jar file:
try
{
File currentDir = new File(".");
URL currentDirURL = currentDir.toURL();
URL url = new URL(currentDirURL, fileName);
AudioClip clip = Applet.newAudioClip(url);
clip.play();
}
catch (Exception e)
{
e.printStackTrace();
}
It knows to look for the sound file in the current directory. How do I
adjust this code to look for the sound file in the jar.
I have a feeling it's an easy answer involving class.getResource().....
- 15
- Eclipse 3.3 - external tool arguments issue.
I run the WebSphere command line wsadmin java tool as external tool in
Eclipse. It works fine except where an External tool argument has an
"=" sign as in "-javaoption -Dcom.ibm.ws.management.standalone2=xxxx".
Wsadmin picks up the "-Dcom.ibm.ws.management.standalone2" variable
but not the value. Seems that the Eclipse "arguments" dialog
truncates values after the "=" sign. Is there a way around this.
The arguments are listed below.
-user 1234 -password xyz
-lang jacl -host 11.11.11.11. -port 1111
-javaoption -Dcom.ibm.ws.management.standalone2=xxxx
-wsadmin_classpath C:\WASAdminSBV\WSAdmin\WAS5.1\JACL\proclib.jar
-f ${resource_loc}
The problem does not occur when Wsadmin is run from the command line.
|
|
|