AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Parallel Port Access
Goto page 1, 2, 3 ... 59, 60, 61  Next
 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
server
Guest





PostPosted: Sat Feb 11, 2006 11:25 am    Post subject: Parallel Port Access Reply with quote



message unavailable
Back to top
Roedy Green
Guest





PostPosted: Sat Feb 11, 2006 11:25 am    Post subject: Re: Parallel Port Access Reply with quote



On 10 Feb 2006 19:44:54 -0800, david.brown.0 (AT) gmail (DOT) com wrote, quoted
or indirectly quoted someone who said :

Quote:
I need to be able to
write to the data and control pins and read the status pins. Any Java
people know a good solution?

there are some third party libraries . See
http://mindprod.com/jgloss/serialport.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Back to top
Ian Mills
Guest





PostPosted: Sat Feb 11, 2006 2:13 pm    Post subject: Re: dynamic array/ arrylist of arraylists Reply with quote



standshik wrote:

Quote:
okay i'm new to java. i need to read some stuff from a file and store
into some data structure.
say i have the following in a file
A B C
D E
F G H I

no i need to store such a way so that i can access (i,j)th element at
anypoint of time.

i can do that very easily in C++ using vector of vectors of string.

how do i do that in java? i tried using arraylist of arraylists but
could not get it right?

Can you somebody please explain in details how can i do that? possibly
with a small fragmant of code?

thanks
kaushik

I know this is thought to be somewhat old fashioned but if you are used

to using a Vector of Vectors you can use the same in java. However it
really depends on how you want to utilise this data as to the best way
to store it within your application.
Back to top
phillip.s.powell@gmail.co
Guest





PostPosted: Sat Feb 11, 2006 2:40 pm    Post subject: Re: ServletException I do not understand Reply with quote

I solved it, but the solution is utterly weird.

I just needed to add this:

/**
* Does nothing
*
* @ignore
*/
public static void main(String[] args) {}

I usually only added a blank main() static method to allow for my
Javadocs to align a bit more nicely but it seems to have a bit more
merit than I thought..

Phil
Back to top
phillip.s.powell@gmail.co
Guest





PostPosted: Sat Feb 11, 2006 2:58 pm    Post subject: Re: ServletException I do not understand Reply with quote

I got it! And I have no explanation for it but it works!

I added this to MessageProcessor class, but I only did this to clean up
the generated Javadocs:

/**
* Does nothing
*
* @ignore
*/
public static void main(String[] args) {}

And suddenly the ServletException is gone and all compiles nicely!

Phil
Back to top
Bigval
Guest





PostPosted: Sat Feb 11, 2006 5:54 pm    Post subject: Re: Array info Reply with quote

This is how the combobox is populated by default, after using a GUI
builder:

String []dataMoboCombo = { "Mobo1", "Mobo2", "Mobo3", "Mobo4", "Mobo5",
"Mobo6" };
cmbMoboCombo = new JComboBox( dataMoboCombo );

with the combobox i am working on i do this:

String []cpuComboBox = new String [cpuList.length];

for (int i = 0; i < cpuList.length; i++){
cpuComboBox[i] = cpuList[i].getName();
}

The objects of type cpu have a string component (name), and a series of
booleans. All i want to extract is the name Strings. I dont know
why it wont work. My getName method in cpu is this:

public String getName(){
return name;
}
I have written a toString method:

public String toString(){
return getName():
}

It still wont work, as it stands, the combobox is being populated with
nothing :S as opposed to the mem addresses.

Is it possible that as cpu is a superclass of Intel and Amd, and these
2 subclasses have more fields (more booleans) it is causing trouble?
a cpu object is declared thus:
Cpu cpu1 = new Amd( "cpu1", false, true, true, false, false, false,
3000);
Cpu cpu2 = new Intel( "cpu2", true, false, true, false, false, 4000);

John
Back to top
Rhino
Guest





