Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!

Len Padson

Ranch Hand
+ Follow
since Nov 21, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
4
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Len Padson

I am not really sure what it means. Maybe you or somebody else could help me?

This is on the BlueCove website:


Native Library location

By default Native Library is extracted from from jar to temporary directory ${java.io.tmpdir}/bluecove_${user.name}_N and loaded from this location.
If you wish to load library (.dll) from another location add this system property -Dbluecove.native.path=/your/path.
If you wish to load library from default location in path e.g. %SystemRoot%\system32 or any other location in %PATH% use -Dbluecove.native.resource=false



I feel like this implies that it should find the native library automatically, but obviously it isn't.

This is the instructions page if anybody would be so kind as to look and help me out. I've googled everything I can think of! And furthermore, I downloaded a program (nonjava) that can communicate with the wiimote and it works just fine, so i know this is possible. But that program did not use java. I would like to be able to make my own programs. Thanks!
10 years ago
Hello! I have spent hours googling for answers, but to no avail, so I'm turning to you all. I found an API called WiiRemoteJ, that allows a wiimote (The Controller of a Wii) to be connected to a computer and communicated with. (responding to button presses and accelrometer readings and such)

Anyway, the API requires, of course, java to be able to use bluetooth, and I have no experience in bluetooth. After realizing that my mac jdk did not already have the javax.bluetooth package, i downloaded it. Then I downloaded BlueCove. And now I am unsure of how to proceed.

When I run a sample file that came with the API, I get the following error:


Native Library bluecove not available
java.lang.IllegalStateException: Bluetooth failed to initialize. There is probably a problem with your local Bluetooth stack or API.
at wiiremotej.WiiRemoteJ.<clinit>(WiiRemoteJ.java:56)
at WRLImpl.main(WRLImpl.java:47)
Caused by: javax.bluetooth.BluetoothStateException: BlueCove library bluecove not available
at com.intel.bluetooth.BlueCoveImpl.loadNativeLibraries(BlueCoveImpl.java:381)
at com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:434)
at com.intel.bluetooth.BlueCoveImpl.access$500(BlueCoveImpl.java:65)
at com.intel.bluetooth.BlueCoveImpl$1.run(BlueCoveImpl.java:1020)
at java.security.AccessController.doPrivileged(Native Method)
at com.intel.bluetooth.BlueCoveImpl.detectStackPrivileged(BlueCoveImpl.java:1018)
at com.intel.bluetooth.BlueCoveImpl.getBluetoothStack(BlueCoveImpl.java:1011)
at javax.bluetooth.LocalDevice.getLocalDeviceInstance(LocalDevice.java:75)
at javax.bluetooth.LocalDevice.getLocalDevice(LocalDevice.java:95)
at wiiremotej.WiiRemoteJ.<clinit>(WiiRemoteJ.java:49)
... 1 more




I'm not sure what it means by "Native Library bluecove not available". Could somebody please tell me what this means, and suggestions as to how to fix it? Thank you in advance; I am very excited at the prospect of communicating with a Wiimote in my programs, and I really do not want to let this setback stop me!
10 years ago
Hello!! How would I go about painting an image on the screen over other applications? For example, if I wanted to have a man run across the screen, but without a jframe. So it would look like the man was running on top of whatever application was currently being run?

