comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Stuff the purple heart programmers cook up - 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ff788c5b12bf8d8f * tomcat context url - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d7aac41540a959a * Is there a Class like HashMap, but... - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90f6b5fefbb8ee0a * general question to aspect-oriented-programming - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ba3a34b7dbbe497a * How too.. ?? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fd299b7c69eb3e1a * port 8080 - 3 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f82ca0681ab641a2 * where is everybody - 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b9a589a8cfda9bef * Manipulating audio data with filters - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d2a1f098702a36ec * javadoc produces IllegalArgumentException - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/95a65bfb474fc687 * Custom Protocol over TCP - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4b24f908bd6b6b6b * server-side development definition - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9310557837cccc02 * Third tapestry tutorial available - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2fd437521a3729b7 * JSP formatter - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1ce540f74e3ceac6 * acceptable way to program - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/829184c5bd6bb8b0 ============================================================================== TOPIC: Stuff the purple heart programmers cook up http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ff788c5b12bf8d8f ============================================================================== == 1 of 4 == Date: Thurs, Dec 30 2004 2:07 pm From: "Last Timer" Stuff the purple heart programmers cookup. Topic: Java 2: Survey Author: Serban Popescu What is the likely reason that the most important members contained in the java.sql package, such as Connection, Statement, ResultSet and Driver, are defined as interfaces instead of classes? A Interfaces are easier to use. B To make the platform independence easier. C To act like a framework for the JDBC driver developers. D To hide the specifics of accessing particular kinds of database systems. E It was a choice of the JDBC developers. Topic: Java 2: Survey Author: Serban Popescu What is most likely the output of the following sample of code? public void sortTest() { byte [] b = new byte[ 15 ]; new Random().nextBytes( b ); System.out.println( Arrays.binarySearch( b, b[ 5 ] ) ); Arrays.sort( b ); } A Displays the location of the fifth element in the byte array. B Displays the fifth element in the byte array. C The results displayed cannot be predicted. D It fails to execute because an array of bytes cannot be sorted. E Displays an array of 15 random numbers between -127 and 128. Topic: Java 2: Survey Author: Chris Mc Devitt The JDBC ResultSet is actually an interface java.sql.ResultSet. Which of the following is a true statement regarding the implementation of this interface? A The Statement class returns an interface which must be implemented by the programmer in order to use the ResultSet. B The programmer must implement a local class called ResultSet in order to use methods from the interface. C The implementation is determined by the Statement class. The specific implementation, which is JDBC driver dependent, is returned when execute() is called. D The actual implementation of the ResultSet interface is determined by the Statement instance, the programmer calls getResultSetImpl() from the Statement class to get it. E The interface is implemented by the JVM so the programmer can simply use methods from this interface. Which one of the following variable types is associated with a specific Java object? A final variables B instance variables C global variables D class variables E local variables In the following sample of code, the compiler complains about InterruptedException. public void someMethod() { ... Thread t = new SomeThread(); .... t.start(); ... t.sleep( aWhile ); ... } What most likely causes the compilation problem? A The start() method declares it can throw an InterruptedException. B The sleep() method is called after the start() method. C The thread 't' is not declared as SomeThread. D The exception is not caught inside the some Method()'s code. E The sleep() method declares it can throw an InterruptedException. What is the character encoding that Java uses to support internationalization? A The Thai Character Encoding. B The Unicode character encoding. C The ISO-Latin-1 subset of Unicode. D The ASCII character encoding. E The Tamil Encoding Standard A common problem when writing programs that use multiple threads is having two or more threads access a shared data item at the same time. What mechanism does Java provide to help avoid this situation? A The shared data item should be declared as static data. B The shared data item should be accessed through a method call and the method must be public. C The first thread to gain access to the item must put a lock on it via a synchronized block. D The shared data item must be declared within at least one of the threads attempting to access it. E Access to the shared data item should be done through a method call and any code manipulating the shared resource should be placed within a synchronized block so that access to the resource is single threaded. What standard Java API class should one use to store a list of localized strings? A java.util.ResourceBundle B java.util.ListResourceBundle C java.util.LocaleStringBundle D java.util.LocaleStringList E java.util.PropertyResourceBundle What is the purpose of the wait and notify mechanism? A It is a thread synchronization mechanism. B It allows objects to communicate. C It makes the OO programming easier. D It allows synchronization and communication between threads. E It is used to increase the JVM performance. What will a programmer do to define a bundle of localized resources? A Use the ListResourceBundle class. B Subclass either ResourceBundle class or provide a property file. C Use the Locale class. D Use a localized Dictionary class. E Subclass either the Collator class or Format class. When using the JDBC API the programmer will obtain a Connection object from the DriverManager. A Connection object has a method called PrepareStatement()which returns a PreparedStatement object. Which of the following best describes this method? A This method takes the SQL to be executed as a String and returns the pre-compiled statement that is to be executed as long as the driver supports pre-compilation. B This method takes the SQL to be executed as a String and stores that in a buffer with the DriverManager to be executed later. C This method returns an empty PreparedStatement object that can then be populated with the actual SQL that is to be run. D This method initializes the database and is required prior to executing any SQL statements. E This method takes the SQL to be executed as a String and returns a PreparedStatement object which should be used with all SQL queries. What is most likely the difference between a Collection and a Set? A There is no difference in terms of functionality. B A Set can contain only subclasses of the Number class. C A Collection contains only ordered elements. D The Set interface models the mathematical set abstraction. E Set is a Collection that contains no duplicate elements. Which of the following statements will throw a NumberFormatException? 1. Integer.parseInt( "-30" ); 2. Integer.parseInt( "300", 16 ); 3. Integer.parseInt( "283", 8 ); 4. Integer.parseInt( "3E9", 15 ); 5. Integer.parseInt( "250s" ); 6. Integer.parseInt( "250.99" ); 7. Integer.parseInt( "+112" ); 8. Integer.parseInt( "7AC9", 13 ); A 1,2,6 & 7 B 1.2,4 & 8 C 3,5,6 &7 D 1,2,6 & 8 E 3,5,6 & 8 JDBC is a Java API for executing SQL statements. JDBC provides a standard API for tool/database developers so that they can write database applications using a pure Java API. JDBC makes it most possible to: A Write platform independent database applications. B Process results after executing an SQL statement. C Send SQL statements. D Connect to databases. E A, B, C and D are correct. F B, C and D are correct. Which of the following best describes the differences between a Statement object and a PreparedStatement object? A The PreparedStatement object extends the Statement object and therefore should be used with databases for which there is no JDBC driver. B The PreparedStatement object should only be used when there are no parameters for the query, while the statement object should be used for parameterized queries. C For each SQL query sent to the database the Statement object will go through a compilation/optimization phase whereas the PreparedStatement only does this when directed to do so by a parameter. D The PreparedStatement object is pre-compiled and optimized. The PreparedStatement object supports parameterized queries while the Statement is compiled with every call and does not support parameters in the query. E The Statement object is serializable while the PreparedStatement is not. Which are the Java classes that can most likely convert between Unicode and the character encoding set supported by the Java 2 platform? A InputStreamReader, OutputStreamWriter, String and Character. B String and Character. C The subclasses of Reader and Writer. D Java does not have classes that perform such conversion. E InputStreamReader, OutputStreamWriter, and String. After executing this sample of code, which will be the most likely number of active threads? public class ThreadGroupTest { public static void main( String[] args ) { ThreadGroup tg = new ThreadGroup( "TG" ); for( int i = 0; i < 100; i++ ) { Thread t = new Thread( tg, "T" + i ); t.start(); if( i%2 == 0 ) { t.stop(); t = null; } } System.out.println( tg.activeCount() ); } } A The number of active threads will be 100. B The number of active threads cannot be determined. C The number of active threads will be 50. D The number of active threads will be 0. E The number of active threads will be less than 50. What is most likely the purpose of the following statement? Reader r = new BufferedReader( new InputStreamReader( System.in, System.getProperty( "file.encoding" ) ) ); A This statement writes characters to the console. B This statement reads characters from the console. C This statement reads characters from the console in the system's character encoding. D This statement reads characters from a file in the system's character encoding. E This statement reads characters from a file. What is most likely the output of the following sample of code? public void listTest() { List al = new ArrayList(); for( int i = 0; i < 100; i++ ) { if( i % 2 == 0 ) al.add( new Integer( i ) ); } List ll = new LinkedList( al ); for( Iterator lIt = ll.iterator(); lIt.hasNext(); ) { System.out.println( lIt.next() ); } } A It displays the even numbers between 0 and 100. B It displays the odd numbers between 0 and 100. C It displays all numbers between 0 and 100. D The compilation will fail because in Java the Iterator class does not exist. E An ArrayList cannot be copied in a Linked List. An exception will be raised. Which of the following import statements is in error? A import java.*; B import * C import java.awt.Color; D import java.awt.*; E import java.util.Calendar; SQLInput, SQLOutput and SQLData are interfaces used to: A handle special SQL types. B handle SQL queries. C read, write and manage the custom mapping of SQL user-defined types. D manage the update counts with a batch of commands. E handle data retrieved from the database. Topic: Java 2: Java Servlets Author: Chris Mc Devitt A condition that may occur when a servlet is processing data and getting ready to send a response is the user may hit the Stop button on the browser. Which of the following is the correct flow in the servlet under this condition? A The servlet is interrupted with a signal and should cease immediately. B The servlet gets an exception when attempting a write. The servlet should free its resources in a finally block when this exception is thrown. C The servlet is not notified that the client has disappeared. The response is sent and the web server knows not to forward the response. D The servlet knows that the client has disappeared only when performing the write. The write throws an exception and the servlet should end immediately. E The servlet is interrupted with a signal and should send a status code back indicating that it was interrupted. Which of the following is not a valid state for an entity bean to be in at any given time? A No state: When the entity bean is in this state it has not been instantiated yet. B Pooled and suspended state: This is when the entity bean is in the instance pool but its execution is suspended. C Multithreaded state: This is any time that the entity bean has initiated a separate thread of execution. D Ready state: This is when the bean instance has been associated with an EJB object and is ready to respond to method calls. E Pooled state: This is when the entity bean has been instantiated but has not been associated with an EJB object. Topic: Java 2: Java Databases Author: Neal Ford The developer is designing a large scale series of untrusted applets that must connect to JDBC databases. What type of JDBC driver(s) provides the most flexibility in terms of where the database can be located in relation to the web server? A JDBC Type 3 B JDBC Type 3 and Type 4 C JDBC Type 1 D JDBC Type 2 E JDBC Type 4 F None of the JDBC drivers work with untrusted applets Topic: Java 2: Enterprise JavaBeans Author: Chris Mc Devitt Suppose two different clients call the same business method on the same stateless session bean at exactly the same moment. Which of the following accurately describe what happens within the server? A The EJB server prevents this from happening by serializing these requests so that on the server it appears as if one request is received before the other so there are no contention problems. B The EJB server reads the SessionContext of the available instances of the invoked session bean to determine which one should service which client. C The server associates an instance from the Method-Ready pool with a given EJBObject and calls the business method that was invoked. It does the same thing with a second instance. Each instance can not determine the exact client that made the request. D The EJB server will use a round robin method of determining which instance of the bean should handle each request once the order is determined the server creates the instance to handle the requests. E The server will associate individual instances with each request and will set the SessionContext making it possible for each instance to obtain information about the client. Topic: Java 2: Java Databases Author: Serban Popescu Disabling the AutoCommit mode of the Connection interface: A kills the connection with the database. B does not allow the retrieving of results after executing a query. C allows the application to decide when to commit statements. D allows the application not to commit the transaction. E prevents the execution of a query. Topic: Java 2: Java Servlets Author: Chris Mc Devitt Java servlets handle requests using the HTTP protocol. This is a request/response oriented protocol. When creating a Java servlet which of the following best characterizes the relationship between the servlet and the HTTP protocol? A Since the HTTP protocol is stateful the servlet needs to maintain state variables that contain information about the users previous requests. B Your servlet will be a subclass of the HttpServlet class and will be called by the web server when the server receives an HTTP request. C The servlet is a class that runs within the browser and initiates HTTP requests. D The purpose of the servlet is to interpret the fields within the HTTP header and then call a Java class to process the request. E The servlet is called by the web server as the server receives HTTP requests the servlet can be called in this manner because it implements the HttpServlet interface. Topic: Java 2: Enterprise JavaBeans Author: Neal Ford The developer is writing an application using several stateful session beans to handle connectivity to the database. Are there any special considerations that have to be taken for beans of this type? A The database connection object must be marked as protected so that the container will preserve the connection between bean invocations. B No special considerations must be taken. C The database connection must be relinquished in the ejbStore() method and restored in the ejbLoad() method. D Care must be taken to ensure multiple threads cannot access the database connection concurrently. E Database connections must be relinquished in ejbPassivate() and restored in ejbActivate(). F The client connection must be saved in the ejbPassivate() method and restored in the ejbActivate() method. Topic: Java 2: Enterprise JavaBeans Author: Neal Ford You are writing a order tracking application where customers, sales, and inventory are the primary focus of the application. You are developing an EJB that encapsulates Customer information that must write records into a database using a combination of stored procedures. What type of bean(s) should be used to accommodate this requirement? A An Entity bean with bean-managed persistence B A Stateless Session bean C An Entity bean with container-managed persistence D A combination of 2 Stateless Session beans E An entity bean with CallableStatment persistence F An Entity bean with a customized Deployment Descriptor Topic: Java 2: Java Databases Author: Serban Popescu The Blob and Clob interfaces are new built-in types added by SQL 3 and are supported by JDBC 2.0. These interfaces are used to: A represent binary large objects and character large objects. B represent arrays. C represent a SQL reference. D represent large object data types. E represent a SQL structured type. Topic: Java 2: Enterprise JavaBeans Author: Chris Mc Devitt When deploying an entity bean that uses bean managed persistence, which of the following describes the two key components that need to be set in the deployment descriptor? A There must be no container managed fields and the <persistence-type> tag must be set to "Bean". B The container managed fields must be present but empty and the <persistence-type> must be set to "Bean". C The container managed fields must have the server name and the <persistence-type> must be set to "home". D The <method-permission> component must have <role-name> set to "everyone" and the <persistence-type> should be set to "class". E The <reentrant> tag must be set to "true" and the <persistence-type> tag should be set to "instance". Topic: Java 2: Networking Author: Michael Morrison On which port number should custom network communication be performed? A a port number higher than 1024 B a port number higher than 0 C port 21 D port 80 E a port number lower than 1024 Topic: Java 2: Enterprise JavaBeans Author: Neal Ford The developer is creating an application where the number of users will be very high and the network traffic will also be very high. What type of bean will enable the container to most effectively cache bean instances to promote fast invocation time? A A database connection pool will allow any type of bean to respond well to high volume situations. B It doesn't matter, the container will treat all bean types the same with regards of resource allocation, sharing, and invocation time. C A stateless session bean. D A Stateful session bean. E An Entity bean with container-managed persistence. F An Entity bean with bean-managed persistence. Topic: Java 2: Networking Author: Chris Mc Devitt What application technique describes the best way to ensure that a connection opened on a socket is available as often as possible ? A Use the constructor from the Socket class that allows one to register a callback function to be called when the Socket goes down. B Use the test() method, from the Socket class, this method returns true if the Socket is alive, false otherwise. C Application code should only assume that Socket connections are good for a very short period of time. The application should close and reestablish fairly often. D Periodically attempt to write to the Socket and see if the write call throws an exception. E Use the setKeepAlive() method to turn SO_KEEPALIVE on. This will allow the TCP layer to attempt to keep the connection alive. Topic: Java 2: Networking Author: Chris Mc Devitt When using an HttpURLConnection object to establish a connection with a site, how do you tell if the page that you connected to issued a redirect? A Call the getURL() method and check the value of that. B Call the connection.getHeaderField() and check to see if the location is null. C Call the connection.getHeaderField() with "location" as a parameter to get the location field from the HTTP header, compare this with the URL that was connected too. D Call the getRedirect() method from the HttpURLConnection class and check the return for null. E Call the setInstanceFollowRedirects() with a value of false. Topic: Java 2: Java Databases Author: Serban Popescu A very important enhancement was added to the JDBC 2.0 ResultSet interface, which is part of the JDK 1.2. What enhancement was added? A Scrolling types B Concurrency types C Storing the ResultSet in an Array. D Retrieving any type of Object E Retrieving dates and timestamp objects. Topic: Java 2: Java Servlets Author: William Wright What technique or techniques can a servlet engine use to associate a client session with a servlet request? A Cookies or URL rewriting B A hash table of host names C A hash table of session IDs D An object of type SessionMappingAdapter E Cookies Topic: Java 2: Java Servlets Author: Chris Mc Devitt Which of the following best describes the mechanisms for having an object receive notification when it is added to or removed from the current HttpSession? A The object can implement the HttpSessionBindingListener interface. The servlet engine calls the load() method of all objects that implement this interface when session data changes. B The object can implement the HttpSession interface and the notify() method from this class is called by the servlet engine. C The object can implement the HttpSessionBindingListener interface. The valueBound() or valueUnbound() methods are called when the object is added to or removed from the session. D The object can register with the Servlet engine through a properties file. E The object can implement a notify() method, which will be called by the servlet engine when the object is added to or removed from the session. Topic: Java 2: Java Servlets Author: Chris Mc Devitt Which of the following best describes the differences between a GET request and a POST request? A In general POST requests are usually accompanied by a long query string while GET requests are not. B POST requests are used to perform explicit client actions GET requests are not and consequently can not be bookmarked. C GET requests are used when the browser needs to display graphic images while POSTS are used to exchange text. D GET requests are used when the browser needs to read data so the HTTP request body is usually small whereas POST Requests send their data to the server in the HTTP message body resulting in potentially larger request bodies. E GET requests are processed by the servlet engine while POST requests are handed to a doPost() method in a servlet for processing. Topic: Java 2: Java Servlets Author: William Wright In the class HttpServlet, what does the default implementation of the service() method accomplish? A It parses the HTTP input and dispatches requests to the methods that support them. B It does nothing. It must be implemented by a subclass to support HTTP requests. C It initializes the servlet. D It reads the HTTP input data into a file that can be accessed by the servlet. E It returns a success status code to the client and passes the request to its subclass. == 2 of 4 == Date: Thurs, Dec 30 2004 5:50 pm From: "Ryan Stewart" "Last Timer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Stuff the purple heart programmers cookup. [...] Is there a point, or are you just wasting bandwidth? == 3 of 4 == Date: Fri, Dec 31 2004 12:18 am From: Andrew Thompson On Thu, 30 Dec 2004 17:50:48 -0600, Ryan Stewart wrote: > "Last Timer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Stuff the purple heart programmers cookup. > [...] > Is there a point, or are you just wasting bandwidth? The OP forgot to mention they are currently sitting in a room doing this test as part of a job interview/screening, but there is an internetted computer there as well. The OP would appreciate some answers 'real quick', so (checks watch) ..time's a wasting, get to it Ryan, the answers are...? ;) -- 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: Thurs, Dec 30 2004 7:05 pm From: "Ryan Stewart" "Andrew Thompson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The OP forgot to mention they are currently sitting in a room doing > this test as part of a job interview/screening, but there is an > internetted computer there as well. The OP would appreciate some > answers 'real quick', so (checks watch) ..time's a wasting, get > to it Ryan, the answers are...? ;) > lol Guess 'c' ============================================================================== TOPIC: tomcat context url http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d7aac41540a959a ============================================================================== == 1 of 1 == Date: Thurs, Dec 30 2004 2:27 pm From: "bb" I'm unable to access a webapp under tomcat. The webapp is installed under the following directory tree: testserv/ --------tomcat/ -----------4/ -------------/webapps -----------------/emptrack with 'testserv' being the server name. The webapp's context entry in the Tomcat server.xml file follows: <<<<<<<<<<<< START OF CONTEXT ENTRY >>>>>>>>>>>>>>>>> <Context className="org.apache.catalina.core.StandardContext" cachingAllowed="true" charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true" crossContext="false" debug="6" displayName="emptrack" docBase="sys:\tomcat\4\webapps\emptrack" mapperClass="org.apache.catalina.core.StandardContextMapper" path="/emptrack" privileged="false" reloadable="false" swallowOutput="false" useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper"> <Loader className="org.apache.catalina.loader.WebappLoader" checkInterval="15" debug="4" delegate="false" loaderClass="org.apache.catalina.loader.WebappClassLoader" reloadable="false"/> <Logger className="org.apache.catalina.logger.FileLogger" debug="0" directory="logs" prefix="localhost_emptrack_log" suffix=".txt" timestamp="true" verbosity="1"/> <Manager className="org.apache.catalina.session.StandardManager" algorithm="MD5" checkInterval="60" debug="0" duplicates="0" expiredSessions="0" maxActive="0" maxActiveSessions="2" maxInactiveInterval="600" pathname="SESSIONS.ser" randomClass="java.security.SecureRandom" rejectedSessions="0" sessionCounter="0"> </Manager> </Context> >>>>>>>>>>> END CONTEXT <<<<<<<<<<<<<<<<<<<< The webapp is listed in the Tomcat Webapplication Manager Applications List under the URL 'https://testserv/emptrack', but when I try to access it I get a 404 Not Found Error. Other URLs fail as well. This is the default Tomcat installation that comes with Netware. The application is running on the server, named 'testserv' which is running on Novell 6.x. The log files show it to be behaving as expected. The webapp was installed using an exploded .war file via the Tomcat Web Application Manager. It is also present and configurable via the Tomcat Web Server Administration Tool. Any ideas anyone? ============================================================================== TOPIC: Is there a Class like HashMap, but... http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90f6b5fefbb8ee0a ============================================================================== == 1 of 1 == Date: Thurs, Dec 30 2004 2:35 pm From: Scott Ellsworth In article <[EMAIL PROTECTED]>, ByteCoder <[EMAIL PROTECTED]> wrote: > ByteCoder wrote: > > ByteCoder wrote: > > > >> Is there a Class like HashMap, but which only stores the key. > >> > >> Basicly, I want a Class which adds unique objects to it, but which > >> overwrites non-unique objects. > >> > >> TIA, > > > > > > I finally found it, it's the HashSet. :) > > > > One more thing: Does the HashSet has some sort of get method, so that I > don't have to use an Iterator if I just want to get one object? > Or wouldn't that be a problem if my HashSet has about 200 elements? If you want to see whether a given object is in the set, use contains(). If you want to get all the objects in a set, use iterator, and if you just want "any old object", use iterator().next(). Scott ============================================================================== TOPIC: general question to aspect-oriented-programming http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ba3a34b7dbbe497a ============================================================================== == 1 of 1 == Date: Fri, Dec 31 2004 12:05 am From: "Julia Donawald" Hi, I am trying to write a simple aspect with AspectJ for secret-key and public-key encryption of data. I am not that familar with the approach of aspect-oriented-programming, so I am thinking of how to realize it. I started to write a basic aspect for secret-key encryption which uses a function-pointcut from which it get the data to encrypt/derypt and the key. I defined then an advice which is always called when the pointcut is matched. This advice (in my test-example I used an before-advice) takes as input-parameter the data to encrypt/decrypt and the secret-key. It then performs the encryption/decryption functionality and saves the result in a parameter. I wonder now if this is a senseful way writing an apspect for encryption/decryption, cause as I know the aspect should be totally independent from its business-logic. In my case the advice is strongly connected to the keys and the proecessing depends from the key it gets as parameter from the "pointcutted"-function in the business-code. I am thinking now if it would be better to hardcode the key in the advice, although from a security point-of-view that doesn't make much sense, cause everyone who uses the apsect can break the encryption. Is there any senseful possibility for writing an aspect for secret-key encryption? How would you solve such a problem, cause I am still in a starting-phase of undestanding the aspect-oriented-programing approach. In fact I found the following paper today: http://www.cs.kuleuven.ac.be/~distrinet/events/aosdsec/AOSDSEC04_Minwell_Huang.pdf and I wonder now why on page 3 in the around-advice of the AbstractDESAspect the pointcut encryptOperations has a parameter for the message which should be encrypted but no key which should be used for encryption. Rathern then giving the key as parameter, the key is hardcoded in the body of the advice. Is there any reason for doing this? Thanks a lot in advance, Julia ============================================================================== TOPIC: How too.. ?? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fd299b7c69eb3e1a ============================================================================== == 1 of 1 == Date: Thurs, Dec 30 2004 3:28 pm From: "newB" so far, u've defined the picture() function, but u didnt call the function. post up the codes of ur applet, too. i guess they're different ============================================================================== TOPIC: port 8080 http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f82ca0681ab641a2 ============================================================================== == 1 of 3 == Date: Thurs, Dec 30 2004 3:31 pm From: "newB" run tomcat again! make sure no one is use port 8080 == 2 of 3 == Date: Thurs, Dec 30 2004 3:31 pm From: "newB" run tomcat again! make sure no one is use port 8080 == 3 of 3 == Date: Thurs, Dec 30 2004 3:30 pm From: "newB" run tomcat again! make sure no one is use port 8080 ============================================================================== TOPIC: where is everybody http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b9a589a8cfda9bef ============================================================================== == 1 of 4 == Date: Thurs, Dec 30 2004 7:15 pm From: "java10" i posted a message and no one respond to it so i checking if { everyone is still alive; } else { happy new Year in advance } } == 2 of 4 == Date: Fri, Dec 31 2004 12:31 am From: Andrew Thompson On Sat, 25 Dec 2004 15:04:15 -0500, java10 wrote: > actually pardon me for my mistake sir, the code is still behaving rather > very badly just as i described in my last post (mind my written style i > just finished watching > "MR BEAN ". > i will looking forward to hearing from you soon. I saw your other post and had to search for this one to realise what you were referring to, since changing the title effectively started that message as a new thread in my news client. In answer to the question from the other thread. Since you have consistently failed to follow the advice offered by myself and others re posting code samples, I decided my time was better invested elsewhere. Good luck with it. -- 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 == 3 of 4 == Date: Fri, Dec 31 2004 12:57 am From: "Chris Uppal" java10 wrote: > i posted a message and no one respond to it so i checking if { > everyone is still alive; Well, I /think/ I'm still alive. I admit I'd have a hard time proving it to a sceptical observer... I haven't seen a previous message from you; maybe something ate it ? > } > else > { > happy new Year in advance > } > } And to you -- but why do you restrict it to the living ? -- chris == 4 of 4 == Date: Fri, Dec 31 2004 1:05 am From: Andrew Thompson On Fri, 31 Dec 2004 00:57:34 -0000, Chris Uppal wrote: > I haven't seen a previous message from you; <http://groups-beta.google.com/group/comp.lang.java.programmer/browse_frm/thread/b9a589a8cfda9bef#16e265c8816cc85f> <http://groups-beta.google.com/group/comp.lang.java.programmer/msg/16e265c8816cc85f?as_umsgid=d9650d67704202dcff5c0e68fc07835b> I hate these new URL's.. I might see if I can find another archive that offers shorter URL's by msg ID. -- 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: Manipulating audio data with filters http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d2a1f098702a36ec ============================================================================== == 1 of 2 == Date: Thurs, Dec 30 2004 4:28 pm From: [EMAIL PROTECTED] Hi. I'm trying to capture .wav data and manipulate it using filters, etc... I've read a million posts on this topic, but I'm still at a loss as to my next move. I believe the following code successfully converts audio byte[] data to a short array. When you run it from the command line you'll get data like: -94 2822 -1 -43 -110 -1 -92 -89 74 314 Exactly what does this data represent? Is this data ready to have a FFT run on it? How do I go about drawing the waveform of this data? Please have a look at the code and let me know how I should proceed to accomplish these tasks. Thanks for the help! import java.io.*; import java.nio.*; import java.net.*; import java.awt.*; import java.util.*; import java.lang.*; import java.math.*; import javax.media.*; import javax.swing.*; import java.lang.Long.*; import javax.sound.sampled.*; public class Filters { final double pi = Math.PI; private Player audioPlayer = null; private int frameRate; private AudioInputStream audioInput; public static void main(String args[]) { int numChannels,frameLengthInt; int totalFrames = 0; long frameLengthLong; byte[] audioData; double[] doubArray; SourceDataLine sourceData; AudioInputStream audioInput; ByteArrayOutputStream byteOut; String output = ""; try { if (args.length == 1) { File sourceFile = new File(args[0]); //File targetFile = new File(args[1]); //audio player for file Filters player = new Filters(sourceFile); //put audio data into an input stream audioInput = AudioSystem.getAudioInputStream(sourceFile); //output stream byteOut = new ByteArrayOutputStream(); //get the file format info. AudioFileFormat fileFormat = AudioSystem.getAudioFileFormat(sourceFile); //get file type (.wav, .au...etc) AudioFileFormat.Type targetFileType = fileFormat.getType(); //get the total length of the file frameLengthLong = audioInput.getFrameLength(); //convert long to int frameLengthInt = (int)frameLengthLong; //get channels: mono=(1,2), stereo=(4) numChannels = audioInput.getFormat().getFrameSize(); //total bytes of file int numBytes = frameLengthInt * numChannels; //put total bytes into binary form audioData = new byte[numBytes]; //play audio file player.play(); try { int numBytesRead = 0; int numFramesRead = 0; while((numBytesRead = audioInput.read(audioData)) != -1) { numFramesRead = numBytesRead/numChannels; totalFrames += numFramesRead; short[] shortArray = new short[numBytes/2]; for (int x = 0; x < numBytes/2; x++) { shortArray[x] = (short) ((audioData[x * numChannels + 1] << 8 ) | audioData[x * numChannels + 0]); if (shortArray[x] != 0) { System.out.println(shortArray[x]); } } } } catch (Exception ex) {} //System.out.println("file format: "); //create byte array input stream //ByteArrayInputStream bAIS = new ByteArrayInputStream(audioData); //AudioInputStream opAIS = new AudioInputStream( // bAIS, // audioFormat, // audioData.length / audioFormat.getFrameSize()); //write modifed data to target file //int nWrittenBytes = AudioSystem.write( // opAIS, // targetFileType, // targetFile); } else { usage();} System.exit(0); } catch (Exception ex) {} } //end main // create media player public Filters(URL url) throws IOException, NoPlayerException, CannotRealizeException { audioPlayer = Manager.createRealizedPlayer(url); } public Filters(File file) throws IOException, NoPlayerException, CannotRealizeException { this(file.toURL()); } // play and stop file public void play() { audioPlayer.start(); } public void stop() { audioPlayer.stop(); audioPlayer.close(); } // usage display public static void usage() { System.out.println("Usage: java Filters inputFile"); } } //end class == 2 of 2 == Date: Fri, Dec 31 2004 12:34 am From: Andrew Thompson On 30 Dec 2004 16:28:28 -0800, [EMAIL PROTECTED] wrote: > Sub: Manipulating audio data with filters You seem to have got 'echo' working. Please refrain from multi-posting. <http://www.physci.org/codes/javafaq.jsp#xpost> -- 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: javadoc produces IllegalArgumentException http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/95a65bfb474fc687 ============================================================================== == 1 of 1 == Date: Thurs, Dec 30 2004 4:49 pm From: [EMAIL PROTECTED] (vizlab) Hi, I tried to use javadoc to document a java file, but got the error: Thanks a lot for your help. Best ************************************************************************* java.lang.IllegalArgumentException at sun.net.www.ParseUtil.decode(ParseUtil.java:183) at sun.misc.URLClassPath$FileLoader.<init>(URLClassPath.java:860) at sun.misc.URLClassPath$3.run(URLClassPath.java:316) at java.security.AccessController.doPrivileged(Native Method) at sun.misc.URLClassPath.getLoader(URLClassPath.java:310) at sun.misc.URLClassPath.getLoader(URLClassPath.java:287) at sun.misc.URLClassPath.findResource(URLClassPath.java:138) at java.net.URLClassLoader$2.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findResource(URLClassLoader.java:359) at java.lang.ClassLoader.getResource(ClassLoader.java:977) at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1159) at javax.xml.parsers.SecuritySupport$4.run(SecuritySupport.java:72) at java.security.AccessController.doPrivileged(Native Method) at javax.xml.parsers.SecuritySupport.getResourceAsStream(SecuritySupport .java:65) at javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder. java:213) at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:185) at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java: 107) at com.sun.tools.doclets.internal.toolkit.builders.LayoutParser.parseXML (LayoutParser.java:72) at com.sun.tools.doclets.internal.toolkit.builders.ClassBuilder.build(Cl assBuilder.java:108) at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(Html Doclet.java:155) at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFi les(AbstractDoclet.java:177) ...... ============================================================================== TOPIC: Custom Protocol over TCP http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4b24f908bd6b6b6b ============================================================================== == 1 of 1 == Date: Fri, Dec 31 2004 1:01 am From: Jeffrey Spoon Hello I was toying with the idea of writing a relatively simple P2P system. I decided using TCP would be the best bet and maybe UDP for discovering other nodes. However, initially I was going to use binary headers for my protocol to keep overhead down, but apparently this is problematic and not at all friendly to anything non-C++, as well as byte-ordering issues etc. Could be an issue as I'll be using Java... Anyway, should I just use plain text for my protocol messages? It still seems wasteful, as you're basically wasting 8 bits with each character, whereas you could stuff a lot more info into a binary packet. I suppose this is more of a general programming/networking question, but since I will be using the Java I thought this was a good place to start. Cheers. -- Jeffrey Spoon ============================================================================== TOPIC: server-side development definition http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9310557837cccc02 ============================================================================== == 1 of 2 == Date: Thurs, Dec 30 2004 6:12 pm From: [EMAIL PROTECTED] when people say server-side development, that means develop applications running on server? for example, ASP.NET, J2EE such as JSP, EJB development? correct? please advise. thanks!! == 2 of 2 == Date: Fri, Dec 31 2004 2:44 am From: Andrew Thompson On 30 Dec 2004 18:12:01 -0800, [EMAIL PROTECTED] wrote: > when people say server-side development, that means develop > applications running on server? for example, ASP.NET, J2EE such as JSP, > EJB development? correct? Yes. F'Ups set to comp.software-eng. -- 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: Third tapestry tutorial available http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2fd437521a3729b7 ============================================================================== == 1 of 1 == Date: Thurs, Dec 30 2004 10:10 pm From: [EMAIL PROTECTED] Hi all, Tapestry is a web app framework (Java) that allows your web designers to create and edit web pages using a WYSIWYG editor (DreamWeaver, FrontPage or etc), while your programmers can still add dynamic contents to the pages. I've created my third Tapestry tutorial. You're welcome to read it at http://www2.cpttm.org.mo/cyberlab/softdev/tapestry/ Thanks! ============================================================================== TOPIC: JSP formatter http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1ce540f74e3ceac6 ============================================================================== == 1 of 1 == Date: Thurs, Dec 30 2004 10:58 pm From: [EMAIL PROTECTED] There is tool called JSPFormat, which integrates with Eclipse. ============================================================================== TOPIC: acceptable way to program http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/829184c5bd6bb8b0 ============================================================================== == 1 of 1 == Date: Fri, Dec 31 2004 3:38 pm From: steve Hi, Recently I have been looking at the various ways people are implementing, interaction between java & oracle databases. I was always instructed on the purity of the data model, "normalize the data" etc. I have seen people Serializing java objects , such as purchase orders orders, customer records etc , then sticking the "object" into am oracle blob column. finally when they want to retrieve it they de-serialize the object., work on it then re-serialize and stuff it back into the oracle blob. to me this causes the following problems: 1. the object can become very big, and can only be recovered in it's entirety, and if it contains pictures ,etc, it can become huge. 2. the object becomes "closed", in that it cannot be modified or checked in situ 3. it cannot be searched , without de-serialization. I'm looking to implement a java front end, (oracle back end), system ,that allows a product , to be inspected by an inspection team , and comments/ photographic record kept. using an "object approach" would make it very simple, but the size of the resulting object could be very large. does anyone have any thoughts how to accomplish this task. steve ============================================================================== 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