PostPosted: Sat Feb 11, 2006 8:01 pm    Post subject: Re: Does any one use blueJ Reply with quote

<sheldon.sc (AT) gmail (DOT) com> wrote in message
news:1139604211.489490.63350 (AT) g44g2000cwa (DOT) googlegroups.com...
Quote:
Does any one use Blue J
Ive jsut started working on it
Im doing this course from a book caleed object of java
I need some help with some prgrams
I hope somebodys there who can help me out
I really dont know how to post this ova here
So let me know caus I need to submit these assnmts on sunday

http://www.ucfv.bc.ca/cis/comp155/labs/lab01.htm

U will find a description of the assnmt on ht elink above
Its realy simple but I cant seem to figure out the method to get a
Random Color


<rant>
Please tell me that you are just learning English; I really don't want to
believe that a Canadian University student with English as a first language
could write as badly as you have.

What you said/what you meant to say:

Quote:
Does any one use Blue J
Does anyone here use BlueJ?


Quote:
Ive jsut started working on it
I've just started working on it.


Quote:
Im doing this course from a book caleed object of java
I'm doing this course from a book called Object of Java. [maybe you mean

"Objects in Java"??]

Quote:
I need some help with some prgrams
I need some help with some programs.


Quote:
I hope somebodys there who can help me out
I hope somebody here can help me out.


Quote:
I really dont know how to post this ova here
I really don't know how to post here.


Quote:
So let me know caus I need to submit these assnmts on sunday
So let me know because I need to submit these assignments on Sunday.


Quote:

http://www.ucfv.bc.ca/cis/comp155/labs/lab01.htm

U will find a description of the assnmt on ht elink above
You will find a description of the assignment at the link above.


Quote:
Its realy simple but I cant seem to figure out the method to get a
Random Color
It's really simple but I can't seem to figure out the method to get a random

Color.

I hope you don't plan to send out resumes written with such little care;
you'll never get a job if you do, even in IT. Good communication skills are
vital in any job.

By the way, let me emphasize that I take back everything - except the
preceding paragraph - if you are new to English. I know English is a very
difficult language for non-English speakers and if you're just starting to
learn it, you're off to a reasonable start. Keep working at it and you'll be
fine before too long.

But if you have lived your whole life in this country, your teachers and the
politicians who run your school system should all be deeply ashamed for
having done such a poor job of teaching you the dominant language in this
country. If this counts as mastery of English these days, our educational
system - and the country in general - is in deep trouble.
</rant>

--
Rhino
Back to top
zero
Guest





PostPosted: Sat Feb 11, 2006 11:54 pm    Post subject: Re: dynamic array/ arrylist of arraylists Reply with quote

"standshik" <standshik (AT) yahoo (DOT) com> wrote in news:1139632658.336362.68390
@g44g2000cwa.googlegroups.com:

Quote:
okay i'm new to java. i need to read some stuff from a file and store
into some data structure.
say i have the following in a file
A B C
D E
F G H I

no i need to store such a way so that i can access (i,j)th element at
anypoint of time.

i can do that very easily in C++ using vector of vectors of string.

how do i do that in java? i tried using arraylist of arraylists but
could not get it right?

Can you somebody please explain in details how can i do that? possibly
with a small fragmant of code?

thanks
kaushik


A Vector of Vectors would work, and is in fact very similar to an
ArrayList of ArrayLists. The only differences are that a Vector is
synchronized, and does not allow null values.

Example code:

ArrayList stuff = new ArrayList();
ArrayList row1 = new ArrayList();
row1.add("A");
row1.add("B");
row1.add("C");
ArrayList row2 = new ArrayList();
// ...
ArrayList row3 = new ArrayList();
// ...
stuff.add(row1);
stuff.add(row2);
stuff.add(row3);

// element will be set to "A"
String element = (String)((ArrayList)stuff.get(0)).get(0);


Note that the casts can make the code harder to read. If you are using
JDK 1.5 or above, you can avoid that by using generics:

