comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]

Today's topics:

* Java API source code? - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f49b6100e91cd2fa
* Application sharing - 4 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7befcbbc82dde970
* Beginner Advice Sought - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b96a0a430a102e22
* overriding inner classes - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3fe8aa87a5e9b71d
* J2ME Scheduled task? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/63ea15d2afb8e095
* javac for J2ME - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a92d0c7d82c93863
* Preventing multiple instance standalone desktop gui applications - 1 messages, 1 
author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/afa857e018f3780
* Using BigInteger - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a7be97102e1c754
* writeObject and readObject problem - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e6fc9480a3a7f42a
* Garbage collector question - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/793ab88313c687f9
* howto session bean w/ XDoclet - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7d43139a7c8b544c
* So what is the max length of a String? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/14481b1cace3fa93
* navigate to webpage and capture whole screen to a JPEG? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8b394e001e6cf553
* server application - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4bfd9bcb653fd31c
* read binary data from C file??? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c04d04f749f5ae1f
* code optmization - 2 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1b784382e7cbb306
  
==========================================================================
TOPIC: Java API source code?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f49b6100e91cd2fa
==========================================================================

== 1 of 3 ==
Date:   Thurs,   Sep 23 2004 4:13 pm
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Ken wrote:
> Where would I find Java 1.4.2 API source code? 

The API source code is part of the SDK/JDK distribution and can
be found in the "src.zip" file in the installation directory
(unless you chose not to install it).


> It's my understanding
> that the Java creators applied precondtions, postconditions and
> invariants to the API classes and their methods. 

What gave you that idea?


> One note is that if it is in the code, I wonder why they didn't
> include it in the Javadoc for the API.  It sure would be useful for us
> clients of the APIs!

As far as there are such things (i.e. very rarely), they are documented
in the javadoc, though usually informally.



== 2 of 3 ==
Date:   Thurs,   Sep 23 2004 4:15 pm
From: Jim Cochrane <[EMAIL PROTECTED]> 

In article <[EMAIL PROTECTED]>, Ken wrote:
> Hi.
> 
> Where would I find Java 1.4.2 API source code?  It's my understanding
> that the Java creators applied precondtions, postconditions and
> invariants to the API classes and their methods.  I'd like to take a
> look at these contract definitions, and I'm assuming they are in the
> source code.
> 
> One note is that if it is in the code, I wonder why they didn't
> include it in the Javadoc for the API.  It sure would be useful for us
> clients of the APIs!

On my system, it's in:

$JAVA_HOME/src.zip (/usr/java/j2sdk1.4.2_02/src.zip)

I assume this is standard.

-- 
Jim Cochrane; [EMAIL PROTECTED]
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]



== 3 of 3 ==
Date:   Thurs,   Sep 23 2004 8:31 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 23 Sep 2004 14:30:55 -0700, Ken wrote:

> here would I find Java 1.4.2 API source code?

The places described by Micheal and Jim.

But if you find yourself away from home and need
a quick reference, it's available through this page..
<http://www.physci.org/source.jsp?class=java.lang.Object>

HTH

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane




==========================================================================
TOPIC: Application sharing
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7befcbbc82dde970
==========================================================================

== 1 of 4 ==
Date:   Thurs,   Sep 23 2004 4:16 pm
From: "Ike" <[EMAIL PROTECTED]> 

Anyone know of a Java API in existence that I could utilize for application
sharing? Thanks, Ike





== 2 of 4 ==
Date:   Thurs,   Sep 23 2004 5:11 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Ike wrote:

> Anyone know of a Java API in existence that I could utilize for
> application sharing?

Could you be more specific?

-- 
Paul Lutus
http://www.arachnoid.com




== 3 of 4 ==
Date:   Thurs,   Sep 23 2004 5:32 pm
From: "Ike" <[EMAIL PROTECTED]> 

Something that provides functionality akin to "appilication sharing" in msn
messenger (which Ithink has been ported over from the old Netmeeting) or
what WebEx does -- something that lets someone who is in charge of a
metting, run an application on a client, and have it be vieewd remotely by
other clients.

Thanks, Ike

"Paul Lutus" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Ike wrote:
>
> > Anyone know of a Java API in existence that I could utilize for
> > application sharing?
>
> Could you be more specific?
>
> -- 
> Paul Lutus
> http://www.arachnoid.com
>





