Re: [OT] Serialization
Sorry that I could not answer earlier, currently I am away from my working place. Concerning this topic I recommend to send future emails directly to my, because it is only indirectly connected with tomcat. As mentioned, details about this are described in http://www.orthuber.com/wpa.htm . It is important is to map reality steadily to numbers (i.e. small changes of real objects should be connected with small changes of the representing numbers). Then similarity search possible. Wolfgang Pid schrieb: On 06/10/2010 11:55, Wolfgang Orthuber wrote: This would allow to sort medical histories precisely and to learn systematically from past experience. Only relative assessment is possible, no*? So every patient who wants to share his experiences in precisely searchable form, can get the opportunity for doing this. Precise search on objective data, would seem to be fraught with problems*. *Assuming I'm understanding the context. p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] Serialization
On 06/10/2010 11:55, Wolfgang Orthuber wrote: The build in serialization tool of java has probably high performance (which is in the long run important for search), and needed not much time for programming, therefore it was my initial choice. There's an assumption there, and some reasoning I'm not sure I understand. p 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature
Re: [OT] Serialization
On 06/10/2010 11:55, Wolfgang Orthuber wrote: This would allow to sort medical histories precisely and to learn systematically from past experience. Only relative assessment is possible, no*? So every patient who wants to share his experiences in precisely searchable form, can get the opportunity for doing this. Precise search on objective data, would seem to be fraught with problems*. *Assuming I'm understanding the context. p 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature
Re: [OT] Serialization
Chris, Not always it seems adequate to write to the mailing list - so you marked my question with [OT] which was a further hint for me to write to you directly. Concerning serialization I answered already on 04.10.2010. The build in serialization tool of java has probably high performance (which is in the long run important for search), and needed not much time for programming, therefore it was my initial choice. „Vectorial Search“ is also not direct topic of this list, but because you asked me, Iet me point to http://www.orthuber.com/wpa.htm which contains a description. There is a simple technical reason why such numeric search will come in addition to conventional word based search: For every new word (symbol) you need a new definition, but not for a new number or sequence of numbers. It is sufficient to define the vector space, and implicitly uncountable many vectors in this space are defined, you can search them and talk about them. Symbolic and word based descriptions are simpler perceived by human brain, but they can never reach the resolution and precision of vectorial descriptions. Such resolution is for example important in medical diagnoses. In nontrivial cases you need a very fine description of a patient for decision support, that you can productively exchange experiences. The first application of vectorial search may be, that the rough diagnosis determines the vector space, and measurement results determine the fine description as vector within the space. This would allow to sort medical histories precisely and to learn systematically from past experience. So every patient who wants to share his experiences in precisely searchable form, can get the opportunity for doing this. So it would be technically feasible to systematically exchange medical experience, so that medical treatment will less strongly depend on the experience of the chosen doctor. Besides medicine there are further applications. May be that I have to program the first prototype for demonstration of the principle. But it seems also attractive for me that we form an open source community for the complete project, if this can be organized productively. Let me know if there is interest in this. Wolfgang Am 05.10.2010 22:59, schrieb Christopher Schultz: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Wolfgang, (I'm cc'ing the tomcat-user mailing list in case others would like to read my response. Please try to keep things on the list rather than emailing contributors directly.) On 10/5/2010 9:34 AM, Wolfgang Orthuber wrote: thanks for your detailed answer. You are right, up to now I wrote e.g. C, C++ programs, since July I am working with Java because server programming and the java class library is necessary. There are many new conventions and my main problem is lack of time. I understand. Learning any new language has its caveats. The problem in this case was that you didn't understand the nuances of Java serialization. For instance, RTTI is written out as part of the serialization process, so attempting to read-into a different class (even with the same fields and code) causes an error. My recommendation would be to /not/ use Java's built-in serialization, and instead write your data out in a way that does not depend on a particular class's interpretation of the data. Just define a standard (binary, XML, whatever) and then read and write to that format. But the fundament of the plan is reliable (vectorial search) and I am interested in an up to date installation of tomcat and java. What is vectorial search? There is a great range of sources on the web for java and tomcat, partially incompatible, or old. Which source and selection do you recommend for an up to date and reliable installation of tomcat and java? If you're starting from scratch, get the latest and greatest Tomcat version, which is currently 6.0.29. This page has more information on the currently-supported versions of Tomcat: http://tomcat.apache.org/whichversion.html If you must stick with the 5.5.x line, you should upgrade to 5.5.31 after reading the changelog to see if anything might interfere with your webapp's functioning. As always, get Tomcat directly from the source: http://tomcat.apache.org/ Go to the Download | Tomcat 6.0 page and get the latest version. All you need is the core package: choose whatever packaging makes sense for your environment. For a Java version, we always recommend running on Sun's JRE (or JDK if you prefer). The only currently-supported version is 1.6.something: to go java.sun.com and download whatever the most recent version is. Feel free to come back to this list if you have any problems installing or configuring Tomcat. Good luck, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyrkcUACgkQ9CaO5/Lv0PCM5gCgoDam11AZxLAiQGFBj/zk/ikL Q4UAn229pufQzRHOlgvQt86/TWag0cDI =5FB9
Re: [OT] Serialization
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Wolfgang, (I'm cc'ing the tomcat-user mailing list in case others would like to read my response. Please try to keep things on the list rather than emailing contributors directly.) On 10/5/2010 9:34 AM, Wolfgang Orthuber wrote: thanks for your detailed answer. You are right, up to now I wrote e.g. C, C++ programs, since July I am working with Java because server programming and the java class library is necessary. There are many new conventions and my main problem is lack of time. I understand. Learning any new language has its caveats. The problem in this case was that you didn't understand the nuances of Java serialization. For instance, RTTI is written out as part of the serialization process, so attempting to read-into a different class (even with the same fields and code) causes an error. My recommendation would be to /not/ use Java's built-in serialization, and instead write your data out in a way that does not depend on a particular class's interpretation of the data. Just define a standard (binary, XML, whatever) and then read and write to that format. But the fundament of the plan is reliable (vectorial search) and I am interested in an up to date installation of tomcat and java. What is vectorial search? There is a great range of sources on the web for java and tomcat, partially incompatible, or old. Which source and selection do you recommend for an up to date and reliable installation of tomcat and java? If you're starting from scratch, get the latest and greatest Tomcat version, which is currently 6.0.29. This page has more information on the currently-supported versions of Tomcat: http://tomcat.apache.org/whichversion.html If you must stick with the 5.5.x line, you should upgrade to 5.5.31 after reading the changelog to see if anything might interfere with your webapp's functioning. As always, get Tomcat directly from the source: http://tomcat.apache.org/ Go to the Download | Tomcat 6.0 page and get the latest version. All you need is the core package: choose whatever packaging makes sense for your environment. For a Java version, we always recommend running on Sun's JRE (or JDK if you prefer). The only currently-supported version is 1.6.something: to go java.sun.com and download whatever the most recent version is. Feel free to come back to this list if you have any problems installing or configuring Tomcat. Good luck, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyrkcUACgkQ9CaO5/Lv0PCM5gCgoDam11AZxLAiQGFBj/zk/ikL Q4UAn229pufQzRHOlgvQt86/TWag0cDI =5FB9 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re:[OT] Serialization
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Wolfgang, (Marking off-topic because this is a Java/JSP issue and not Tomcat-related. See below for responses.) On 10/4/2010 9:10 AM, Wolfgang Orthuber wrote: my tomcat version is 5.5.17 Upgrade. then all works fine, but if I use only read (on an formerly written file) with the same code included in another program module, I got the exceptions like this: java.lang.ClassCastException: org.apache.jsp.w.w4a_jsp$1ddm2 cannot be cast to org.apache.jsp.w.w4b_jsp$1ddm2 That funny error message occurs because you are trying to write one class object and read it in as another class object. You should read-up on serialization for more information: http://java.sun.com/developer/technicalArticles/Programming/serialization/ in which w4a.jsp and w4b.jsp are two different modules which include the same code for read and write. That means that they are different classes, and are therefore incompatible. You should use a class defined in a .java file and not in a .jsp file. Your other option is to provide customized serialization that can read and write data without relying on Java's serialization mechanism (which mandates that the classes be the same in order to work). The name of the program module is stored in the serialized object, but the name of the program module does not matter, because both modules include the same code. No, the fact that they are the same code is irrelevant. Only the data and the metadata are relevant, and the metadata doesn't match between these two distinct classes. Do you know a simple solution which avoids the exception? Use the same class for both reading and writing. The code section with read and write: Is this inside a .jsp? If so, create a separate class. What are you doing putting Java code into a JSP file, anyway? More comments below... class dm5t implements Serializable { public ArrayListddm2v5; public dm5t () { v5 = new ArrayListddm2 (); } public String topicpath(){return getServletContext().getRealPath()+/tp/;} Note that getRealPath isn't guaranteed to return a non-null value: a filesystem isn't guaranteed by the servlet specification, but temporary storage is guaranteed using the temp dir. See the servlet spec for details. public synchronized boolean write () { Why synchronized? String fn=fntopics; boolean ok=true; try { String spath = topicpath(); FileOutputStreamfs = new FileOutputStream (spath+fn); ObjectOutputStreamos = new ObjectOutputStream(fs); os.writeObject (v5); os.close ();} catch (IOException e) {ok=false;} return ok;} public synchronized booleanread () { String fn=fntopics; boolean ok=true; ArrayListddm2v5tmp=null; try { String spath = topicpath(); FileInputStreamfs = new FileInputStream (spath+fn); ObjectInputStreamos = new ObjectInputStream(fs); v5tmp = (ArrayListddm2) os.readObject (); os.close (); } catch (IOException e) {ok=false;} catch (ClassNotFoundException e) {ok=false;} if (ok)if (v5tmp != null) v5=v5tmp; return ok;} } Why do you catch exceptions and return error codes? You like C-style return codes instead of the elegance and clarity of exceptions? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyqD2AACgkQ9CaO5/Lv0PCg4gCgni4RiDBJpyernjkWo48ENrCL Pz4AoLu28l17XZwK22+sGW7AVQZcM19/ =B03Y -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org