ArrayList<ArrayList<String>> stuff = new ArrayList<ArrayList<String>>();
ArrayList<String> row1 = new ArrayList<String>();
row1.add("A");
row1.add("B");
row1.add("C");
ArrayList<String> row2 = new ArrayList<String>();
// ...
ArrayList<String> row3 = new ArrayList<String>();
// ...
stuff.add(row1);
stuff.add(row2);
stuff.add(row3);

// element will be set to "A"
// no casts needed
String element = stuff.get(0).get(0);


The syntax is similar to the C++ templates syntax, but under the hood
it's very different. You should read a tutorial on generics before
using it more extensively than the code above.
Back to top
Guest






PostPosted: Sun Feb 12, 2006 12:38 am    Post subject: Re: Does any one use blueJ Reply with quote

Thanks for the English course, I do appreciate it but that is not the
reason why I had written in the first place. I was in a hurry because I
had to leave to go meet a friend to help me with the assignment. Some
of it was not intentional but thanks for pointing it out. May be you
should have become a English teacher. You did not help at all. May be
it's because of you that this country is such a beautiful place.
Keep up the good work.
Back to top
Rhino
Guest





PostPosted: Sun Feb 12, 2006 12:38 am    Post subject: Re: Does any one use blueJ Reply with quote

<sheldon.sc (AT) gmail (DOT) com> wrote in message
news:1139687623.399593.263060 (AT) g44g2000cwa (DOT) googlegroups.com...
Quote:
Thanks for the English course, I do appreciate it but that is not the
reason why I had written in the first place. I was in a hurry because I
had to leave to go meet a friend to help me with the assignment. Some
of it was not intentional but thanks for pointing it out. May be you
should have become a English teacher. You did not help at all. May be
it's because of you that this country is such a beautiful place.
Keep up the good work.

You're welcome.


Considering your snotty attitude, you probably won't believe this but I was
really just trying to encourage you to communicate in proper, correctly
spelled sentences using capitalization and punctuation so that we would have
a better chance of understanding your question. The sort of mangled English
you put in your initial post was a complete turnoff to me and probably to
some others. I just wanted you to understand that it is discourteous to your
readers to write in such a sloppy way if you know better. Some people will
refuse to read writing that is that bad even if they would normally be
willing to help you. We all make allowances for people that are new to
English but it's sheer laziness on your part to write mangled English when
you can do better. I don't normally bother to help anyone who is that lazy.


As for generating a random Color, you were on the right track with your
code: choosing an integer between 0 and 255 for each of the three colour
components, Red, Green, and Blue sounds like a good approach to me.

If you look at the API for the Color class, you will see that there are a
variety of constructors for Color. One of the most commonly-used ones, the
sixth of the constructors in the Java 1.5.0_06 API, calls for three integers
to be passed to the constructor. Therefore:

Color myBlack = new Color(0, 0, 0);
Color myWhite = new Color(255, 255, 255);
Color myRed = new Color(255, 0, 0);
Color myBlue = new Color(0, 255, 0);
Color myGreen = new Color(0, 0, 255);

You just need to put an expression that generates a random integer between 0
and 255 in each of the three parameters to the Color constructor. Something
like:

Color myColor = new Color(<expression to calculate random int>, <expression
to calculate random int>, <expression to calculate random int>);

Naturally, the text I put within angle brackets needs to get replaced by
real code.

I'm not going to tell you the code; you'll learn more by working it out on
your own. If you don't see how to do it, try looking at the Random class.
The API may tell you enough that you can code it yourself but, if not, use a
Google Groups search to find examples of the Random class in the
comp.lang.java.* newsgroups.

Once you have constructor your new random Color, you simply have to use it.
For example, if you are drawing an oval and want it to be your new Color,
you'll need code like this (assuming you have already defined the random
Color):

g.setColor(myColor);
g.drawOval(90, 60, 20, 20);

In other words, you have to set the color that the drawing method is
supposed to use, then draw the object(s) that you want drawn in that color.