== 4 of 4 ==
Date:   Thurs,   Sep 23 2004 9:56 pm
From: Chris Smith <[EMAIL PROTECTED]> 

Ike wrote:
> Something that provides functionality akin to "appilication sharing" in msn
> messenger (which Ithink has been ported over from the old Netmeeting) or
> what WebEx does -- something that lets someone who is in charge of a
> metting, run an application on a client, and have it be vieewd remotely by
> other clients.

No pure Java library will be able to provide the kind of application 
sharing available in those tools.  You would need something more closely 
connected to the underlying system, so such a thing just can't possibly 
exist.  If you need a portable library, you are out of luck.

I'm unaware of any platform-specific native libraries, but you might get 
a better response if you post what platforms you need.

-- 
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation




==========================================================================
TOPIC: Beginner Advice Sought
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b96a0a430a102e22
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 4:33 pm
From: "jbeck" <[EMAIL PROTECTED]> 


"Andrew Thompson" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Tue, 21 Sep 2004 05:06:33 -0600, Joe Beck wrote:
>
>> I was considering using an IDE in my quest for learning the basics of
>> Java...unless there is a better approach, or reason to go with the
>> commandline compiler.
>
> I recommend the command line, till you have the hang of it..
> <http://www.xdweb.net/~dibblego/java/faq/answers.html#q34>
>
> (Oh, OK! I'll admit that even I wanted an editor
> that had keyword highlighting, so I use TextPad)
>
> -- 
> 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


Okay!  Okay!  Command line editor isn't as bad as I thought it would be! 
Actually, kind a bit easier than I remember during my C experience (perhaps 
it really did prepare me a bit more than I thought for this?)

I am currently trying Jedit (I got the copy off Sourceforge)...so far, so 
good.

Thanks for the advice!







==========================================================================
TOPIC: overriding inner classes
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3fe8aa87a5e9b71d
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 23 2004 4:53 pm
From: "P.Hill" <[EMAIL PROTECTED]> 



Tom wrote:

