Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!

Craig O'Brien

Greenhorn
+ Follow
since Feb 28, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Craig O'Brien

I just registered and was immediately allowed to downlowd the product. 130 meg!!
Does anyone have any insight into how well this product performs? Comparisons to JBoss etc. I had never heard of it before but a potential client uses it exclusively.
Thanks,
Craig
18 years ago
I just registered and was immediately allowed to downlowd the product. 130 meg!!
Does anyone have any insight into how well this product performs? Comparisons to JBoss etc. I had never heard of it before but a potential client uses it exclusively.
Thanks,
Craig
18 years ago
Hello its me again,
Well just because I'm not a lose ends guy and I'm sure that I am not the only one who has come across this....
After spending hours searching every possible forum, all answers point in some way or another to a classpath issue.
Inside the mail.jar are the two all important mapping files. If your IDE includes the mail.jar file (or any part of it) in your distribution jar, it will obscure the mail.jar's manifest so it simply won't find them. It also puts blinders on it so it cannot find the classpath. I tried extracting the files and placing them into the META-INF directory in my jar, I tried modifying my jar, modifying the manifest, jaring everything manually, placing the files in every possible location. I tried many different compilations of my jar, I tried including the classpaths everywhere... There was just no way that I could get the mail.jar to read the classpath. Somehow during distribution phase, JBuilder seems to create something which obscures the mail.jar's mapping files and does not allow it the scope to find the classpath.
Four hours later, I decided to just place the mail.jar and the activation.jar into the /jre/lib/ext directory and everything worked fine. The classloader cannot miss these jars that way and they are free of the distribution jar. This isn't ideal as it somewhat binds the application to the specific jre that I give them. I want to be able to distribute this to non-technical people and the thought of making them make classpath and other adjustments is exactly the opposite direction that I want to go with this project.
The real long term answer is probably to create my own provider etc which I will do later in the development process.
I'm still interested in comments if anyone has any good insights.
Anyways, Happy coding.
Cheers,
Craig
------------------
SCJP2
19 years ago
Hello,
I have written a Swing email client/mail manager in JBuilder and everything works great in the development environment. However, when I package it up for distribution I get errors when trying to send or receive.
Sending -- rfc882 error
Receiving -- no such provider exception.
This points to a Provider mapping issue. I notice, however, that JBuilder does not include any special mappings and the app works in that environment.
I have read Sun's "Guide for Service Providers" and created both javamail.properties and javamail.address.map files which are placed in my <javahome>/lib directory. hmmmmm???
All classpaths etc are correct and double checked. All pertinent classes are bundled up in my main jar. I distribute a jre 1.3.1 and startup files with the package.
Any ideas?
Thanks,
Craig
------------------
SCJP2
19 years ago
Hello Mike,
Have you tried "mail.host" rather then "mail.smtp.host"? I tried your setting and it appears to look for a local smtp server rather then a remote one.
Properties p = new Properties();
p.put("mail.host", (String)config.get("mailServer"));
Session con = Session.getInstance(p, null);
Works for me.
Good Luck,
Craig
oops, didn't need html there..
------------------
SCJP2
[This message has been edited by Craig O'Brien (edited December 20, 2001).]
19 years ago
You don't by chance use timehost.net as a host do you. I do and they moved one of my sites yesterday and I lost all my scripts, programming, databases, etc.... ugh.
They upgraded my php from 4.04 to 3.0.16...??? (just venting)
I hope your archives are safe.
fraternally
Craig
19 years ago
Hello,
I just solved this problem for myself so I
thought I would share. I am using Mandrake
7.2. Yes there is a default jdk called
Kaffe which is only 1.1. I installed the
jdk1.3.0_02 from sun and it worked when I
referenced the full path from the bash shell.
Bash is looking to certain directories for
shell scripts. type "echo $PATH" and it
will tell you where it is looking. Look in
those directories to find the kaffe's "java" "javac" etc. files and
replace them with your simple shell scripts.
All you need is the path to your jdk and command. You don't even need to remove kaffe
although I did.
mine looked like this:
-----------------------
#!bin/sh
/usr/jdk1.3/bin/java $1
-----------------------
--no lines on top or bottom.
I found mine in the /usr/bin. Just call it
java. now when you type java in bash it
will look for this script. the "$1" is the
first item you type after "java " just like
normal terminal input.
This is my hack and I'm sure it can be more
elegant. Look at other shell scripts. If I
am missing anything please let me know. My
system is working fine.

Regards,
Craig
------------------
SCJP2
[This message has been edited by Craig O'Brien (edited March 28, 2001).]
19 years ago
I used much of Jack Shirazi's advice and updated this little algorithm. The speed is greatly improved. I found FastRandom by Pedro Silva and Nuno Lopes ( http://laseeb2.isr.ist.utl.pt/sw/jdeal/ ) and attempted to use this Algorithm for generating seeds:
<pre>
long seed = (System.currentTimeMillis() ^ 0x5DEECE66DL);
n = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);
</pre>
But it just couldn't produce seeds fast enough as it uses System.currentTimeMillis().
Anyway, admittedly this is frivolous as its probable use is for only sequences of 10-16 characters which is so small that even the original version wasn't measurable with the range of milliseconds. There was significant improvement with the suggestions.
Here's the latest version. Can it get faster? This is just for fun. :0)

<pre>
import java.util.*;
final public class RanchRandomizer2{
// generates a random alpha-numeric sequence

public static void main(String[] args){

RanchRandomizer2 t = new RanchRandomizer2();
int len;
if (args.length != 0)
len = Integer.parseInt(args[0]);
else
len = 12;
System.out.println("A random sequence of " + len + " characters");
System.out.println(t.randomPass(len));
}

final StringBuffer randomPass(int len){
long timeIn = System.currentTimeMillis();
char[] set = {'a','A','b','B','c','C','d','D','e','E','f','F','g','G',
'h','H','i','I','j','J','k','K','l','L','m','M','n','o',
'O','p','P','q','Q','r','R','S','t','T','u','U','v','V',
'w','W','x','X','y','Y','z','Z','1','2','3','4','5','6',
'7','8','9','0'};
StringBuffer result = new StringBuffer(len);
Random rand = new Random();
int i = 0;
while(i < len){
int n = rand.nextInt(set.length);
result.append(set[n]);
i++;
}
long timeOut = System.currentTimeMillis();
System.out.println("Processing time: " + (timeOut - timeIn) + " milliseconds\n");
return result;
}
}
I was kind of proud of my "ugly test", I guess thats from too much perl.
Regards,
Craig
[This message has been edited by Craig O'Brien (edited March 06, 2001).]
19 years ago
Thanks,
I'll do all of those things. I did this on a whim and thought it might generate some conversation. I appreciate your time.
Craig
19 years ago
Thanks,
I am 9 months late to this discussion but I was having a tough time with the explanation as well.
In "Programmers guide to Java Certification" (Mughal and Rasmussen) it states that "The case label values must be assignable to the type of the integral expression"
"Exam Cram" states "Each case statement must have a constant of an integer type of 32-bit or smaller size."
RHE states "The arguments to case labels must be constants, or at least a constant expression that can be fully evaluated at compile time."
I believe that the distinction is that it is evaluated at compile time.
Thanks for everyone's help.
Craig
19 years ago
Thank you Sheriff.
Craig
19 years ago
duhhhh...I see now.
If you could transfer me It would be great. Otherwise I'll make it over there soon......
but: crossposting is spam :0)
19 years ago
duhhhh...I see now.
If you could transfer me It would be great. Otherwise I'll make it over there soon......
but: crossposting is spam :0)
19 years ago
Hey thanks for responding Angela.
Replacing
int n = (int)(Math.random() * 122);
with
int n = rand.nextInt(122);
did yield a 1.0107% increase in performance.
Unfortunately for the result to be a character sequence the integers still need to be cast to characters so the String() constructor does not fill the need.
I see that I probably placed this in the wrong forum, I told you I was new here. I see that there is a performance forum just a few lines above. Guess I'll mosey over there.
Thanks,
Craig
19 years ago
Hey thanks for responding Angela.
Replacing
int n = (int)(Math.random() * 122);
with
int n = rand.nextInt(122);
did yield a 1.0107% increase in performance.
Unfortunately for the result to be a character sequence the integers still need to be cast to characters so the String() constructor does not fill the need.
I see that I probably placed this in the wrong forum, I told you I was new here. I see that there is a performance forum just a few lines above. Guess I'll mosey over there.
Thanks,
Craig
19 years ago