That should be all you need to know to solve the problem you were having.

By the way, your problem really has nothing to do with BlueJ; it's really
just a Java question. If you post here again at some point, try to choose a
subject line that is more appropriate. For instance, a better title for this
post would have been something like "Need help generating random Color". I
almost didn't read your post at all because it looked like a BlueJ question
and I don't know much about BlueJ.

--
Rhino
Back to top
IchBin
Guest





PostPosted: Sun Feb 12, 2006 12:38 am    Post subject: Re: Array info Reply with quote

Bigval wrote:
Quote:
This is how the combobox is populated by default, after using a GUI
builder:

String []dataMoboCombo = { "Mobo1", "Mobo2", "Mobo3", "Mobo4", "Mobo5",
"Mobo6" };
cmbMoboCombo = new JComboBox( dataMoboCombo );

with the combobox i am working on i do this:

String []cpuComboBox = new String [cpuList.length];

for (int i = 0; i < cpuList.length; i++){
cpuComboBox[i] = cpuList[i].getName();
}

The objects of type cpu have a string component (name), and a series of
booleans. All i want to extract is the name Strings. I dont know
why it wont work. My getName method in cpu is this:

public String getName(){
return name;
}
I have written a toString method:

public String toString(){
return getName():
}

It still wont work, as it stands, the combobox is being populated with
nothing :S as opposed to the mem addresses.

Is it possible that as cpu is a superclass of Intel and Amd, and these
2 subclasses have more fields (more booleans) it is causing trouble?
a cpu object is declared thus:
Cpu cpu1 = new Amd( "cpu1", false, true, true, false, false, false,
3000);
Cpu cpu2 = new Intel( "cpu2", true, false, true, false, false, 4000);

John

For me, just post the code that you are have a problem with. That is,

the methods and all required references. I still do not know what type
cpuList and cpu1, cpu2 and cpu3 are yet. I can work from your code to
resolve problem unless someone else has the answer.
--

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Back to top
Guest






PostPosted: Sun Feb 12, 2006 3:35 am    Post subject: Re: Parallel Port Access Reply with quote

RXTX was the only thing that had any form of parallel port access, but
as far as I can see, its just a native library without a Java side
implementation. I've done some more searching and found a lot that can
access the serial port, but not the parallel port. I'm trying to drive
an LCD display, so I cannot use the serial port short of buying a
BasicStamp, which is well out of reasonable price range. Java people
keep trying to find something. C++ people, help me build a working
parallel port library, in case I can't find anything.
Back to top
Roedy Green
Guest





PostPosted: Sun Feb 12, 2006 5:35 am    Post subject: Re: Does any one use blueJ Reply with quote

On 11 Feb 2006 11:53:43 -0800, sheldon.sc (AT) gmail (DOT) com wrote, quoted or
indirectly quoted someone who said :

Quote:
May be you
should have become a English teacher.

It is irritating, like deliberately mumbling. You write once, and many
read, so it makes sense for you to put in some effort to make your
post comprehensible.

It says between the lines, "You are not important. My time is
valuable. Yours is not, so serve me you worm."

No wonder you get some backs up. It is more than about spelling.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Back to top
Guest






PostPosted: Sun Feb 12, 2006 12:12 pm    Post subject: Re: Creating Jar files Reply with quote

Thanks very much That helped a lot

Cheers

Andrew
Back to top
Bigval
Guest





PostPosted: Sun Feb 12, 2006 12:12 pm    Post subject: Re: Array info Reply with quote

Of course, will post some code later:

cpuList is an array of type Cpu
cpu1-3 are Cpu objects


Cpu(String name, boolean intel, boolean amd, String clockSpeed) this is
a superclass of Intel and Amd (which contain similar params, plus a
load of booleans representing the relevent socket types for each
manufacturer).

John
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Goto page 1, 2, 3 ... 59, 60, 61  Next
Page 1 of 61

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.