> Hi Mike,
> 
> Thanks for your reply. If i change ClassB's code to 
> 
> public class ClassB extends ClassA{
>   LocalClass instance;
> 
>  // inner class -- should override inner class of ClassA
>  private class LocalClass{

This is still wrong. Subclassing ALWAYS requires you to
specify what class you are subclassing, consider TWO
inner class, how would the compiler know that one should
be a subclass and the other shouldn't.  It can't guess.
You are missing something like
  private class LocalClass extends ClassA.LocalClass {
....

> and leave the rest unaltered i get the desired behavior:
> $ java Main
> Hello
> Goodbye

Not without the various points made by Adam in this thread.

Consider his comment:
 >2. You haven't constructed anywhere in your code an instance of
 >ClassB.LocalClass,

Also consider that you have defined _2_ variables called instance, not
one.

I think you need to work on basic subclassing before you start subclassing
inner classes.

-Paul




== 2 of 2 ==
Date:   Thurs,   Sep 23 2004 6:05 pm
From: [EMAIL PROTECTED] (Yakov) 

Overriding inner classes is a bit too much unless your goal is to make
your code as convoluted as possible.




==========================================================================
TOPIC: J2ME Scheduled task?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/63ea15d2afb8e095
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 8:13 am
From: "Darryl L. Pierce" <[EMAIL PROTECTED]> 

knocker wrote:

> I wonder if there's a way to do a scheduled task that launches an
> application to perform a task in j2me?

That would depend on the device; i.e., there's no way to schedule things
from within a MIDlet to then launch the MIDlet at set times.

-- 
/**
 * @author Darryl L. Pierce <[EMAIL PROTECTED]>
 * @see    The Infobahn Offramp <http://mcpierce.mypage.org>
 * @quote  "Lobby, lobby, lobby, lobby, lobby, lobby..." - Adrian Monk
 */




==========================================================================
TOPIC: javac for J2ME
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a92d0c7d82c93863
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 8:14 am
From: "Darryl L. Pierce" <[EMAIL PROTECTED]> 

Jacob wrote:

> I know I can use the ktoolbar program to compile
> code for the CDLC, but what is the javac equivalent?
> 
> I think it involves specifying -Xbootclasspath,
> but I haven't found exactly how.

You specify the CLDC/MIDP jar files in your bootclasspath reference.

-- 
/**
 * @author Darryl L. Pierce <[EMAIL PROTECTED]>
 * @see    The Infobahn Offramp <http://mcpierce.mypage.org>
 * @quote  "Lobby, lobby, lobby, lobby, lobby, lobby..." - Adrian Monk
 */




==========================================================================
TOPIC: Preventing multiple instance standalone desktop gui applications
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/afa857e018f3780
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 6:47 pm
From: [EMAIL PROTECTED] (Jean-Francois Briere) 

If you have JDK1.4+, you can use a flag file with a lock mechanism.
Here is a little utility class that create/lock a file on user.home folder
and with name based on the app name provided:

--------------------------------------------------------------------------------
import java.io.*;
import java.nio.channels.*;

public class UniqueApp
{
    private String appName;
    private File file;
    private FileChannel channel;
    private FileLock lock;
    
    public UniqueApp(String appName) {
        this.appName = appName;
    }
    
    public boolean isAppActive() {
        try {
            file = new File(System.getProperty("user.home"), appName + ".tmp");
            channel = new RandomAccessFile(file, "rw").getChannel();
            
            try {
                lock = channel.tryLock();
            }
            catch (OverlappingFileLockException e) {
                closeLock();
                return true;
            }
            
            if (lock == null) {
                closeLock();
                return true;
            }
            
            Runtime.getRuntime().addShutdownHook(new Thread() {
                    public void run() {
                        closeLock();
                        deleteFile();
                    }
                });
            
            return false;
        }
        catch (Exception e) {
            closeLock();
            return true;
        }
    }
    
    private void closeLock() {
        try {
            lock.release();
        }
        catch (Exception e) {
        }
        try {
            channel.close();
        }
        catch (Exception e) {
        }
    }
    
    private void deleteFile() {
        try {
            file.delete();
        }
        catch (Exception e) {
        }
    }
}
--------------------------------------------------------------------------------

And here is a simple test:

--------------------------------------------------------------------------------
public class UniqueAppTest {
    public static void main(String[] args) {
        new UniqueAppTest().test();
    }
    
    void test() {
        UniqueApp ua = new UniqueApp("MyAppId");
        
        if (ua.isAppActive()) {
            System.out.println("App is already active.");
        }
        else {
            System.out.println("App is NOT already active.");
            try {
                System.out.print("Hit <Enter> key to finish");
                System.in.read();
            }
            catch (Exception e) {
            }
        }
    }
}
--------------------------------------------------------------------------------




==========================================================================
TOPIC: Using BigInteger
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a7be97102e1c754
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 6:50 pm
From: [EMAIL PROTECTED] (Robert) 

XProduct = A_BI.multiply(B_BI);  //Multiply new values of A and B

if (A_BI.compareTo(B_BI) < 0)    // Compare values of two BigInts -1 =
less than, 0 = equal to 1 = greater than

{
Insert code
}

Also in the examples below.  The numbers should be treated as strings
and be in quotes when creating a new instance of a BigInteger.
>BigInteger bi1 = new BigInteger("5");
>BigInteger bi2 = new BigInteger("10");


Robert

Tim Slattery <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> "Jeremy Watts" <[EMAIL PROTECTED]> wrote:
> 
> >I've been trying to use the 'BigInteger' feature with no success - cant seem 
> >to find any examples of code that for instance adds or subtracts two big 
> >integer numbers.
> >
> >How do you actually use BigInteger to do arithmetic on large integer 
> >numbers??  Could someone give me some code examples please
> 
> BigInteger bi1 = new BigInteger(5);
> BigInteger bi2 = new BigInteger(10);
> 
> BigInteger bi3 = bi1.add(bi2);
> /* bi3 now contains the value 15 */
> 
> BigInteger bi4 = bi3.divide(bi1);
> /* bi4 contains the value 3 */




==========================================================================
TOPIC: writeObject and readObject problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e6fc9480a3a7f42a
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 7:18 pm
From: "juicy" <[EMAIL PROTECTED]> 

Yes, i have imported java.awt.Event but the result is still same. 
Is that really the server cannot read the event? 
//at server
public void run() {
      Object x = null;
      try {
        x = ois.readObject();
        System.out.println("print out what is received: "+x);
         oos.writeObject(x);
         oos.flush();
         ois.close();
         oos.close();
         client.close();
      } catch(Exception e) {}

I print out what is received at server:
java.awt.Event[id=1001,x=30,y=1,target=java.awt.Button[button2,30,1,60x40,label=Write],arg=Write]
Is that mean server has already received the event?







==========================================================================
TOPIC: Garbage collector question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/793ab88313c687f9
==========================================================================

== 1 of 3 ==
Date:   Thurs,   Sep 23 2004 7:24 pm
From: "Vincent Cantin" <[EMAIL PROTECTED]> 

> > If there is no references exept a WeakReference to an object and I call
> > System.gc(), am I sure that my object has been garbage collected ?
>
> I'm curious why you care? Why is it important one way or the other?
>
> If you're using a WeakReference, you've already communicated to the system
> that your interest in the object is temporal based on the whim of the JVM
> and the GC, so why are you interested in the specific behavior? How does
> this affect your applicaton?
>
> Regards,
>
> Will Hartung
> ([EMAIL PROTECTED])

because I need to know in some points of given class of programs that an
object is reachable or not.





== 2 of 3 ==
Date:   Thurs,   Sep 23 2004 7:34 pm
From: "Ann" <[EMAIL PROTECTED]> 


"Vincent Cantin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > > If there is no references exept a WeakReference to an object and I
call
> > > System.gc(), am I sure that my object has been garbage collected ?
> >
> > I'm curious why you care? Why is it important one way or the other?
> >
> > If you're using a WeakReference, you've already communicated to the
system
> > that your interest in the object is temporal based on the whim of the
JVM
> > and the GC, so why are you interested in the specific behavior? How does
> > this affect your applicaton?
> >
> > Regards,
> >
> > Will Hartung
> > ([EMAIL PROTECTED])
>
> because I need to know in some points of given class of programs that an
> object is reachable or not.
>
>
What happens if you compare against null?





== 3 of 3 ==
Date:   Thurs,   Sep 23 2004 9:54 pm
From: Chris Smith <[EMAIL PROTECTED]> 

Vincent Cantin wrote:
> because I need to know in some points of given class of programs that an
> object is reachable or not.

If you want to know whether the WeakReference is still valid, just use 
get() and compare the result with null.  You are not guaranteed that a 
call to System.gc will clear the WeakReference, so you need to check 
yourself if you wish to find out.

-- 
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation




==========================================================================
TOPIC: howto session bean w/ XDoclet
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7d43139a7c8b544c
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 7:28 pm
From: William Zumwalt <[EMAIL PROTECTED]> 

Apologies, just got really tired working on these probs. I've posted the 
real error output below and removed that typo of multiple declarations 
of remove().


> Hey all, 
> 
> Does anyone see anything wrong w/ this session bean. I'm pretty new to
> XDoclet and having various problems in compiling or loading. So now
> I'm just trying a very basic example. I get the following compile
> errors below it.
> 
> /**
>  *
>  * @ejb.bean
>  *      name="comp/History"
>  *      type="Stateless"
>  *      view-type="remote"
>  *      jndi-name="ejb/comp/History"
>  *
>  * @ejb.home
>  *      extends="javax.ejb.EJBHome"
>  *      remote-class="com.place.management.ejb.session.HistoryHome"
>  *
>  * @ejb.interface
>  *      extends="javax.ejb.EJBObject"
>  *      remote-class="com.place.management.ejb.session.History"
>  */
> 
> public class HistoryBean implements SessionBean
> {
>     private transient SessionContext context = null;
> 
>     public void setSessionContext(SessionContext ctx) {
>         context = ctx;
>     }
> 
>     public void unsetSessionContext() throws EJBException {
>         context = null;
>     }
> 
>     /**
>      * @ejb.create-method
>      */
> 
>     public void ejbCreate() throws CreateException { }
> 
>     /**
>      * @ejb.home-method
>      */
> 
>     public void ejbRemove() throws EJBException { }
> 
>     /**
>      * @ejb.home-method
>      */
> 
>     public void ejbPassivate() { }
> 
>     /**
>      * @ejb.home-method
>      */
> 
>     public void ejbActivate() { }
> }
> 
> --- jboss server output ---
> 

Here is the error that I don't understand.

...
21:25:49,635 INFO  [EjbModule] Deploying comp/History
21:25:49,821 ERROR [StatelessSessionContainer] Initialization failed 
jboss.j2ee:jndiName=ejb/comp/History,service=EJB
java.lang.NoSuchMethodException: 
org.jboss.ejb.StatelessSessionContainer.removeHome() at 
java.lang.Class.getMethod(Class.java:978)
at 
org.jboss.ejb.StatelessSessionContainer.setupHomeMapping(StatelessSession
Container.java:488)
at 
org.jboss.ejb.StatelessSessionContainer.createService(StatelessSessionCon
tainer.java:142)
at 
org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupp
ort.java:237)
at 
org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanS
upport.java:219)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI
mpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at 
org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java
:60)




==========================================================================
TOPIC: So what is the max length of a String?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/14481b1cace3fa93
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 23 2004 8:03 pm
From: [EMAIL PROTECTED] (Kaidi) 

Chris Smith <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> 
> A String can be up to 2 billion or so characters long (2^31 - 1, 
> actually).  However, a string longer than 65535 (2^16 - 1) characters 
> cannot be written in the format used by DataOutputStream.writeUTF.  
> That's because the format used by writeUTF is byte-counted, and leaves 
> only a 16-bit space for the count.  You will need to find a different 
> format to write in.
> 
> > PS: actually I am not writing out a too large String, it is only a
> > String which is the content of a 90K plain text file!
> 
> Are you sure you want the binary format used by writeUTF?  Perhaps you 
> mean to write a plain text String instead?  The latter would be fairly 
> simple.
Thanks for your post. 
Yes, I actually may not need the writeUTF to write out the string,
however,
the problem is: if I use writeUTF, then I can use readUTF to read it
back
easily. 

Do you have any recommendation for this situation: if I need to write
many int, double, String into one file, and need to read them back in
the same order, what method should I use?
At first, I just write them as object (write/readObject), but I findd
it is just too slow as Java will check the relations/reference of each
object.
Now I use writeInt, writeDouble, writeUTF, and read them back, which
have the above problem if the String is too long. Any other better way
to do it?
(If suppose the String maybe in any coding/language, what would be the
difference?)

Thanks a lot.



== 2 of 2 ==
Date:   Thurs,   Sep 23 2004 9:53 pm
From: Chris Smith <[EMAIL PROTECTED]> 

Kaidi wrote:
> Do you have any recommendation for this situation: if I need to write
> many int, double, String into one file, and need to read them back in
> the same order, what method should I use?

Yep, you want writeUTF then.  So you'll need a work-around for this 
problem.  For example, you can do the following:

1. Cut the String into slices of length no greater than 65535.
2. First write to the stream the number of slices, using writeInt.
3. Next write each slice in turn.

Then when reading, reverse that: read the number of slices, and read 
each slice in turn, appending them to form the result.

-- 
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation




==========================================================================
TOPIC: navigate to webpage and capture whole screen to a JPEG?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8b394e001e6cf553
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 8:45 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Thu, 23 Sep 2004 12:05:06 -0400, Flip wrote:

> There are too many client
> side things going on there. :<  Is there a browser type java object that can
> be used instead?

I've been wonderring how to work it myself, Flip.
(And, ..yes, it was exactly for a 'MyFaves' type web-page saver)

BrowserLauncher, which is an open source code, can 
grab the User's own browser and open it with a URL, 
but it will not do the other (3) things required for 
this (very bizarre) application.

1) Send the browser to full-screen (preferably 'chromeless')
2) change pages once opened.