Thanks in advance for your help!!!
10 years ago
Hello! I'm very new to servlets. If I have created a java server using a serversocket and sockets to send and receive http requests, I know how to send out html to clients. How would I go about sending a jsp page? Is there a java class for compiling the jsp code within an html page so that it is ready to send to clients? I would very much prefer not to have to use third party servers to serve my jsp.
10 years ago
JSP
That is a god start, but there are two things that I would like to point out. First of all, your for loop includes an incrementer, as it should (that's the i++). What this means is that every time the program runs through this loop, it adds one to i. Therefore, you should not have an additional i++ later in your code. Otherwise, every time the loop iterates (or runs through a cycle), i will be incremented twice, meaning you will skip over half the numbers.

Second, your solution should work, but it is not exactly how I intended for it to be done. You observed that the number of integers less than 1000 that are divisible by a given number is 1000 divided by that number. Had I not included a sample output, however, you would not have been able to make this observation. This may be a little advanced, as I am not sure how in depth you are at this point in Java, but a very operation is the modulo operator: %.

Modulo basically means remainder. For example, 5%2=1, because when 5 is divided by two, the remainder is one. Here are some more samples... hopefully you can catch on, and if not, just google modulo. The easiest way, then, to determine if one number is divisible by another, is to check if one modulo the other is equal to zero, meaning that the second goes into the first a whole number of times. For example:

10%2=0, so 10 is divisible by 2.
190%19=0, so 190 is divisible by 19.
39%3=0, so 39 is divisible by 3.

but,

35%8=3, and since 3 is not zero, 35 is not divisible by 8.


Now, I hope I haven't veered too off topic with this discussion, but chances are if you are learning loops now, you will be learning basic operations, +-/*%, soon. If you need anything else, please don't hesitate to ask!
10 years ago
Ask yourself questions like,

How does the number of the empty space and the number of the line its on correlate?

If you can find a correlation, then you could use an if statement to determine whether to print an asterisk or not.

That should get you started, but if you tinker with that for awhile (remember, ShowSomeEffort) and can't figure it out, let us know what you've done and we can help further.
10 years ago
Hello! I am trying to create a networked collaborative drawing applet, and I'm looking for suggestions as to the best, easiest, most efficient way to do so. To start, the only functionality I want is to be able to scribble on a canvas, so what should i send from the client to the server and then from the server out to all the clients? should i send the whole image? Should i send coordinates of the points drawn most recently? Or is there some third option that would be faster? I do not want to end up with an ArrayList of every coordinate of every line becasue then as time progresses response time will get slower and slower. So please help? Thank you!
Hello! I have created a webserver that uses sockets to send and receive http requests. If a certain input is received, i tell to write "<applet code='tictactoe' />" to the outputstream. But when i try to access it with a browser, the applet appears, but its constantly loading on the Java logo, so it obviously isnt finding my tictactoe.class file. my question is, what will the http input look like that requests the applet file, so i know what to respond to? and how do i respond to it with the applet?
Thank you, but I think you misinterpreted my question. I understand how to compile and run an application myself, but I would like to do it from the application. For example, I would like a JFrame to hold a JTextArea and a JButton, and the user types code into the textarea and then clicks the button to compile and run the code that the user just wrote.

I think it has something to do with this, but I am not sure how to implement it: JavaCompiler
10 years ago
Welcome to the Ranch!!! A quick google search came up with this:

http://mathbits.com/MathBits/Java/Looping/MCLooping.htm

But if you are just looking for some challenges, here are a few i can think of:


1) To test both ifs and fors, write a program that counts how many of the first thousand numbers (1-1000) are even. The answer is obvious, but the program might be a tad more difficult.

2) Write a program to print one one, then two twos, then three threes, then four fours, etc.

3) For a more difficult problem, that will involve multiple loops and ifs, repeat number one, only determine how many of the first thousand numbers are divisible by two, three, four, five, ... all theway to a thousand, so that the output ends up looking like this:



Hope this answers your question, and if you have any more questions just reply!
10 years ago
Hello everybody! I know Eclipse is itself a Java application, and it obviously has a button to compile and run code. What code would I have to use to, for example, compile a file written in a JTextArea? And then what code would I need to use to run said application?
10 years ago
On my mac, I cannot create a server on any port less than 1024. How do I fix this? Id like to not have to use port forwarding, but if that is necessary, could somebody please explain how? Thank you!!!
I feel like it does mean that... if I create a server, then my computer becomes vulnerable, right? I'm sorry. Maybe I am too novice to be trying this but I am really excited at the prospect of making a server. Lets say for example all my program ever did was send an html page with the date and time or something. the program would NEVER access a file on my computer. Shouldnt this imply that no hacker could do anything to gain access, since my server has absolutely no way of getting access? I realize that such a server would be quite limited, but just using it as a hypothetical, wouldnt that be perfectly safe, since it never accesses my computer?
10 years ago
I see. Thank you, by the way, for all your replies. Would it be unsafe, for example, to make a web server that gets the HTTP request and processes it, and then uses whatever was typed after the ip address and responds accordingly? For example: "http://123.123.123.123/COMMAND" could cause the web to read in "COMMAND" and maybe use a switch or something to process that command. Maybe "COMMAND" causes the web server to put the current date and time in a text file and send that text file. Who knows? But I'm not seeing the danger here. If the web server is not configured or programmed to send files over the network, except maybe for ones that it creates on the spot, is there any danger at all of hackers doing anything? I really dont understand how there could be any danger. Thanks again, for your help.
10 years ago
Hmm Okay Here's my idea. I know most servers are meant to transmit files from the computer to a browser, but what if I made it so my server created the file it was going to send each time. for example, if my server created a text file saying "Hello" and sent that. That way, hackers couldnt request a file, they could just send requests, and my server would respond accordingly.
10 years ago