|
Funnily enough I was just getting the lo-down on this subject.
JSObject isn't supported anymore and code signing has always been a barrier for such simple requirements.
JSObject & EMBED tag
Creating-a-Trusted-Applet-with-Local-File-System-Access-Rights.htm
It's the prime reason I HATE JAVA as a web technology.
Java Server Pages would probably be a better fit. Dead simple to pass info back and forth, and there's plenty of info out there.
|
|
|
|
|
dusty_dex wrote: and there's plenty of info out there. For those who can be bothered to look.
Use the best guess
|
|
|
|
|
Quote: For those who can be bothered to look.
Yes, strange how this in-built desire to find out *new* stuff (a do it yourself attitude) is lacking in some people. Is it a modern disease of the internet age?
|
|
|
|
|
import javax.swing.*;
public class RandomNumber {
public static void main(String[] args) {
int IsToken[] = {
9,10,38,40,46,48,
11,40,42,45,47,48,
1,19,26,30,31,48
};
int lucky[];
int column;
final int MAX_DATA = 49;
int[ ] arLotto = new int[MAX_DATA];
for(var i=0; i<MAX_DATA; i++){
if(private static boolean[] IsToken[] == true){
else if(arLotto[rnd] != Istoken[]){
arLotto[rnd] = lucky[column]
column++;
}
}
int rnd = (int) Math.round(49 * Math.random());
System.out.print(lucky[column]);
}
}
|
|
|
|
|
I think you will have problems with CP admins if you start posting Java code in a Javascript forum.
I will take look at this new attempt, and change my name to Claire Voyant.
|
|
|
|
|
)) This is funny. I am really not be hip this. I am trying to translate to codes from javascript to java
modified 11-May-13 8:51am.
|
|
|
|
|
|
yeah it is.. but i need some help on linked variable for IsToken numbers .txt *.js or any file extension to use it database record numbers to IsToken numbers a file integrated with Java language. At first i need to this file connected record numbers to do combination then. Do you know API or sample code about on this topic?
Forexapmle:
http://maverick.8m.net/loto.htm a little bit complete.. I'm using to this link. Any file to use it record database integrated with Java language. is it possible?
|
|
|
|
|
|
The database problem should be dealt with by the Web Server solution you choose. Which brings me to the next question.
Why Java? (How) do you intend to get Java code working?
That option should also be part of your Web Server solution.
Specifically Java Server Pages, and I think you should look at learning web *server side* features first. So that you aren't trying to solve problems which are already provided for you in a server solution.
What type of options did you get with your website?
|
|
|
|
|
Here's the Java & Javascript, both identical, for you to compare.
Ignore the fact that there is no random number generated yet. I just want to get arrays with difference between IsToken and all numbers NOT in that array. I have split it back into 3 x 6 so that it will be easier to manage if you then store them in a database.
This is output from the Java version:
>java RandomNumber
lucky numbers: (without duplicates)
9 10 38 40 46 48 11 42 45 47 1 19 26 30 31
used numbers:
1 0 0 0 0 0 0 0 9 10 11 0 0 0 0 0 0 0 19 0 0 0 0 0 0 26 0 0 0 30 31 0 0 0 0 0 0 38 0 40 0 42 0 0 45 46 47 48 0
unused numbers:
2 3 4 5 6 7 8 12 13 14 15 16 17 18 20 21 22 23 24 25 27 28 29 32 33 34 35 36 37 39 41 43 44 49
import java.util.*;
import javax.swing.*;
public class RandomNumber {
public static void main(String[] args) {
int IsToken[][] = {
{ 9,10,38,40,46,48},
{11,40,42,45,47,48},
{ 1,19,26,30,31,48}
};
int items = 0;
int items2 = 0;
int MAX_DATA = 50;
int[] duplicates = new int[MAX_DATA];
int[] lucky = new int[MAX_DATA];
int[] arrLotto = new int[MAX_DATA];
for (int i=0; i < MAX_DATA; i++) {
duplicates[i]=0;
}
for (int week=0; week < 3; week++) {
for (int j=0; j < 6; j++) {
int x = IsToken[week][j];
if(duplicates[x] == 0) {
duplicates[x] = x;
lucky[items] = x;
items++;
} else {
}
}
}
System.out.print("\nlucky numbers: (without duplicates)\n");
for (int i=0; i < items; i++) {
System.out.print(lucky[i] +" ");
}
System.out.print("\nused numbers:\n");
for (int i=1; i < 50; i++) {
if (duplicates[i] == 0) arrLotto[items2++] = i;
System.out.print(duplicates[i] +" ");
}
System.out.print("\nunused numbers:\n");
for (int i=0; i < items2; i++) {
System.out.print(arrLotto[i] +" ");
}
}
}
function RandomNumber() {
var IsToken = [
[ 9,10,38,40,46,48],
[11,40,42,45,47,48],
[ 1,19,26,30,31,48]
];
var items = 0;
var items2 = 0;
var MAX_DATA = 50;
var duplicates = new Array(MAX_DATA);
var lucky = new Array(MAX_DATA);
var arrLotto = new Array(MAX_DATA);
for (var i=0; i < MAX_DATA; i++) {
duplicates[i]=0;
}
for (var week=0; week < 3; week++) {
for (var j=0; j < 6; j++) {
var x = IsToken[week][j];
if(duplicates[x] == 0) {
duplicates[x] = x;
lucky[items] = x;
items++;
} else {
}
}
}
document.write("<br>lucky numbers: (without duplicates)<br>");
for (var i=0; i < items; i++) {
document.write(lucky[i] +" ");
}
document.write("<br>used numbers:<br>");
for (var i=1; i < 50; i++) {
if (duplicates[i] == 0) arrLotto[items2++] = i;
document.write(duplicates[i] +" ");
}
document.write("<br>unused numbers:<br>");
for (var i=0; i < items2; i++) {
document.write(arrLotto[i] +" ");
}
document.write("<br>");
}
I have to try and remember this stuff, so please just post back comments on the code without attempting to rename anything first.
modified 12-May-13 19:33pm.
|
|
|
|
|
Ok thanks this is right java dublicates method.. I have already compiled your code as .jar
http://maverick.8m.net/myApps/Dusty_dex_randomnumber.jar[^]
but an corrupted jar is that file for giving error should have some library or file existing in IDE. Well do you compile jar file valid as phone?
needs to any definition or adding library to compile it as phone or tablet? Thanks a lot for help and coding.
modified 13-May-13 3:39am.
|
|
|
|
|
I think you messed up the jar by renaming it Dusty_dex_, just name it RandomNumber.java (it should be same name as the Class in the file).
OK, this code is using System.out.println but if you want to see output via graphical UI (java.swing)
then you will have to \\comment out the System.out.println bits. And learn more about developing for phone.
It has never been an area I was bothered about, so I can't help you with phone development.
You can post the original errors and I'll see what could be missing. (besides developer knowledge)
Let me know if the javascript is any use. I could still work with that code, and convert it without a problem.
modified 13-May-13 7:35am.
|
|
|
|
|
Okay it is right I did not think it so.. Ok there is no problem in Javascipt code
|
|
|
|
|
NO. I mean yes, I know the javascript works. All of it works. You can test java without using phone tools.
But is the code doing what you want it to? compared to your own code that you posted. (which is a mess)
The java code needs modification in order to work with a GUI and not command line interface (CLI), which I use for compile & run.
Can we concentrate on JAVASCRIPT first. Worry about Java later.
modified 13-May-13 9:33am.
|
|
|
|
|
Yes JavaScript is not give an output
|
|
|
|
|
Have you used the very first version?
I posted it again, and that version does work. It should look like this
lucky numbers: (without duplicates)
9 10 38 40 46 48 11 42 45 47 1 19 26 30 31
used numbers:
1 0 0 0 0 0 0 0 9 10 11 0 0 0 0 0 0 0 19 0 0 0 0 0 0 26 0 0 0 30 31 0 0 0 0 0 0 38 0 40 0 42 0 0 45 46 47 48 0
unused numbers:
2 3 4 5 6 7 8 12 13 14 15 16 17 18 20 21 22 23 24 25 27 28 29 32 33 34 35 36 37 39 41 43 44 49
It was this and a few minor {} [] differences I overlooked. I had converted Java code back to javascript and posted it without checking. Sorry.
for (int i=0; i < MAX_DATA; i++) {
duplicates[i]=0;
}
I will send you an email.
modified 13-May-13 10:59am.
|
|
|
|
|
I had a look at your web server code and tried to figure out Random bits.
You do understand these are not finished code? Just "Work in progress", but I'm not getting much response as usual.
function RandomNumber() {
var IsToken = [
[ 9,10,38,40,46,48],
[11,40,42,45,47,48],
[ 1,19,26,30,31,48]
];
var MAX_WEEKS = 3;
var MAX_DATA = 50;
var items = 1;
var items2 = 1;
var scope;
var dups = new Array(MAX_DATA);
var nodups = new Array(MAX_DATA);
var lucky = new Array(MAX_DATA);
var arr = [];
for (var i=0; i < MAX_DATA; i++) {
dups[i]=0;
}
for (var week=0; week < MAX_WEEKS; week++) {
for (var j=0; j < 6; j++) {
var x = IsToken[week][j];
if(dups[x] == 0) {
dups[x] = x;
nodups[items] = x;
items++;
} else {
}
}
}
nodups.sort(function(a,b){return a-b;});
document.write("<br>numbers: (without duplicates)<br>");
for (var i=0; i < items-1; i++) {
document.write(nodups[i] +" ");
}
document.writeln("<br>");
document.write("<br>used numbers: <br>");
for (var i=1; i < 50; i++) {
if (dups[i] == 0) {
arr[items2++] = i;
} else {
arr[items2++] = 0;
}
document.write(dups[i] +" ");
}
document.writeln("<br>");
document.writeln("<br>unused numbers:<br>");
for (var i=1; i < items2; i++) {
document.write(arr[i] +" ");
}
document.writeln("<br><br>");
for (var r=6; r > 0; r--) {
var q = Math.round(48 * Math.random())+1;
document.writeln("q: "+ q +" arr[q]="+ arr[q] +"<br>");
if (dups[arr[q]] != 0) {
lucky[r] = arr[q];
dups[arr[q]] = 0;
} else {
lucky[r] = q;
}
}
document.writeln("<br><br>");
lucky.sort(function(a,b){return a-b;});
for (var i=0; i < 6; i++) {
document.writeln(lucky[i]);
}
}
|
|
|
|
|
Hakan Bulut wrote: Have you previously worked on the first data? Type missmatch syntax error of return line.
I'm not sure what that means. If you meant have I written this in Java? then no. I was waiting for more detail from you.
|
|
|
|
|
As stated before, you have wrote in the language of your javascript if (! taken [arr [q]])
! operator the language of java what can be done instead of ? It is not valid in Java.. I was playing new Tomb Raider the game it is really wonderful game. This is really beyond of programming..
That is no any using the combination of 6/49 tried to write random column.
modified 15-May-13 14:06pm.
|
|
|
|
|
All relative and assignment operators in Java are the same in C/C++ and Javascript.
give me the error messages, code line numbers and current code so that I can see where the problem is.
Did you get the email is sent you? I will send you something very helpful.
I've never played tomb raider, strange huh? But I do like those kind of games.
|
|
|
|
|
Error is: Type missmatch: cannot convert from boolean to int. at this line:
return (nu != arr[j]);
My e-mail address is:
hakanbul@hotmail.com
|
|
|
|
|
Hakan you will get spammed posting your email address like that.
I already know your email (it was on the file combinations.js on your website)
I sent you an email message on Monday. Have you seen it?
|
|
|
|
|
The function is expected to return int
public static int Random(int nu)
Any boolean test (== != > >= < <=) will give true/false answer, not the int.
That is your mismatch.
public static int Random(int nu)
{
int see;
final int MAX_DATA = 49;
nu = (int) Math.round(MAX_DATA * Math.random()+1);
for(int j=0; j<MAX_DATA; j++)
{
int[] arr = new int[MAX_DATA];
see = (int) (MAX_DATA != arr[j]);
}
return 0;
}
|
|
|
|
|
did not resolve to problem.. "Cannot cast from boolean to int." Compiler wrong alert give to message. I am thinking to must have a boolean initializier to int
|
|
|
|