comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * URLencoder - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74953a1a8483b844 * JavaMail sending email with no body content - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2cec1a6c35fb18e1 * Help me to play Applet offsite - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7bae00b6b2e87de7 * jsp <c:out> - question - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/25a37d7357bbaca7 * How to restrict direct access to JSP files, only allow access via servlet? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/514c912d89045a82 * Using hobby source code in your job ? - 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a60dfe865a7807c4 * Relayout of JFrame? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b187f0e6674dae98 * Writing double[] with java.nio - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3980b990d3f0150b * Using the Command Pattern and Sockets? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5c34979f54b29d05 * OpenLDAP + java + changing user's passwords - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/aabcc64718ab59bc * "static" prefix - to parallel "this" prefix - 3 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f5dde10882ac2157 * This group is new? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9a9e7de1fff77726 * Tool or IDE for function inlining - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58fb84c0ecba12f0 ============================================================================== TOPIC: URLencoder http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74953a1a8483b844 ============================================================================== == 1 of 2 == Date: Wed, Dec 8 2004 2:39 pm From: "shakah" The exception you either have to catch or declare is: java.io.UnsupportedEncodingException You can import java.io.* or change your code to "throws java.io.UnsupportedEncodingException". == 2 of 2 == Date: Wed, Dec 8 2004 10:42 pm From: "Ann" import java.io.UnsupportedEncodingException; "stud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm trying to compile next code > I get this error: > cannot resolve sysmbol class UnsupportedEncodingException > > what should I do? > > import java.sql.*; > import java.rmi.*; > import java.net.URLEncoder; > > public class SessionIDUtility { > public static String generateSessionID() throws > UnsupportedEncodingException { > String uid = new java.rmi.server.UID().toString(); > return java.net.URLEncoder.encode(uid, "UTF-8"); > } > > public static void writeSessionValue(Connection con, String SessionID, > String name, String value) { > // write record to database for the provided sessionID > ....................... > > ============================================================================== TOPIC: JavaMail sending email with no body content http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2cec1a6c35fb18e1 ============================================================================== == 1 of 1 == Date: Wed, Dec 8 2004 11:27 pm From: Graeme Hill On 8 Dec 2004, Steve D. Perkins wrote: > Hey everybody - > > I'm wondering if anyone's ever seen this issue before. I'm sending > plain SMTP emails in a JSP (on WebSphere 4) using JavaMail 1.3.2, and the > messages are being received with no body. > > Below is the basic gist of the block of code sending the emails. I > know some things may look funny (specifying the SMTP server address in > Transport.connect() rather than in the Properties object passed to the > Session constructor, etc)... but I had some weird issues getting the app > to resolve to the right mailserver box, and this is the version of code > we came up with that actually results in emails being sent: > > > Session mailSession = > Session.getDefaultInstance(new Properties();, null); > > MimeMessage mimeMessage = new MimeMessage(mailSession); > mimeMessage.setFrom(new InternetAddress("[EMAIL PROTECTED]")); > InternetAddress[] address = > InternetAddress.parse("[EMAIL PROTECTED]", false); > mimeMessage.setRecipients(Message.RecipientType.TO, address); > mimeMessage.setSubject("Test @ " + new Date().getTime()); > > MimeBodyPart mimeBodyPart = new MimeBodyPart(); > mimeBodyPart.setText("This is a\ntest\n"); > > Multipart multiPart = new MimeMultipart(); > multiPart.addBodyPart(mimeBodyPart); > > mimeMessage.setContent(multiPart); > mimeMessage.setSentDate(new Date()); > > Transport transport = mailSession.getTransport("smtp"); > transport.connect("mail.myserver.com", null, null); > transport.sendMessage(mimeMessage, > mimeMessage.getAllRecipients()); > > > I know that the version of JavaMail shipping with WebSphere 4 is > older than 1.3.2, and this newer JAR may be unsupported and causing > compatibility issues. To be safe, we'll be reverting back to the out-of- > box configuration when the environment is rebuilt this evening. However, > my gut still tells me there has to be something else in play. Has anyone > else seen this issue before, and/or have any thoughts on what the > solution may be? Thanks in advance! > > > > I've gone back to some code I did : Multipart mp = new MimeMultipart(); MimeBodyPart mbp = new MimeBodyPart(); String text = "This is a test"; mbp.setDataHandler(new DataHandler(new ByteArrayDataSource(text, "text/plain"))); mp.addBodyPart(mbp); The difference is I set a DataHandler [can't remember why !]. One thing I found is that the target email client can cause problems. We have a java email distribution system at work which normally sends HTML emails [not my idea I hasten to add] and on Novell Groupwise it comes up as a blank email or attachment, and on Pegasus, the entire client app crashes. So I would use a simplistic and reliable client for testing that won't try and hide bits of the email. ============================================================================== TOPIC: Help me to play Applet offsite http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7bae00b6b2e87de7 ============================================================================== == 1 of 3 == Date: Wed, Dec 8 2004 2:54 pm From: "Jenny" Hi, I have a chess applet that I want to play offsite, say in a folder c:/chess. Here is the website. http://www.geocities.com/SiliconValley/Grid/6544/cccintro.htm What are the files I need to copy into the folder. I tried to copy cccintro.htm and the applet's .jar file. But it does not work. I do not need other items on the page, only the chess applet. Thanks a lot. Jenny == 2 of 3 == Date: Wed, Dec 8 2004 11:48 pm From: "Ann" "Jenny" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I have a chess applet that I want to play offsite, say in a folder > c:/chess. Here is the website. > > > http://www.geocities.com/SiliconValley/Grid/6544/cccintro.htm > > What are the files I need to copy into the folder. I tried to copy > cccintro.htm and the applet's .jar file. But it does not work. I do > not need other items on the page, only the chess applet. > Thanks a lot. > > Jenny I tried it too, and got the following message. I'm not up on security but maybe someone else can help. I also tried removing almost everything except the applet part and get the same result, so it is definately the applet causing the trouble. C:\>appletviewer cccintro.htm java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM) at java.security.AccessControlContext.checkPermission(AccessControlContext.java :269) at java.security.AccessController.checkPermission(AccessController.java:401) at java.lang.SecurityManager.checkPermission(SecurityManager.java:524) at java.lang.SecurityManager.checkExit(SecurityManager.java:736) at java.lang.Runtime.exit(Runtime.java:88) at java.lang.System.exit(System.java:715) at coffeecc.init(coffeecc.java) at sun.applet.AppletPanel.run(AppletPanel.java:353) at java.lang.Thread.run(Thread.java:534) == 3 of 3 == Date: Wed, Dec 8 2004 11:58 pm From: "Ann" "Ann" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Jenny" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi, > > > > I have a chess applet that I want to play offsite, say in a folder > > c:/chess. Here is the website. > > > > > > http://www.geocities.com/SiliconValley/Grid/6544/cccintro.htm > > > > What are the files I need to copy into the folder. I tried to copy > > cccintro.htm and the applet's .jar file. But it does not work. I do > > not need other items on the page, only the chess applet. > > Thanks a lot. > > > > Jenny > > I tried it too, and got the following message. I'm not up on security > but maybe someone else can help. I also tried removing almost everything > except the applet part and get the same result, so it is definately the > applet causing the trouble. > > C:\>appletviewer cccintro.htm > java.security.AccessControlException: access denied > (java.lang.RuntimePermission exitVM) > at > java.security.AccessControlContext.checkPermission(AccessControlContext.java > :269) > at java.security.AccessController.checkPermission(AccessController.java:401) > at java.lang.SecurityManager.checkPermission(SecurityManager.java:524) > at java.lang.SecurityManager.checkExit(SecurityManager.java:736) > at java.lang.Runtime.exit(Runtime.java:88) > at java.lang.System.exit(System.java:715) > at coffeecc.init(coffeecc.java) > at sun.applet.AppletPanel.run(AppletPanel.java:353) > at java.lang.Thread.run(Thread.java:534) > Since you are only interested in running the game, I went to the author's web site download page: http://www.nchess.com/download.html scroll down to freeware section and download the zip file. unzip in a directory and run "cccmain.htm" it works fine. ============================================================================== TOPIC: jsp <c:out> - question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/25a37d7357bbaca7 ============================================================================== == 1 of 1 == Date: Wed, Dec 8 2004 11:02 pm From: "Murray" "ctyberg" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thank you! It worked. > > Here's my next question. > > I want to get an object from the session, but I need to refer to the > object by using a request parameter. How would I do it? > > <c:set var="varName" scope="request" value="${param.varName}"/> > <c:set var="view" scope="request" > value="${sessionScope.WouldLikeToPutVarNameHere}"/> > sessionScope[varName] ============================================================================== TOPIC: How to restrict direct access to JSP files, only allow access via servlet? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/514c912d89045a82 ============================================================================== == 1 of 1 == Date: Wed, Dec 8 2004 6:16 pm From: "John C. Bollinger" Ryan Stewart wrote: > "John C. Bollinger" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> I happen to agree with Alan that JSPs that are complete pages and are >>used as such should not be placed under WEB-INF. There are multiple >>mechanisms available for preventing direct access to the JSPs; putting >>them under WEB-INF is unnecessary, unconventional (according to my reading >>of the Sun convention), and confusing. >> > > Since this whole thread is supposed to be about preventing direct access to > JSPs, would you mind sharing the mechanisms you mentioned? Some are configuration-dependent: 1) In an Apache/Tomcat setup, for instance, you can configure access control in Apache so that requests for the JSPs is denied with your choice of HTTP error response. 2) Specific servlet containers may offer access-control functionality similar to (1). 3) As mentioned elsewhere in this thread, you can use servlet mappings to map requests for JSPs to requests for the controller servlet (or for an error page). This may not appropriate for JSPs to which you intend to dispatch requests, however. There is at least one mechanism that is completely portable across containers supporting Servlet 2.3 and above: 4) Configure a simple filter to block or deflect external requests for the JSPs while allowing requests to be dispatched to them internally. John Bollinger [EMAIL PROTECTED] ============================================================================== TOPIC: Using hobby source code in your job ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a60dfe865a7807c4 ============================================================================== == 1 of 5 == Date: Wed, Dec 8 2004 10:54 pm From: Albert van der Horst In article <[EMAIL PROTECTED]>, Grant Wagner <[EMAIL PROTECTED]> wrote: >The bottom line is that if you write code for a living, you have to deal with >the idea that at any time, for any reason, a past, present or future employer >(or anyone else for that matter) can claim ownership of your idea. When that >happens (if it ever does) you'll have to determine then whether it's worth >fighting for. In case the idea is there before you are employed, you must pre-empt by using a GPL copyright, and publishing. Then if you are using the same idea at an employers you point out that re-implementing doesn't violate copyright. They should be happy, you being the sensible person that you are. They will ask you to give them extra rights in writing, but you should simply refuse to do so. There will be a lot of blather and booh's, but they will have to - use the original and accept their code becomes GPL-ed - believe you are sensible and will never try to sue them, than re-implement or - give up This is of course because published GPL code is effectively owned and defended by the public, which includes IBM, a company with deep pockets and good lawyers. >Grant Wagner <[EMAIL PROTECTED]> Groetjes Albert -- -- Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS One man-hour to invent, One man-week to implement, One lawyer-year to patent. == 2 of 5 == Date: Thurs, Dec 9 2004 12:57 am From: Flash Gordon On 08 Dec 2004 22:54:20 GMT Albert van der Horst <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Grant Wagner <[EMAIL PROTECTED]> wrote: > >The bottom line is that if you write code for a living, you have to > >deal with the idea that at any time, for any reason, a past, present > >or future employer(or anyone else for that matter) can claim > >ownership of your idea. When that happens (if it ever does) you'll > >have to determine then whether it's worth fighting for. > > In case the idea is there before you are employed, you must pre-empt > by using a GPL copyright, and publishing. > > Then if you are using the same idea at an employers you point out > that re-implementing doesn't violate copyright. > They should be happy, you being the sensible person that you are. > They will ask you to give them extra rights in writing, but you > should simply refuse to do so. A lot of companies will simply refuse to use code that means they have to GPL their products. They would probably not continue to employ someone who gave that as the only option. > There will be a lot of blather and booh's, but they will have to > - use the original and accept their code becomes GPL-ed > - believe you are sensible and will never try to > sue them, than re-implement > or > - give up > > This is of course because published GPL code is effectively owned > and defended by the public, which includes IBM, a company with > deep pockets and good lawyers. This is incorrect. The public does *not* own GPL code, the copyright owners do. The copyright owners are therefor free to release identical code under another licence or sell it if they wish. Look at Cygwin and QT for two examples of code available both under GPL and commercial licenses, there are others. -- Flash Gordon Living in interesting times. Although my email address says spam, it is real and I read it. == 3 of 5 == Date: Thurs, Dec 9 2004 1:48 am From: Keith Thompson Albert van der Horst <[EMAIL PROTECTED]> writes: [...] > This is of course because published GPL code is effectively owned > and defended by the public, which includes IBM, a company with > deep pockets and good lawyers. If you insist on posting legal advice to Usenet, please either post *correct* legal advice, or post it to a newsgroup where it's topical. -- Keith Thompson (The_Other_Keith) [EMAIL PROTECTED] <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> We must do something. This is something. Therefore, we must do this. == 4 of 5 == Date: Wed, Dec 8 2004 5:51 pm From: Jim P Enough of this IP argument. and about prior work and Home / Hobby work. The reason that I am hired is that I have a long history of prior skills and knowledge. This is not just related to Software and programming. But my skills in hardware design, In microprocessor design, Analog designs. and over all system designs. These skills, I carry with me to any new job. I respect the market place of the prior work and technology directly related to that project. But because I learn how to use the Motorola (FreeScale) MC68HC908AZ60 micro does not mean that I can not use that micro in an other project. or claim prior knowledge and demand IP protection and rights. It is these skills that get me hired for the next project. It is the skills that I have, the tools that I have learned and developed that get me the job over a kid just out of school with an empty toolbox of tricks - - - - and then demand that I get a license to allow them to use these tricks and tools of the trade. That is right- they are simply the tools of the trade. Would you hire a person to do your floors and he has never done a floor before. - - my lady friend hired a person to do her deck. It turns out it was his second deck that he ever did. - - oh boy called learning on the job. - - If all you have done is build a set of tools and they are nothing more than the tools of the trade. and expect them to pay for that. Forget it. You will come off wrong. - - - They also expect you to know the language or able to pick it up fast. That is called tools of the trade. And note that the tools or concepts or tricks carry from one language to an other. Just as my real time monitor for the 65C02 micro was done in Assembly and then redone in C for the 80C552 micro and now the 68HC908 series in C. and is going thou an other evolution in terms of performance and features. and I can demand a license and royality for this. - - - not really it is simply one of the tools of the trade. Just as the guy that did her deck, He had the nail guns and saws. Just did not know how to use them or design the deck. (30% extra wood in the deck) and many other aspects were wrong. - - even blocking the faucet so that it is hard to use. We are expected to have experience and thus prior work and skills. and code ideas and concepts. ------------------- so what is done on the side or as a hobby or prior has to be more than just tools of the trade. It has to be something that was clearly done prior to work at the company and this means mentioned up front. Any home or side or hobby work must clearly be not related to your job or company market place. Or it is the companies, Unless you make an arrangement to do a task on the side for them. and they know it is going on and it is on your time. Again the prior arrangement. TO do it and then try to sell it to the company is like trying to hold them up. I have a renter in my house that tried this. Got hired by a company full time and then designed something for them to sell and demanded royalities on it. The company balked - - as they would - - his employment was to design things for them to sell. Then he would go to work and in his anger just sit and do nothing all day. After a while they let him go. So he sued them and that just made them mad at him. The product was small % of their total sales so they dropped it and refused to pay him, His attorney was demanding Millions - - He was willing to accept less when they balked. He fired the attorney and then tried to talk to them about it and lower number. They refused to deal with him any more. It cost him a lot more than it cost them. and they knew that. But he was hired to design for them. Just like if I was an engine designer for General Motors. Am I to expect to get a royality from my work. A raise if I do a good job, A bonus if I do a real good job or something special or other reward but not for simply doing my job. This requires a person to be thinking about work more than simply being a 8 to 5 employee. And turns off work at the door. I say this as a person that has patents in my name and more applied for at this point in time. And guess what - the company made sure that they get the rights to the patents. So as I can not hold them hostage and demand high royalites or other compensation after they spend millions bringing the product into production. - - - that is called putting a gun to their head. and of course they will not like that and it will leave a level of resentment. But they will reward a person for this. Raises. They do not want this guy to leave. If he can do this - - why let him leave and work for someone else and maybe a company that competes against them. In my case caused lots of more consulting work for the companies that I worked for. Will a person that simply looks as his job as 8 to 5 and can't wait to go home at night and turns of work at the door going to come up with the type of ideas and thoughts that will drive a company forward. I do not think so. His mind is else where. This is life, face it, it is this way for a reason and not just because companies want it that way. But because it works. Jim P. Flash Gordon wrote: > On 08 Dec 2004 22:54:20 GMT > Albert van der Horst <[EMAIL PROTECTED]> wrote: > > >>In article <[EMAIL PROTECTED]>, >>Grant Wagner <[EMAIL PROTECTED]> wrote: >> >>>The bottom line is that if you write code for a living, you have to >>>deal with the idea that at any time, for any reason, a past, present >>>or future employer(or anyone else for that matter) can claim >>>ownership of your idea. When that happens (if it ever does) you'll >>>have to determine then whether it's worth fighting for. >> >>In case the idea is there before you are employed, you must pre-empt >>by using a GPL copyright, and publishing. >> >>Then if you are using the same idea at an employers you point out >>that re-implementing doesn't violate copyright. >>They should be happy, you being the sensible person that you are. >>They will ask you to give them extra rights in writing, but you >>should simply refuse to do so. > > > A lot of companies will simply refuse to use code that means they have > to GPL their products. They would probably not continue to employ > someone who gave that as the only option. > > >>There will be a lot of blather and booh's, but they will have to >>- use the original and accept their code becomes GPL-ed >>- believe you are sensible and will never try to >> sue them, than re-implement >>or >>- give up >> >>This is of course because published GPL code is effectively owned >>and defended by the public, which includes IBM, a company with >>deep pockets and good lawyers. > > > This is incorrect. The public does *not* own GPL code, the copyright > owners do. The copyright owners are therefor free to release identical > code under another licence or sell it if they wish. Look at Cygwin and > QT for two examples of code available both under GPL and commercial > licenses, there are others. == 5 of 5 == Date: Wed, Dec 8 2004 7:29 pm From: Ben Pfaff Jim P <[EMAIL PROTECTED]> writes: > Enough of this IP argument. > > and about prior work and Home / Hobby work. Yes, I agree. Do you have a question about Borland Delphi, C, C++, Java, and Pascal? ============================================================================== TOPIC: Relayout of JFrame? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b187f0e6674dae98 ============================================================================== == 1 of 1 == Date: Wed, Dec 8 2004 4:08 pm From: Knute Johnson Babu Kalakrishnan wrote: > Knute Johnson wrote: > >> I've got a JFrame app that has several components laid out with >> GridBagLayout. One of the components is a JPanel that I draw an image >> on. This component occaisionally can change size. After I resize my >> JPanel, I invalidate it, repaint it and then call pack() on the JFrame. >> Is there a way to cause the JFrame to relayout the components but not >> shrink to fit the layout as it does with pack() but still grow if >> necessary? >> > > I'm afraid nothing that does it automatically. But you can always query > the panel for its preferredSize and set the size of the frame > appropriately - making it bigger if required, but not shrinking it if > that is the case. > > BK Thanks very much. That's kind of what I figured. -- Knute Johnson email s/nospam/knute/ ============================================================================== TOPIC: Writing double[] with java.nio http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3980b990d3f0150b ============================================================================== == 1 of 3 == Date: Wed, Dec 8 2004 4:44 pm From: [EMAIL PROTECTED] (Derek Waldron) Hi, I have a very large double[] that I want to send across a channel in java.nio. Is there a better way to do this than the following? double[] myarray = new double[very large]; ByteBuffer bb = ByteBuffer.allocate(myarray.length*8); DoubleBuffer db = bb.asDoubleBuffer; db.put(myarray); channel.write(bb); It seems to me that there should be a more direct way by using DoubleBuffer directly, for example: DoubleBuffer db = DoubleBuffer.wrap(myarray); but write only accepts ByteBuffer and so channel.write(db) won't work. Ideally, I would like to avoid the first piece of code because it requires copying the entire array. Any suggestions? Thanks! Derek == 2 of 3 == Date: Thurs, Dec 9 2004 1:30 am From: Esmond Pitt See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4489356 Derek Waldron wrote: > > I have a very large double[] that I want to send across a channel in > java.nio. Is there a better way to do this than the following? > > double[] myarray = new double[very large]; > > ByteBuffer bb = ByteBuffer.allocate(myarray.length*8); > DoubleBuffer db = bb.asDoubleBuffer; > db.put(myarray); > > channel.write(bb); > > It seems to me that there should be a more direct way by using > DoubleBuffer directly, for example: > > DoubleBuffer db = DoubleBuffer.wrap(myarray); > > but write only accepts ByteBuffer and so channel.write(db) won't work. > > Ideally, I would like to avoid the first piece of code because it > requires copying the entire array. == 3 of 3 == Date: Thurs, Dec 9 2004 2:43 am From: "Andrei Kouznetsov" > I have a very large double[] that I want to send across a channel in > java.nio. Is there a better way to do this than the following? > > double[] myarray = new double[very large]; you can use smaller Buffer and transfer your data piecewise in a loop. You can also use Unified I/O to transfer data between arrays with different (primitive) types. -- Andrei Kouznetsov http://uio.dev.java.net Unified I/O for Java http://reader.imagero.com Java image reader http://jgui.imagero.com Java GUI components and utilities ============================================================================== TOPIC: Using the Command Pattern and Sockets? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5c34979f54b29d05 ============================================================================== == 1 of 2 == Date: Thurs, Dec 9 2004 1:12 am From: "Ken Adams" Ok, I don't think I understand the Command Pattern exactly but. Basically I was told the best way to send objects in a Client/Server System was to use ObjectOutputStream and send Command objects which will have an execute method on them and then when the object is passes just call the exectute method for that object. The only problem I have, is how to you get a refrence to an object to invoke inside the execute method since the object you want to invoke is not locally but on the server accross the network. And I want to do this using Sockets instead of using RMI for learning purposes. Any suggestions? Thanks a bunch == 2 of 2 == Date: Wed, Dec 8 2004 8:13 pm From: Phil Staite As I understand it, without RMI you have to make sure that both the tx and rx sides have the same class set. That is, there's no dynamic loading of classes from the server. Otherwise, on the rx side, it won't understand the object it is pulling off the io device. Now, since the rx side won't know what command is coming across, you'll have to abstract it. That is, create a Command interface with the Execute() method on it. Then make sure all your command objects implement that interface. Most likely, you'll have to pass some object(s) to Execute() for the commands to work on. ie. a facade to the "system" on the rx side so that the commands can make use of the services to execute. ============================================================================== TOPIC: OpenLDAP + java + changing user's passwords http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/aabcc64718ab59bc ============================================================================== == 1 of 1 == Date: Thurs, Dec 9 2004 8:49 am From: JScoobyCed Eric Gutierrez wrote: > > 1. Will the user be able login with the new password from the program > below if LDAP server is expecting the password to be encrypted in > SSHA1 (or some other method)? > > 2. Will LDAP automatically encrypt the new plain text password for me > when I run the program below? --how I wish... > > 3. Will I need to write code to encrypt the plain text password to > SSHA1 before giving it to the LDAP server? If yes, where do I start - > any API's out there to do this fast? Hi, I am currently working with LDAP servers (Active Directory and Sun iPlanet), but only in one way reading (that is, I read values from the LDAP server, but I don't write any). Password are encrypted on both server, but when I send a query to create a context, I use the clear text password. I have no problem with that. Now if I read that password, of course I got binary values for the encrypted password. I would say you don't need to encrypt the password to send it to your LDAP server. But in fact that depends on the API you are using. I see you use some netscape package. You should look at the documentation that goes with that API. Now if you need to encrypt data, you should have a look at the JCE API (Java Cryptography Extension) http://java.sun.com/products/jce/index-14.html JCE is part of the J2SDK since it's 1.4.x version. Quoted: "Support for the following algorithms by the SunJCE provider: * DES * DESede * AES (with Java 2 SDK, v 1.4.2) * Blowfish * PBEWithMD5AndDES * PBEWithMD5AndTripleDES * Diffie-Hellman key agreement among multiple parties * HmacMD5 * HmacSHA1 " --- JScoobyCed ============================================================================== TOPIC: "static" prefix - to parallel "this" prefix http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f5dde10882ac2157 ============================================================================== == 1 of 3 == Date: Wed, Dec 8 2004 10:24 pm From: "Darryl L. Pierce" Tim Tyler wrote: >>>Most of the uses of the classname are redundant. To see that, change >>>the name of the class. All the uses of the classname (within the >>>body of the class) that have to change with it are redundant. >> >>Change the name of an instance variable. All the uses of the variable >>(within the body of the class if not the clients of the class) that have >>to change with it are redundant. > > Nonsense: they say which variable you are talking about. > > Within the definition of a class you shouldn't need to spell out > the name of the class - you /should/ just be able to say "this class". You don't *have* to mention the class *except* to clarify the context, just as you do when you use the "this" keyword. If using the classname is "redundant" then so would using "static" and "this" since they are used *for* the *same* reason: to clarify for the compiler the *specific* variable to which you're referring when there's ambiguity in the usage. >>BTW, the above scenario doesn't happen in Eclipse: you refactor and >>rename the class and all of those references are updated. *AND* the >>references in *other* classes are updated too. Which brings up an >>interesting question: how will you refer to static methods/variables in >>*other* classes? Are we going to keep the ClassName.staticField pattern? >>If so, then we now have *two* ways of doing the *exact same thing* which >>to my mind makes the static keyword even *less* attractive. > > Actually there would be three ways: > > "ClassName.var" > "var" > ....or... > "static.var". > > They don't say quite the same thing as each other - though they > would all refer to the same static variable. And how does the above tell you *which* other class you're referring to? I asked above "how will you refer to static methods/variables in *OTHER* (new emphasis) classes?" In this scenario "static" brings nothing new to the table and you will *still* have to type the classname to provide context to the compiler. So, in deference to your claiming it's redundant data, it's actually quite necessary and there's little need to have *two* ways to do the same thing... -- Darryl L. Pierce <[EMAIL PROTECTED]> Visit my webpage: <http://mcpierce.multiply.com> "By doubting we come to inquiry, through inquiry truth." - Peter Abelard == 2 of 3 == Date: Wed, Dec 8 2004 10:26 pm From: "Darryl L. Pierce" Tim Tyler wrote: > Java's "static" context is an irregularitly - and an unnecessary one. > > If - for whatever arcane security reason, class members can't be > associated directly with the class objects, they ought at least to > be associated with *some* object. > > Otherwise you wind up with the Java situation - where there's a > whole bunch of extra material in the JLS to deal specifically > with static entities, how they are (or aren't) inherited - what > happens when a member variable overrides a static one in an > inherited class - and so on - all pointless irregularity that > makes the langage harder to learn, and makes parsers and compilers > more difficult to write. That scenario is already specifically handled: the descendant class's variable *hides* the parent class's variable, just as it would with a method. You don't inherit static fields or methods: they are explicitly tied to the class in which they're defined. -- Darryl L. Pierce <[EMAIL PROTECTED]> Visit my webpage: <http://mcpierce.multiply.com> "By doubting we come to inquiry, through inquiry truth." - Peter Abelard == 3 of 3 == Date: Wed, Dec 8 2004 10:28 pm From: "Darryl L. Pierce" Tim Tyler wrote: <snip> Also, I wanted to mention that in the below code: public class FooParent { public static String bar = "parent"; } public class FooChild extends FooParent { public static String bar = "child"; } public class FooTest { public static void main(String[] args) { FooParent foo = new FooChild(); System.out.println(foo.bar); } } the output is "parent" because the *reference* is to a FooParent reference and so the compiler resolves the static reference to the class variable for *that* type. -- Darryl L. Pierce <[EMAIL PROTECTED]> Visit my webpage: <http://mcpierce.multiply.com> "By doubting we come to inquiry, through inquiry truth." - Peter Abelard ============================================================================== TOPIC: This group is new? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9a9e7de1fff77726 ============================================================================== == 1 of 1 == Date: Wed, Dec 8 2004 10:31 pm From: "Darryl L. Pierce" Chris Smith wrote: >>lots of person > > The comp.lang.java.programmer programmer has been in existence since > July 11, 1996. So no, it's definitely not new. Prior to that date, > there was a cmp.lang.java, which was split up into this group and > several others. And prior to that...there wasn't Java. :) -- Darryl L. Pierce <[EMAIL PROTECTED]> Visit my webpage: <http://mcpierce.multiply.com> "By doubting we come to inquiry, through inquiry truth." - Peter Abelard ============================================================================== TOPIC: Tool or IDE for function inlining http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58fb84c0ecba12f0 ============================================================================== == 1 of 1 == Date: Thurs, Dec 9 2004 3:55 am From: "FunkyKarma" > > I need to inline my functions bodys into caller functions. Please > > suggest me a good tool or IDE for refactoring. > > Why do you need to do this? Most JIT compilers will do this > automatically at run time where appropriate. > While JIT compilers and Java source compilers should do this in some situations, it has been my experience that it doesn't (always) happen. I suppose sometimes method visibility and lack of being final may explain some of it, but still the bottom line is that I've experienced performance benefit by inlining by hand. I too would like to see an easy to use tool to make this happen. Or better yet the introduction of macros and/or language keywords to facilitate it. Although I know that's not at all likely to happen. I've heard of people using C precompilers to do some of this but that approach is cumbersome at best. ============================================================================== 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