So, ..not that I know of.   :-(

I would love to hear any ideas though.

-- 
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: server application
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4bfd9bcb653fd31c
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 9:39 pm
From: [EMAIL PROTECTED] (Luke) 

hi all, I'm not sure if this would be the right group to post this in,
but it should work ok.  Ok, my question goes like this: supposeing I
have a client/server type project that I want to create in java, the
client will be running out of an applet so in order for this to work,
the server application must be running on the same server as is the
webpage that called the applet. (please don't try to solve what I've
said so far, as there are other factors that force me to have the
server program run on the webhosting server).  So my question is, does
anyone know of a webhost that will host a website for me for free (it
doesn't have to be big, banners aren't a problem, and I'm a poor
student so anything will be fine).  Now I know that there are many
webhosts that will do this, BUT, the big difference, I need one that I
will be able to run a java application on so that I can try out this
server/client project, anyone know how I'd go about doing this?  or
even if there exist free webhosts that will let you run applications
on the server?  any response would be appreciated.  thanks

 - Luke Bergen




==========================================================================
TOPIC: read binary data from C file???
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c04d04f749f5ae1f
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 23 2004 11:50 am
From: Daniel Sjöblom <[EMAIL PROTECTED]> 

John Adams wrote:
>   Thank you all for your invaluable advice. To date, I have seemed to 
> try all the methods mentioned: Array, ByteBuffer, DataInputStream, 
> ByteArrayInputStream, intBitsToFloat(), etc. I had, ofcourse as Michael 
> Borgwardt so "brilliantly" pointed out, tried putting some values on the 
> server side and dumping them out on the client side (That is HOW I know 
> they are not the same!!!).
> 
>   Flatform and hardware also are not the concern since I had tried 
> running the server on the very same intel machine as the client (just to 
> debug). Endianess is also out of question in this scenario.

Sigh. Have you even read the documentation for DataInputStream? It reads 
big endian data, while your x86 is little endian. The other problem is 
that your structs probably contain random padding bytes.

Your problem is that you use C structs as a communication format. This 
is inherently unportable (since it is in no way defined what a struct 
looks like in memory), even on the same platform if you happen to 
compile with a different compiler or even another version of the same 
compiler. You will need to actually design and specify the transmission 
format. XML or binary data with endianess/padding issues removed, do 
whatever you wish, but do not dump raw C structs.

-- 
Daniel Sjöblom
Remove _NOSPAM to reply by mail




==========================================================================
TOPIC: code optmization
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1b784382e7cbb306
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 23 2004 2:50 pm
From: Daniel Sjöblom <[EMAIL PROTECTED]> 

mank wrote:
> Following java code is executed many multiple times in my program. 
> Any ideas to optmize it?
> 
> if (result.group(2)== null || result.group(2).trim().length() < 1)
>     return var;
> }else {
>     var=String.valueOf(Math.round(Float.parseFloat(var)* 3.0));
> }
> if (result.group(1) != null && result.group(1).trim().length() > 0) {
>     return result.group(1) + result.group(2);
> }else if (result.group(3) != null && result.group(3).trim().length() > 0) {
>     return result.group(2) + result.group(3);
> }else {
>     return  "$"+ result.group(2);
> }

