comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * adding jars to classpath on runtime without -cp option - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e98c253d97fad483 * Servlets or Applets or ... - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4fadffe362a6f10c * Design question : Parallel Inheritance Hierarchies - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/313558c87276bd65 * reflection question - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f02d54a8d033a403 * JNI - really big troubles - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d130697894de900d * Ant vs Makefiles - 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e81556a5c62ba767 * Really (!) correct Semaphore - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b621f16b0eeef712 * Saving data - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d816da79e80f1fcd * Java and C# Dll ... - 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9865ceaba8831282 * Semaphore events and working part-part-part time. - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/519011440b614d43 * GMail - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8c7ea8aeb68bc1b4 * Application in sandbox - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/821eb31df84b5c4a * how to resize a array? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d5ed97c9d7b81add * create a DOCTYPE element with JAXP - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4f2582c516182269 * <jsp:param> Problem - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9718021160ca6f6b ============================================================================== TOPIC: adding jars to classpath on runtime without -cp option http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e98c253d97fad483 ============================================================================== == 1 of 2 == Date: Sun, Nov 28 2004 6:59 am From: [EMAIL PROTECTED] (rony) Hi all, I need to add jar to the classpath on runtime. When I say runtime I mean without using -cp option when running the program, but dynamically after the program already started. I tried to use System.setProperites("java.class.path",newClassPath) but It seems there is no effect ( classes are not found ). any ideas? Thanks a lot. == 2 of 2 == Date: Sun, Nov 28 2004 3:11 pm From: Andrew Thompson On 28 Nov 2004 06:59:03 -0800, rony wrote: > I need to add jar .. What jar(s)? >..to the classpath on runtime. Why? > ..any ideas? Custom classloader. <http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassLoader.html> -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane ============================================================================== TOPIC: Servlets or Applets or ... http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4fadffe362a6f10c ============================================================================== == 1 of 2 == Date: Sun, Nov 28 2004 3:45 pm From: "Don Khan" Hi, I am relatively new to JAVA but I am trying to build contact management system which would allow users to create their list of contacts. The contact data would be in database and security is important issue. I was initially thinking of using servlets/jsp but than it occurred to me that there might be other technologies in JAVA which could be better suited to what I need to accomplish. The application should allow user to search based on different criteria, should also provide interface for inputting new contacts. Also it should allow some level of sharing data in cases it is used on a company level where many users have common contacts. If you have a good idea of what technology would work best for my application please email me justifying your suggestion so that I can understand where you are coming from. Any replies would be appreciated. Thanks, Don -- High achievement always takes place in the framework of high expectation. - Charles F. Kettering == 2 of 2 == Date: Sun, Nov 28 2004 3:58 pm From: Andrew Thompson On Sun, 28 Nov 2004 15:45:56 GMT, Don Khan wrote: > I am relatively new .. Those new to Java are best helped on a different group.. <http://www.physci.org/codes/javafaq.jsp#cljh> >..to JAVA .. Java (it's a name, not an acronym). >..but I am trying to build contact management > system which would allow users to create their list of contacts. The contact > data would be in database and security is important issue. I was initially > thinking of using servlets/jsp but than it occurred to me that there might > be other technologies in JAVA which could be better suited to what I need to > accomplish. You might add an Applet/JApplet interface later if you want a richer UI. OTOH, since it *should* degrade gracefully to HTML (read JSP/Servlet) for those with no Java on the client, JSP's would be a good choice. > ..If you have a good idea of what technology would work best for my > application please email me justifying your suggestion so that I can > understand where you are coming from. You seem to be mistaking this discussion forum for a help-line. Pay me great wads of cash and we can continue this discussion in email. Alternately, get off your lazy behind and read the group to which you posted. HTH -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane ============================================================================== TOPIC: Design question : Parallel Inheritance Hierarchies http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/313558c87276bd65 ============================================================================== == 1 of 2 == Date: Sun, Nov 28 2004 9:01 am From: Chris Smith Tomer Ben-David <[EMAIL PROTECTED]> wrote: > In his book "Refactoring improving the design of existing code" martin > fowler writes about the bed smell "Parallel Inheritance Hierarchies". Yes, he does. First and foremost, you should realize that Martin's "bad smells" don't always represent bad code. He even lists comments as a bad smell! Fowler says to find smells, and then decide IF the code can be improved by refactoring. Parallel inheritance hierarchies are, in fact, used to great effect in several well know design patterns (e.g., see GoF's Abstract Factory). I see a few choices in your case: 1. Live with it. This isn't really so bad. 2. Use something that introspects your objects at runtime and saves them off into an XML format based on the runtime content of the class. This sidesteps the issues nicely. However, it means that your XML format needs to be very consistent and predictable -- certainly not appropriate for matching externally specified formats. 3. Put XML code into the Person classes, which you've already said you don't want to do. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 2 of 2 == Date: Sun, Nov 28 2004 11:39 am From: Alan Gutierrez On 2004-11-28, Chris Smith <[EMAIL PROTECTED]> wrote: > Tomer Ben-David <[EMAIL PROTECTED]> wrote: >> In his book "Refactoring improving the design of existing code" martin >> fowler writes about the bed smell "Parallel Inheritance Hierarchies". > > Yes, he does. > First and foremost, you should realize that Martin's "bad smells" don't > always represent bad code. He even lists comments as a bad smell! > Fowler says to find smells, and then decide IF the code can be improved > by refactoring. Parallel inheritance hierarchies are, in fact, used to > great effect in several well know design patterns (e.g., see GoF's > Abstract Factory). > I see a few choices in your case: > 1. Live with it. This isn't really so bad. In this case, it knid of is. If for every object, you need to explicitly write code that assembles a DOM document, or prints XML to a stream (SAX or Output), you are looking at a lot of tedius work. > 2. Use something that introspects your objects at runtime and saves them > off into an XML format based on the runtime content of the class. > This sidesteps the issues nicely. However, it means that your XML > format needs to be very consistent and predictable -- certainly not > appropriate for matching externally specified formats. This is probably a good answer in this case. What the OP is really considering is serialization, which is an "aspect" of the application, something that happens time and again. What seems to bother of the OP is the notion that a Person class contains logic, that to him, not sufficently abstracted. That a Person class shouldn't know what XML is. > 3. Put XML code into the Person classes, which you've already said you > don't want to do. I think a hybrid would be to create an interface that provides methods that describe what should be written to XML, and have an interface that operates on implementations. I'd give an example here, but there is already a Serializable interface, and you can store to streams or to XML via something like XStream. Alan Gutierrez ============================================================================== TOPIC: reflection question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f02d54a8d033a403 ============================================================================== == 1 of 1 == Date: Sun, Nov 28 2004 5:43 pm From: "Filip Larsen" Tony Morris wrote > Prior to 1.5, the typical way of invoking a noargs method through reflection > was by passing null as the second argument. > Prior to motor vehicles, we used horses. Using that parallel, you may consider us back in 1900 with most people still traveling by horse. Hopefully 1.5 is the future, but until then it make much sense to give advice that work on 1.4 or at least note when its 1.5 only. If you had wanted to give the impression that you knew the difference between 1.4 and 1.5 in the context of the advice "sks" gave, then all you had to do was to say something like "and in 1.5 you can do it like this...". Not that I think you care, but to me your patronizing reply about him not knowing the API only seem to reflect back on you. Regards, -- Filip Larsen ============================================================================== TOPIC: JNI - really big troubles http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d130697894de900d ============================================================================== == 1 of 1 == Date: Sun, Nov 28 2004 8:48 am From: [EMAIL PROTECTED] (Clemens Arth) I got some quite annoying problems trying to call some Java functions from my C++ program via JNI. Yesterday I spent about 8 hours just to figure out what's wrong - without success. Because it's quite a difficult problem, my description will be a little longer than common usual. INTRODUCTION For testing purposes only I compiled this little Java class: /**** XMLMessenger.java ****/ import java.io.*; class XMLMessenger { private static XMLMessenger xmlmsger = null; private XMLMessenger(){ } public static void initNatPub(String routerId, String agentId) { System.out.println("initNat..."); if (xmlmsger == null) { xmlmsger = new XMLMessenger(); } } public static boolean pubPicData(String stationId, String timeStamp) { System.out.println("pubPicData..."); // should do something a little later.... return true; } public static boolean pubSensData(String stationId, String timeStamp) { System.out.println("pubSensData..."); // should do something a little later.... return true; } } /*****************************/ It has got a private constructor to realize the singleton pattern and no "main" method. The code is compilable without errors and the methods can be called from any other java program. Using JNI I did the following: * Start a JVM * Attach the running thread to the JVM * Run the following C++-Code: /******* SNIP FROM C++ ********/ jclass ucls = env->FindClass("XMLMessenger"); jmethodID nativeId = env->GetStaticMethodID(cls,"initNatPub","(Ljava/lang/String;Ljava/lang/String)V"); jobjectArray args = env->NewObjectArray(2,env->FindClass("java/lang/String"),env->NewStringUTF("")); env->SetObjectArrayElement(args,0,env->NewStringUTF(ROUTERID)); env->SetObjectArrayElement(args,1,env->NewStringUTF(AGENTID)); // call only once env->CallStaticVoidMethod(ucls,nativeId,args); jmethodID pubSensId = env->GetStaticMethodID(ucls,"pubSensData","(Ljava/lang/String;Ljava/lang/String)Z"); jmethodID pubPicId = env->GetStaticMethodID(ucls,"pubPicData","(Ljava/lang/String;Ljava/lang/String)Z"); for(int x = 0; x < 10; x++) { jvalue arguments[2]; arguments[0].l = env->NewStringUTF("1"); arguments[1].l = env->NewStringUTF("2"); env->CallStaticBooleanMethodA(ucls,pubSensId,sensorargs); jvalue picargs[2]; picargs[0].l = env->NewStringUTF("1"); picargs[0].l = env->NewStringUTF("2"); env->CallStaticBooleanMethodA(ucls,pubPicId,picargs); } /*****************************/ Everything is ok. Code is compilable without errors and the program works without problems when the initNative-method is called before the other both methods are used. AND HERE IS THE PROBLEM DESCRIPTION: I got a whole package of classes. The only class which is of any interest for me is xxx.xxxx.xxxx.xxx.NetPub. Here's some code: /********* NatPub.java *********/ import 'about 10 packages'; public class NatPub extends AbsPub { private static NatPub natPub = null; private NatPub(int value) throws XYException { super(value); } public static void initNatPub(String routerId, String agentId) { if(natPub == null) { System.out.println("natPub = null"); } // keep an eye on this!!! if(natPub != null) { System.out.println("natPub = not null"); } // keep an eye on this!!! if(natPub == null) { try { natPub = new NatPub(123456789); } catch ( XYException e ) { e.printStackTrace(); } } public static boolean pubPicData(String stationId, String timeStamp) { if(natPub != null) { // do something } } public static boolean pubSensData(String stationId, String timeStamp) { if(natPub != null) { // do something } } /*****************************/ You might notice the similarities between the two Java-classes mentioned above. If I call the Java-Functions from ANY other Java-Program, everything works fine. First attempt: If I try to use the C++ code from above the class is found without any problems, but the JVM crashes because the two MethodIDs cannot be retrieved by the GetStaticMethodId calls AFTER the "env->CallStaticVoidMethod(ucls,nativeId,args);" call; The first Id is fetched without problems. Why does the other calls to GetStaticMethodId fail??? Second attempt: if I wrap around the C++ code to fetch the IDs before this initNative.. call, everything seems to be fine. But then, if I put some "System.out.println"s into the Java code a very strange thing happens in the initNatPub method: an evaluation of "natPub == null" is 'false' and an evaluation of "natPub != null" is also 'false'. WHAT THE F....K??????? The private instance of NatPub is never created because of this evaluation. But much more confusing is why this private object can and cannot be null at the same time !?!?!?!? Third attempt: I hacked the initNative.. method to create a new NatPub anyway (no 'if(natPub == null)' condition). This throws no exception and seems to work, but the instance of netPub is null when I call the pubPicData or pubSensData method the next time.... I'm really in big desperation. I've never seen such strange behaviour in any C++ or Java program before... I'm really sorry that my error description is that long, but I don't know what to do now. Maybe anyone has got a simple answer to one of the problems mentioned above. Anyway I don't want to spend another 8 or more hours to search for an error I don't really know where it is... Best regards! Clemens GCC: gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2,pie-8.7.6) JAVA: Java(TM) 2 Runtime Environment, Standard Edition (build Blackdown-1.4.1-01); Java HotSpot(TM) Client VM (build Blackdown-1.4.1-01, mixed mode) ============================================================================== TOPIC: Ant vs Makefiles http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e81556a5c62ba767 ============================================================================== == 1 of 4 == Date: Sun, Nov 28 2004 5:11 pm From: "Ann" "Juha Laiho" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Ann" <[EMAIL PROTECTED]> said: > >Great, then maybe you can suggest a solution for me since I am > >new to Ant. I have a file that contains mostly constants. When > >it changes there are a dozen other files that must be recompiled. > > Hmm.. that sounds like a combination of a property file and a class > to me. So, if you have constant values, separate them into a property > file that is read when the class is loaded (or an instance created, > whichever suits better to the logic). > > Then have a separate class (without the external data), that just > contains the dynamic behaviour you need - and have the dependent > classes call that class to get the information they need. This should > relieve you from recompiling just because a piece of "constant data" > did change - instead just modify the data and repackage/redeploy the > application. > -- Tnx for the idea. Unfortunately the guy I work with made a huge fuss about not reading any property (or other)files. And he wants all of the java files in a single directory. He took the 'package' statements out of some library files he wanted to use and moved them into the main directory. The <dependset> thing works though. == 2 of 4 == Date: Sun, Nov 28 2004 5:47 pm From: "Mike Schilling" "Ann" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Juha Laiho" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> "Ann" <[EMAIL PROTECTED]> said: >> >Great, then maybe you can suggest a solution for me since I am >> >new to Ant. I have a file that contains mostly constants. When >> >it changes there are a dozen other files that must be recompiled. >> >> Hmm.. that sounds like a combination of a property file and a class >> to me. So, if you have constant values, separate them into a property >> file that is read when the class is loaded (or an instance created, >> whichever suits better to the logic). >> >> Then have a separate class (without the external data), that just >> contains the dynamic behaviour you need - and have the dependent >> classes call that class to get the information they need. This should >> relieve you from recompiling just because a piece of "constant data" >> did change - instead just modify the data and repackage/redeploy the >> application. >> -- > Tnx for the idea. Unfortunately the guy I work with made a huge fuss > about not reading any property (or other)files. And he wants all of the > java > files in a single directory. He took the 'package' statements > out of some library files he wanted to use and moved them into the main > directory. He did what? Do this: First, ask him to post a question about whether this is the proper design to comp.lang.java.programmer. Next, buy a dustpan, so you have something to sweep up the ashes with. > The <dependset> thing works though. > > == 3 of 4 == Date: Sun, Nov 28 2004 5:54 pm From: Andrew Thompson On Sun, 28 Nov 2004 17:11:43 GMT, Ann wrote: > Unfortunately the guy I work with made a huge fuss > about not reading any property (or other)files. And he wants all of the java > files in a single directory. He took the 'package' statements > out of some library files he wanted to use and moved them into the main > directory. Packaged library classes to 'default' package? You have to *work* with this guy? Aaaaargh! :-( Tell him he's a bozo, as a special message from me. -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane == 4 of 4 == Date: Sun, Nov 28 2004 6:05 pm From: "Ann" "Andrew Thompson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sun, 28 Nov 2004 17:11:43 GMT, Ann wrote: > > > Unfortunately the guy I work with made a huge fuss > > about not reading any property (or other)files. And he wants all of the java > > files in a single directory. He took the 'package' statements > > out of some library files he wanted to use and moved them into the main > > directory. > > Packaged library classes to 'default' package? > You have to *work* with this guy? Aaaaargh! :-( > > Tell him he's a bozo, as a special message from me. > I'd love to. I continually pester him. Get this: he has all his files in C:\j2sdk1.4.2\bin because he couldn't get classpath to work and he wants to be able to do "javac *.java" He uses the 'it's my football' technique, so I can walk away. But it does give me the opportunity to write some swing code. ============================================================================== TOPIC: Really (!) correct Semaphore http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b621f16b0eeef712 ============================================================================== == 1 of 2 == Date: Sun, Nov 28 2004 9:17 am From: [EMAIL PROTECTED] (Frank Gerlach) Chris Smith <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Frank Gerlach <[EMAIL PROTECTED]> wrote: > > I hope I got it right this time. Please comment. > > > > You've pretty much got it right. I'd change three things, if you're > asking me to be picky: > > > public class Semaphore{ > > int count; > > Make that private. OK. > > > public Semaphore(int initialcount){ > > count=initialcount; > > } > > Perform a simple range check here: > > if (count <= 0) throw new IllegalArgumentException(initialcount); (count<0) would be the right thing, I assume. There could be a situation when initially no resources are available and some kind of producers would have to do their work and then call V(). > > > while(count==0){ > > wait(); > > } > > if(count<0)throw new Error("Fatal problem in Semaphore");//just in > > case > > That's dead code, and I wouldn't put it in as a matter of style. It > reeks of trial-and-error programming, and communicates to the reader > that you aren't really certain that you've got the synchronization > right. Be confident: your synchronization is fine. OK. == 2 of 2 == Date: Sun, Nov 28 2004 11:47 am From: Chris Smith Frank Gerlach <[EMAIL PROTECTED]> wrote: > > Perform a simple range check here: > > > > if (count <= 0) throw new IllegalArgumentException(initialcount); > (count<0) would be the right thing, I assume. There could be a situation when > initially no resources are available and some kind of producers would have to > do their work and then call V(). Okay, fine. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ============================================================================== TOPIC: Saving data http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d816da79e80f1fcd ============================================================================== == 1 of 1 == Date: Sun, Nov 28 2004 10:19 am From: Chris Smith I <[EMAIL PROTECTED]> wrote: > The most important thing about saving data is knowing the format you > want to save it to. All files (*) are just streams of bytes, Forgot the footnote: (*) As far as Java is concerned. Some operating systems, notably VMS, provide structured content implemented by the filesystem in some file types. MacOS also provides for content "forks" in files, as does NTFS IIRC though they are really not used on Windows. All of these things are ignored by Java, which does whatever it must to make files appear as simple byte streams to Java applications. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ============================================================================== TOPIC: Java and C# Dll ... http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9865ceaba8831282 ============================================================================== == 1 of 4 == Date: Mon, Nov 29 2004 1:39 am From: "Vincent Cantin" > Hello everybody, > I have developer a .dll (.net assembly) that contain 2 Class. > > I want to know If I can load this dll from Java and use the 2 Class. > Can i do it ? .net assembly is not java bytecode, the JVM only use bytecode so you can't. == 2 of 4 == Date: Sun, Nov 28 2004 5:59 pm From: "Ann" "Piccolo Max" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello everybody, > I have developer a .dll (.net assembly) that contain 2 Class. > > I want to know If I can load this dll from Java and use the 2 Class. > Can i do it ? > > max; > What is the difference between a .dll made from c++ and one made from c# ? (You can load a .dll from c++) == 3 of 4 == Date: Sun, Nov 28 2004 7:10 pm From: "Nicky" Hello Runtime.getRuntime().loadLibrary("..."); // put the path to your DLL in the quotes Then you have to declare every method of your dll in a Java class with the "native" keyword. I'm not sure this will work, but if doesn't work, there are probably no other solution. If this works, this works only on windows. nicky "Piccolo Max" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello everybody, > I have developer a .dll (.net assembly) that contain 2 Class. > > I want to know If I can load this dll from Java and use the 2 Class. > Can i do it ? > > max; > == 4 of 4 == Date: Sun, Nov 28 2004 10:55 am From: [EMAIL PROTECTED] (Frank Gerlach) "Piccolo Max" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Hello everybody, > I have developer a .dll (.net assembly) that contain 2 Class. > > I want to know If I can load this dll from Java and use the 2 Class. > Can i do it ? You will probably have to write an additional layer of C++ code (implementing jni stubs) to access the dlls. > > max; ============================================================================== TOPIC: Semaphore events and working part-part-part time. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/519011440b614d43 ============================================================================== == 1 of 1 == Date: Sun, Nov 28 2004 6:05 pm From: John Bailo ============================================================================== TOPIC: GMail http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8c7ea8aeb68bc1b4 ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 2:42 am From: "Pat" Hi all, Does anyone has invitation quota to GMail? Seems it's a good webmail. If you still have quota left, would you give me one? My email is [EMAIL PROTECTED] Thanks. ============================================================================== TOPIC: Application in sandbox http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/821eb31df84b5c4a ============================================================================== == 1 of 1 == Date: Sun, Nov 28 2004 11:37 am From: [EMAIL PROTECTED] (Jean Lutrin) Tim Tyler <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Hi. > > I have an application (in a Jar file) which I don't trust - and would > like to run securely - in a sandbox. > > Does anyone know the easiest way? Well, I have a similar problem to yours: there's a particular operating system that I don't trust. :) So I run Un*x operating systems (several flavors, on different kind of hardware). On my main development machine, wich I sometimes use to test "closed source" Java programs/plugins, etc. (or even "open source" programes that I'm not sure have been correctly audited), I simply do the following: ...jean $ su insecure Password: ***** ...insecure $ java -jar someJarIDontTrust.jar The "insecure" account has very restrictive rights and hence won't be able to do much mischief. It takes 5 seconds. I don't know if this can qualify for the easiest way (I suppose your not running Un*x though). It should be possible to do something similar under 2000 / XP no !? I'm not sure about how you go to use, simultaneously, graphical applications from different users displayed in the windowing environment (but I trust a particular company to have a very limiting EULA regarding what you're allowed to do according to how much you paid for "server edition" or "professional edition" or whatever). YMMV, but it should be possible to do at least something similar to that. Similarly, I have a account that is prevented to access the net (by one single elegant stateful firewall rule) to prevent apps I don't trust to "phone home". As I already said, I belong to this very small (and not very vocal) minority that happens to think that Un*x + Java is a wonderfull setup for a developer (most Java developer use Windows and most Un*x users have a grip with Java not being true Open Source Software). It's, IMHO, safer, faster and way more configurable. Java 1.4.2 + IntelliJ 4.5.1 (Eclipse 3 on some projects) + Linux Fedora Core 1. Uptime in months. I don't remember when was the last time that a Java app crashed. And all this for free besides IntelliJ Idea (but Eclipse, xemacs/jdee, etc. could do the job). See you soon on c.l.j.p., Jean ============================================================================== TOPIC: how to resize a array? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d5ed97c9d7b81add ============================================================================== == 1 of 1 == Date: Sun, Nov 28 2004 11:37 am From: Dimitri Maziuk Oscar kind sez: > nick <[EMAIL PROTECTED]> wrote: >> char[][] arr=new char[5][5]; >> arr[0][0]='a'; >> arr[0][1]='b'; >> ........ >> >> i want to resize (arr) at run time and reserve the original data >> what should i do? > > There are two alternatives > - Use George's advice: allocate a new, bigger, array and use > System#arraycopy(Object, int, Object, int, int). > - Use a List instead. Especially ArrayList is well suited to replace an > array. You do know that a) ArrayList does the very same array copy, b) comes with an extra dozen bytes overhead for each member and c) casts all its memebers to Object, right? Dima -- "Mirrors and copulation are abominable because they increase the number of entities." -- corollary to Occam's Razor ============================================================================== TOPIC: create a DOCTYPE element with JAXP http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4f2582c516182269 ============================================================================== == 1 of 1 == Date: Sun, Nov 28 2004 8:49 pm From: Abs Hi! I need to build a HTML file using JAXP. Right now, I'm using the following code: --------- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); DOMImplementation impl = builder.getDOMImplementation(); DocumentType htmltype=impl.createDocumentType("html","-//W3C//DTD HTML 4.01 Transitional//EN","http://www.w3.org/TR/html4/loose.dtd"); Document doc = impl.createDocument("html", "html", htmltype); // fill document --------- The document is built correctly but the DOCTYPE tag doesn't appear. What am I doing wrong ? Thanks in advance ============================================================================== TOPIC: <jsp:param> Problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9718021160ca6f6b ============================================================================== == 1 of 1 == Date: Sun, Nov 28 2004 12:06 pm From: [EMAIL PROTECTED] (Trent) Hello, I am trying to use the <jsp:include> and <jsp:param> actions. For whatever reason, I am having zero luck getting the param to be recognized in the included file. I have two files: index.jsp and header.jsp: +++++ index.jsp +++++ <html> <body> <jsp:include page="header.jsp"> <jsp:param name="subTitle" value="test 1 2 3"/> </jsp:include> This is in index.jsp </body> </html> +++++ header.jsp +++++ Value: ${param.subTitle} <br /> ++++++ Output +++++++ Value: ${param.subTitle} This is in index.jsp Why is my parameter not getting recognized? This is driving me crazy. Any help appreciated. ============================================================================== You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer" group. To post to this group, send email to [EMAIL PROTECTED] or visit http://groups-beta.google.com/group/comp.lang.java.programmer To unsubscribe from this group, send email to [EMAIL PROTECTED] To change the way you get mail from this group, visit: http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe To report abuse, send email explaining the problem to [EMAIL PROTECTED] ============================================================================== Google Groups: http://groups-beta.google.com