There are a lot of common subexpressions to be pulled out of the above 
code. Factor out the calls to group. If you have a good idea of which 
branches are likely to be taken and which are not, you can try to 
reorder the tests (assuming the order does not matter) to reduce bad 
branch predictions. The assignment to var is also a dead assignment in 
your example. It is hard to be more specific since the example is so 
short, and taken out of context.

(Insert obligatory warning about premature optimization. How many times 
is many multiple times? Have you profiled your app to make certain this 
is a bottle neck?)
-- 
Daniel Sjöblom
Remove _NOSPAM to reply by mail



== 2 of 2 ==
Date:   Thurs,   Sep 23 2004 2:57 pm
From: Daniel Sjöblom <[EMAIL PROTECTED]> 

Will Hartung wrote:

> Since 'var' is not used outside of the first IF block, I eliminated it
> completely from the else. An aggressive compile might have well eliminated
> that automatically already. parseFloat tends to be an expensive operation in
> most any language.

Actually, a compiler that eliminated the call to parseFloat would be 
dead wrong, since parseFloat can throw an exception and thus alter the 
control flow in the program.

-- 
Daniel Sjöblom
Remove _NOSPAM to reply by mail



=======================================================================

You received this message because you are subscribed to the
Google Groups "comp.lang.java.programmer".  

comp.lang.java.programmer
[EMAIL PROTECTED]

Change your subscription type & other preferences:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

Report abuse:
* send email explaining the problem to [EMAIL PROTECTED]

Unsubscribe:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe


=======================================================================
Google Groups: http://groups-beta.google.com 

Reply via email to