Suggestions on compiling STLPort?

About two weeks ago, I posted a problem using the STLPort4 library where a segmentation fault happens down in STLPatomic_exchange. I am still encountering the problem intermittently.
I would like to compile the latest stable release from www.stlport.com so that I better track down the problem.
Are there any special compile commands needed to get the STLPort to compile under C++ 5.4?
The compiler command for including stlport "-library=stlport4" appears to be special for the library, why is that?

The following code has been shown to reproduce my SEGV issue in stlport's STLPatomic_exchange. Before compiling and running:
1. This problem could take one to many minutes to occur
2. Make sure that your platform has nobody else using it because the app will drive your CPU to 100%
3. Please don't make fun of my Makefile
Good luck and I hope you have the same "success" that I had.
### Makefile Start
PLATFORM :sh= uname -p | sed s/i386/x86/
OSVARIANT=$(PLATFORM)-SunOS
#### Compiler and tool definitions shared by all build targets #####
CCC=CC
BASICOPTS=
CCFLAGS= -g -mt -library=stlport4 -staticlib=stlport4 -misalign
CCADMIN=CCadmin
## Target: GCNServer
CPPFLAGS = -I/usr/include -I/usr/include/sys
OBJS =  stlproblem.o
SYSLIBS = -lpthread -lm -lsocket -lnsl -lposix4
LDLIBS =  $(SYSLIBS)
# Link or archive
stlproblem:  $(OBJS)
     $(LINK.cc) -o stlproblem $(OBJS) $(LDLIBS)
# Compile source files into .o filess
stlproblem.o: stlproblem.cpp
     $(COMPILE.cc) -o $@ stlproblem.cpp
#### Clean target deletes all generated files ####
clean::
     $(RM) ./stlproblem ./stlproblem.o
     $(CCADMIN) -clean
# Create the target directory (if needed)
obj:
# Enable dependency checking
.KEEP_STATE:
### Makefile end
// stlproblem.cpp code start
This source file contains a system of n threaded objects that use a common object
table in order to access the other threaded objects.  As the system runs, x
number of messages are passed randomly between these threaded objects.  In order
to access the object pointer for a message recipient, the common
ObjectTable::GetObjectPointer method is used.  In this call, STL will SEGV in
the _STLP_atomic_exchange.  This problem occurs on our SUN 280R servers (1 CPU)
in Solaris 9.  Our compiler version is CC: Forte Developer 7 C++ 5.4 2002/03/09.
#include "stdlib.h"
#include "stdio.h"
#include "math.h"
#include "pthread.h"
#include "semaphore.h"
#include <iostream>
#include <list>
#include <string>
#include <map>
#define THREAD_COUNT   100
#define MESSAGE_COUNT  1000
using namespace std;
// shared table to hold the objects
class ObjectTable
public:
    ObjectTable();
    ~ObjectTable();   
    void* GetObjectPointer(std::string Name);   
    std::map<std::string, void*> m_table;
ObjectTable::ObjectTable(void)
ObjectTable::~ObjectTable(void)
void* ObjectTable::GetObjectPointer(std::string Name)
    std::string object_name;
    std::string instance;
    std::map<std::string, void*>::iterator iter;
    void *rtnval = NULL;
    // this is where STLPort is expected to crash, so play with std::string operations
    // iterate to slow this method down and get more than one thread in here
    iter = m_table.begin();
    for(int i=0; i<m_table.size(); i++)
        object_name = (*iter).first;
        // the following line appears to be the main culprit even though it does nothing useful
        instance = object_name.substr(0, object_name.find("e")+1);
        if(object_name == Name)
            rtnval = m_table[object_name];
        iter++;
    return rtnval;
// global declaration of the table that all objects can reference
ObjectTable *gObjectTable = NULL;
// message payload class
class Message
public:   
    Message(std::string Text);
    ~Message(void);
    std::string m_messageText;
Message::Message(std::string Text)
    m_messageText = Text;
Message::~Message(void)
// the main living object class
class LivingObject
public:
    LivingObject(std::string ObjectName);
    ~LivingObject(void);
    void HandleMessages(void);
    void QueueMessage(Message* pMsg);
    pthread_mutex_t m_criticalSectionMutex;
    pthread_cond_t m_messageEventCondition;
    pthread_mutex_t m_messageEventMutex;   
    std::list<Message*> m_messageList;
    std::string m_myName;
LivingObject::LivingObject(std::string ObjectName)
    pthread_mutex_init(&m_criticalSectionMutex, NULL);      
    pthread_cond_init(&m_messageEventCondition, NULL);
    pthread_mutex_init(&m_messageEventMutex, NULL);
    m_messageList.clear();
    m_myName = ObjectName;
LivingObject::~LivingObject(void)
void LivingObject::HandleMessages(void)
    char buf[16];   
    unsigned int seed = 4925;   
    while(1)
        pthread_cond_wait(&m_messageEventCondition, &m_messageEventMutex);
        while(m_messageList.size() > 0)
            pthread_mutex_lock(&m_criticalSectionMutex);           
            Message *p_msg = (Message*) m_messageList.front();
            m_messageList.pop_front();
            pthread_mutex_unlock(&m_criticalSectionMutex);  
            LivingObject *p_object;           
            do
                // pick a random object to send the message to (can't be ourselves)               
                seed = rand_r(&seed);           
                int object_number = (int) floor(((double)seed/(double)RAND_MAX) * THREAD_COUNT);
                sprintf(buf, "Instance%d", object_number);
                std::string object_name = buf;
                // Turn the following line on to show the message activity between threads
                // When the cout is active, it may delay the SEGV issue.
                //cout << m_myName << " is sending " << p_msg->m_messageText << " to " << object_name << endl;
                // the SEGV crash should occur in this call - gObjectTable is the global pointer
                p_object = (LivingObject*) gObjectTable->GetObjectPointer(object_name);
                if(p_object != this && p_object != NULL)               
                    p_object->QueueMessage(p_msg);
            } while(p_object == this);
void LivingObject::QueueMessage(Message *pMsg)
    // protect the message list since it is read-write
    pthread_mutex_lock(&m_criticalSectionMutex);   
    m_messageList.push_back(pMsg);
    pthread_cond_signal(&m_messageEventCondition);
    pthread_mutex_unlock(&m_criticalSectionMutex);   
// thread entry point for the LivingObject class
extern "C" void* LivingObjectThread(void* param)
    std::string object_name = (char*) param;
    LivingObject *alive_object = new LivingObject(object_name);    
    cout << object_name << " is alive!" << endl;
    gObjectTable->m_table[object_name] = (void*) alive_object;
    // HandleMessages() will block indefinitely...
    alive_object->HandleMessages();
    // ...and we never get here
    return 0;
int main(int argc, char* argv[])
    char *name_buf;
    gObjectTable = new ObjectTable();
    // create lots of threads
    pthread_t tid;   
    for(int i=0; i<THREAD_COUNT; i++)
        name_buf = new char[16];
        sprintf(name_buf, "Instance%d", i);       
        pthread_create(&tid, NULL, LivingObjectThread, (void*)name_buf);
    // Get the ball rolling - effectively these "messages" will bounce around
    // through all of the object threads just created.  the idea is that
    // eventually two threads will enter the ObjectTable::GetObjectPointer
    // at the same time and cause the STLPort crash in _STLP_atomic_exchange().   
    LivingObject *instance0 = NULL;
    do
        instance0 = (LivingObject*) gObjectTable->GetObjectPointer((std::string)"Instance0");       
    } while(instance0 == NULL);   
    // create lots of messages
    char message_buf[64];   
    for(int i=0; i<MESSAGE_COUNT; i++)
        sprintf(message_buf, "Message Number %d", i+1);
        Message *msg = new Message(message_buf);
        instance0->QueueMessage(msg);
    // block the app from exiting (CTRL-C is the only way out)
    sem_t never_exit_event;   
    sem_init(&never_exit_event, 0, 0);   
    sem_wait(&never_exit_event);
    return 0;
// stlproblem.cpp code end

Similar Messages

  • Suggestions for compiling libraries on Leopard

    I'm finding it a real difficulty to get a couple of things I use for development up and running, and either my Google skills are failing me or people aren't asking this question:
    What is the best set of command line options to enter to allow for compilation as an x86_64 binary? I have a mac pro, but by default everything I've built so far compiles as an i386 file and won't run.
    I've tried the following line leading up to a configure shell command (very common in open source projects) with mixed results:
    CFLAGS='-arch x86_64 -DCPU=\"x86_64\" -Wc,-m64' LDFLAGS='-arch x86_64' ./configure
    Does anyone have any other ideas or better yet, something that works 100% of the time.
    TIA.
    Jason

    Not all open-source projects are as well "configure"-ed as others. I haven't yet done anything with x86_64, but I have had good success with the following aliases:
    alias uconfigure='env CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" ./configure --disable-dependency-tracking'
    alias uconfigurelib='env CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" ./configure --prefix=/Programming/Libraries --disable-dependency-tracking'
    alias umake='env CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" make'
    Some caveats. These aliases are probably overkill and are doing the same thing redundantly over, and over again. But some of the projects I have had to compile just weren't done correctly and I really had to work on them to get UB versions. Also, I have done very little with Leopard and nothing with x86_64. Finally, the uconfigurelib alias is so I can install libraries in a non-standard location, out of the path, and test including dynamic libraries inside an application bundle.
    None of these aliases will work for every project. In some cases, they could screw something up badly. In particular, if an application/library uses #defines to do byte-swapping, or even does any byte swapping, you'll have additional work to do. Also, if the software wants to access installed data in the "--prefix" path, then uconfigurelib will not work properly.
    So no, these are not 100% guaranteed, but they are a good start and have worked fine on several projects.

  • How do I compile my Swing project to native code?

    I love to use the Java programming language. I want to create an application for Windows that can run without the JVM, JRE or any other runtime environment. I want to write my application in Java (because of the outstanding language structure) and be able to distribute it like any other application that can be downloaded from the internet without having to supply several megabytes of support files.
    I have been looking around for native compilers, found JOVE, Excelsior JET etc., but they all seems to require some kind of runtime environment on the target computer. Can it be that hard to make a Java compiler that extracts what it needs from used libraries and puts it together with application code to a single program .exe file. Just the way most programming language compilers do! I don't care if the concept of being able to run applications on different OS is disposed. Sure, I could use another language, but I just happen to like Java!
    Could anyone suggest a compiler that does this? I would apprieciate it alot! Thanks

    Hello Swing components could easily be translated to IBM SWT, I found IBM SWT easy to use and eclipse platform just a perfect development tool. Excelsior then allows you to produce a fully compiled version of classes, given that they do not contain SWT/Swing.
    I hope you will find this information useful.
    P.S.
    Anyone knows whether JRE-free applications could contain JDBC:ODBC connectivity? My application work fine, everything is fully compiled BUT JDBC.

  • How to build applications with a non standard stlport

    Hi,
    I have a separate compiled version of stlport that I am supposed to use to build my application. In other words, I do not want to use the stlport that comes with the Sun compiler. I am aware of using -library=stlport4 when I use the default stlport that comes with the compiler.
    What flags/options should I use when I have my own stlport (libstlport_sunpro.so) library?
    I am using Sun C++ 5.6 2004/07/15 on SunOS 5.8.
    Pls help.
    Thanks
    Edited by: Sreeni_dd on Jul 23, 2009 12:50 PM

    Details are in the C++ Users Guide, section 12.7 "Replacing the C++ Standard Library". Here is a summary.
    1. Add the option -library=no%Cstd to disable both libCstd and STLport.
    2. Add a -I option that points to the include directory for the stlport headers you want to use. (Do NOT use the headers in the compiler installation.) Example:
    CC -library=no%Cstd -I/path/to/stlport/include -I/project1 -I/project2 ... If the compiler doesn't always find the headers, put the -I stlport option at the end of the other -I options, preceded by a -I- (dash eye dash) option. Example:
    CC -library=no%Cstd -I/project1 -I/project2 -I- -I/path/to/stlport/include ... This procedure is not optimal, since you would like to search STLport headers before searching other headers. use the -I- option only if needed.
    If you have file name conflicts with the STLport header files, you will need to add a set of symbolic links *.SUNWCCh as described in the C++ Users Guide.
    3. For link commands, add a -L option pointing to the directory where the compiled STLport library is located. Assuming this library is called libstlport.so, also add the option -lstlport. Linking a static libstlport.a is not recommended if your program uses any shared libraries. Example:
    CC -o myprog *.o -L/path/to/stlport/lib -lstlport

  • Error when compiling on app server

    I have the following trigger (as well as others) that runs fine on my machine (Win2K Pro Dev. Rel. Forms Version 9.0.2.12.2) but when I try to compile on the application server I get errors.
    Begin
    Select s_comment.NextVal
    Into comm_id
    From dual;
    end;
    Compiling PRE-INSERT trigger on form...
    Compilation error on PRE-INSERT trigger on form:
    PL/SQL ERROR 201 at line 4, column 6
    identifier 'DUAL' must be declared
    PL/SQL ERROR 0 at line 2, column 1
    SQL Statement ignored
    Am I missing something very simple?

    or are you suggesting I compile from the
    command prompt using a connect string? Thanks.Yes. I don't know anything about 9ias app server on linux, but on windows you can use this command from the command line.
    ifcmp90 should be located in <ORACLE_HOME>/bin.
    ifcmp90 module=<mymodule> userid=usr/pwd@db batch=YES Output_File=<myfmx>
    Hope this helps
    Gerald Krieger

  • How to compile and package my EJB application

    Hi,
    I just ran the sample programs from the Sun J2EE tutorial. Seems to work fine. I used the ant utility to compile all the programs and the J2EE Deployment Wizard to package and deploy everything. Now how do I compile and deploy a sample EJB program that I have written ?
    I am using the following platforms:
    1: JBuilder 3.0 : IDE (for writing the source code)
    2: JDK 1.4.0_01
    3: J2SDK EE 1.3.1 (EJB/Appln server)
    How do I make ant recognize my program and compile it... i guess the deployment procedure would still be the same.
    Can somebody please help me out on this ??
    Thanks
    prasanna

    Hi,
    Thanks for your prompt reply. I tried that out.. I have a directory called "customer" under which I have my interfaces,bean implementation class and the J2EE application client.
    ANT_HOME is set to : the directory where ant is installed
    JAVA_HOME is set to : the directory where JDK is installed
    J2EE_HOME is set to : the directory where J2EE server is installed
    and PATH : includes the bin directories of JDK, ant and J2SDK EE
    These are the paths I had to set when I ran the J2EE tutorial programs. It worked fine.
    Now when I say : ant myprogram I get an error saying:
    BUILD FAILED
    Target "myprogram" does not exist in this project
    How do I add my program also to the project so that ant can recognize it ?
    Also if there is any other way you can suggest to compile and package my application it would be great...
    Thanks
    prasanna

  • Problems compiling stlport4.6.2 with Forte CC 5.4

    Hi,
    I am compiling stlport 4.6.2 with CC 5.4 and i have this error:
    /opt/FORTE/SUNWspro/bin/CC -mt -library=no%Cstd -features=rtti -xildoff -I. -I/users/comun/personales/manuel/STLPort/STLport-4.6.2/src/../stlport -O2 -qoption ccfe -expand=1000 -PIC -ptr/users/comun/personales/manuel/STLPort/STLport-4.6.2/src/../lib/obj/SUN/ReleaseD dll_main.cpp -c -o /users/comun/personales/manuel/STLPort/STLport-4.6.2/src/../lib/obj/SUN/ReleaseD/dll_main.o
    "/users/comun/personales/manuel/STLPort/STLport-4.6.2/src/../stlport/stl/debug/_debug.c", line 246: Error: va_list is not a member of std.
    "dll_main.cpp", line 151: Where: While instantiating "static _STL::__stl_debug_engine<bool>::_Message(const char*, ...)".
    "dll_main.cpp", line 151: Where: Instantiated from non-template code.
    "/users/comun/personales/manuel/STLPort/STLport-4.6.2/src/../stlport/stl/debug/_debug.c", line 246: Error: __args is not defined.
    "dll_main.cpp", line 151: Where: While instantiating "static _STL::__stl_debug_engine<bool>::_Message(const char*, ...)".
    "dll_main.cpp", line 151: Where: Instantiated from non-template code.
    "/users/comun/personales/manuel/STLPort/STLport-4.6.2/src/../stlport/stl/debug/_debug.c", line 246: Error: Badly formed expression.
    "dll_main.cpp", line 151: Where: While instantiating "static _STL::__stl_debug_engine<bool>::_Message(const char*, ...)".
    "dll_main.cpp", line 151: Where: Instantiated from non-template code.
    "/users/comun/personales/manuel/STLPort/STLport-4.6.2/src/../stlport/stl/debug/_debug.c", line 247: Error: __args is not defined.
    "dll_main.cpp", line 151: Where: While instantiating "static _STL::__stl_debug_engine<bool>::_Message(const char*, ...)".
    "dll_main.cpp", line 151: Where: Instantiated from non-template code.
    "/users/comun/personales/manuel/STLPort/STLport-4.6.2/src/../stlport/stl/debug/_debug.c", line 266: Error: __args is not defined.
    "dll_main.cpp", line 151: Where: While instantiating "static _STL::__stl_debug_engine<bool>::_Message(const char*, ...)".
    "dll_main.cpp", line 151: Where: Instantiated from non-template code.
    5 Error(s) detected.
    make: *** [users/comun/personales/manuel/STLPort/STLport-4.6.2/src/../lib/obj/SUN/ReleaseD/dll_main.o] Error 5
    I�d supressed the warning messages for cleaning the error.
    Thanks in avanced.

    C++ 5.4 (with recent patches) comes with STLport version 4.5.3. You use it by adding the option -library=stlport4 to every CC command line. Is there some reason why you can' t use that version of STLport?
    STLport is very difficult to configure. When we finally got STLport 4.5.x working with C++ 5.4, we gave the changes back to Boris. I don't know whether later STLport updates preserved the fixes we made.
    If you must build your own version of STLport 4.6.2, compare your configuration with what comes with the compiler. Some of the error messages look like configuration errors.
    Historically, the STLport build process was not correct for using recent Sun compilers on recent versions of Solaris. Be sure that STLport is NOT using its own versions of the C standard headers. Check the compiler options in the Makefiles, and remove any -I directives that point into /usr/include or into the compiler installation area. If the compiler options include w2, change it to w or remove it entirely. The w2 option will generate a lot of warnings that are not relevant to building the C+ standard library.

  • Java Class path for Oracle package compilation

    Hello
    I am trying to send mail with file attachment, this part is
    done by java program, it is compiled & working fine.
    I am trying to compile the same java program at SQL prompt so
    that I can build a package to execute that Java program from
    Oracle. As java prog requires other class files
    (javax.mail.*,javax.mail.internet.*,javax.activation.*) to be
    include , those class path is set at their respective location
    of OS.
    Other Java programs are compiling fine from SQL but for this
    mail prog, it is giving error as it is not finding the location
    of the include files.
    Can anyone tell me from which class path does Oracle 8i compiles
    Java program ? any additional information reqdng this issue ?
    thanks

    Hello Suresh Vemulapalli
    Thanks for replay & suggestion, I compiled using loadjava on
    OS & it is working fine
    regards
    Prakash K.B.

  • Compile fails in Robo 7

    My RoboHelp 7 install fails to compile some legacy projects
    (created in X5) that I have managed to open.
    Some topics in this forum suggest that compilation problems
    may be related to the graphics in the doc. When I click the
    RoboHelp menu in Word, to switch to True Code view, the menu does
    not display. I only see part of the menu border and no commands.
    Anyone seen this kind of thing?

    Am running RoboHelp 6, and experiencing a similar problem on
    an intermittent basis:
    Sometimes, the ROBOHELP keyword is missing altogether from
    the menu bar, and sometimes it's displayed.
    Sometimes, it looks like the ROBOHELP keyword is displayed
    for a brief instant, and then vanishes!
    Have already tried uninstalling and reinstalling RoboHelp -
    but to no avail!
    Any other suggestions?

  • Sun Studio C++ v5.3 adding complex gives errors

    If anyone can privide info on the following issue I would greatly appreciate it.. I have a simple test app that does not compile. This is with Sun Studion C++ v5.3 (I think then called Sun Workshop Pro) on a Solaris 5.8 machine.
    #include <complex>
    using namespace std;
    int main()
      complex<int> a(1, 2);
      complex<int> b(3, 4);
      complex<int> c;
      c = a + b;
      cout << "Answer: " << c << endl;
      return 0;
    }When compiling I get the following error:
    /opt/SUNWspro/WS6U2/include/CC/Cstd/complex Line 1006: Error The operation "std::complex<int> += const std::complex<int> is illegal
    sol_cpx.cc Line 10 Where: While instantiating std::complex<int>+ ( const std::complex<int>, const std::complex<int> )
    sol_cpx.cc Line 10 Where: Instantiated from non-template code
    Are there any compiler flags to handle this or is there an update I can get to fix this? Any help would be much appreciated since I'm clueless. Thank you!

    complex<int> is not supported. The only specializations of type complex are float, double, and long double.
    The suggestion to try stlport won't work with C++ 5.3.
    We began supplying stlport with C++ 5.4.
    C++ 5.3 has been declared End Of Life, and only limited support is available for it. You can download a copy of the current release, Sun Studio 10, and try it free for 60 days.
    http://www.sun.com/software/products/studio/index.xml

  • Unable to capture startup and shutdown event of Photoshop in automation Plugin.

    Hi,
    I am creating an automation plugin and I want to register some events. I have seen listener plugin sample to register event in startup and unregister event in shutdown. I have used same code in my plugin but I am unable to capture the startup nad shutdown event of Photoshop. On clicking the menu item of my plugin the calls come inside the AutoPluginMain but during the startup or shutdown of plugin, the calls does not come inside the AutoPluginMain.
    I am unable to detect the cause of the problem. Can someone please giude me??
    Thanks in advance.

    Hi Tom,
    Thanks for the suggestion.
    Yes, I am working on Windows. As you suggested, I compiled .rc file but the compile option for .r file was disabled. After compiling the .rc file, I again rebuild the complete project and tested my build. But still I was not able to achive the desired result.
    Any other thing that I need to do to make it work?
    Thanks

  • Bouncing Ball without Main Method

    Hi. I needed to reserch on the Internet sample code for a blue bouncing ball which I did below. However, I try coding a main class to start the GUI applet and it's not working. How can I create the appropriate class that would contain the main method to start this particular application which the author did not provide? The actual applet works great and matches the objective of my research (http://www.terrence.com/java/ball.html). The DefaultCloseOperation issues an error so that's why is shown as remarks // below. Then the code in the Ball.java class issues some warning about components being deprecated as shown below. Thank you for your comments and suggestions.
    Compiling 2 source files to C:\Documents and Settings\Fausto Rivera\My Documents\NetBeansProjects\Rivera_F_IT271_0803B_01_PH3_DB\build\classes
    C:\Documents and Settings\Fausto Rivera\My Documents\NetBeansProjects\Rivera_F_IT271_0803B_01_PH3_DB\src\Ball.java:32: warning: [deprecation] size() in java.awt.Component has been deprecated
        size = this.size();
    C:\Documents and Settings\Fausto Rivera\My Documents\NetBeansProjects\Rivera_F_IT271_0803B_01_PH3_DB\src\Ball.java:93: warning: [deprecation] mouseDown(java.awt.Event,int,int) in java.awt.Component has been deprecated
      public boolean mouseDown(Event e, int x, int y) {
    2 warnings
    import javax.swing.*;
    public class BallMain {
    * @param args the command line arguments
    public static void main(String[] args) {
    Ball ball = new Ball();
    //ball.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    ball.setSize( 500, 175 ); // set frame size
    ball.setVisible( true ); // display frame
    import java.awt.*;*
    *import java.applet.*;
    import java.util.Vector;
    // Java Bouncing Ball
    // Terrence Ma
    // Modified from Java Examples in a Nutshell
    public class Ball extends Applet implements Runnable {
    int x = 150, y = 100, r=50; // Position and radius of the circle
    int dx = 8, dy = 5; // Trajectory of circle
    Dimension size; // The size of the applet
    Image buffer; // The off-screen image for double-buffering
    Graphics bufferGraphics; // A Graphics object for the buffer
    Thread animator; // Thread that performs the animation
    boolean please_stop; // A flag asking animation thread to stop
    /** Set up an off-screen Image for double-buffering */
    public void init() {
    size = this.size();
    buffer = this.createImage(size.width, size.height);
    bufferGraphics = buffer.getGraphics();
    /** Draw the circle at its current position, using double-buffering */
    public void paint(Graphics g) {
    // Draw into the off-screen buffer.
    // Note, we could do even better clipping by setting the clip rectangle
    // of bufferGraphics to be the same as that of g.
    // In Java 1.1: bufferGraphics.setClip(g.getClip());
    bufferGraphics.setColor(Color.white);
    bufferGraphics.fillRect(0, 0, size.width, size.height); // clear the buffer
    bufferGraphics.setColor(Color.blue);
    bufferGraphics.fillOval(x-r, y-r, r*2, r*2); // draw the circle
    // Then copy the off-screen buffer onto the screen
    g.drawImage(buffer, 0, 0, this);
    /** Don't clear the screen; just call paint() immediately
    * It is important to override this method like this for double-buffering */
    public void update(Graphics g) { paint(g); }
    /** The body of the animation thread */
    public void run() {
    while(!please_stop) {
    // Bounce the circle if we've hit an edge.
    if ((x - r + dx < 0) || (x + r + dx > size.width)) dx = -dx;
    if ((y - r + dy < 0) || (y + r + dy > size.height)) dy = -dy;
    // Move the circle.
    x += dx; y += dy;
    // Ask the browser to call our paint() method to redraw the circle
    // at its new position. Tell repaint what portion of the applet needs
    // be redrawn: the rectangle containing the old circle and the
    // the rectangle containing the new circle. These two redraw requests
    // will be merged into a single call to paint()
    repaint(x-r-dx, y-r-dy, 2*r, 2*r); // repaint old position of circle
    repaint(x-r, y-r, 2*r, 2*r); // repaint new position of circle
    // Now pause 50 milliseconds before drawing the circle again.
    try { Thread.sleep(50); } catch (InterruptedException e) { ; }
    animator = null;
    /** Start the animation thread */
    public void start() {
    if (animator == null) {
    please_stop = false;
    animator = new Thread(this);
    animator.start();
    /** Stop the animation thread */
    public void stop() { please_stop = true; }
    /** Allow the user to start and stop the animation by clicking */
    public boolean mouseDown(Event e, int x, int y) {
    if (animator != null) please_stop = true; // if running request a stop
    else start(); // otherwise start it.
    return true;
    }

    FRiveraJr wrote:
    I believe that I stated that this not my code and it was code that I researched.and why the hll should this matter at all? If you want help here from volunteers, your code or not, don't you think that you should take the effort to format it properly?

  • Error 7 occurred at Create Folder in Create Directory Recursive.vi-

    Recieved following message when attemoting to create source distribution
    Error 7 occurred at Create Folder in Create Directory Recursive.vi->ABAPI Dist Create Directory Recursive.vi->ABAPI Dist Chk for Destinations.vi->ABAPI Copy Files and Apply Settings.vi->SDBEP_Invoke_Build_Engine.vi->SDBUIP_Build_Invoke.vi->SDBUIP_Build_Rule_Editor.vi->SDBUIP_Item_OnDoProperties.vi->SDBUIP_Item_OnDoProperties.vi.ProxyCaller
    Possible reason(s):
    LabVIEW:  File not found. The file might have been moved or deleted, or the file path might be incorrectly formatted for the operating system. For example, use \ as path separators on Windows, : on Mac OS, and / on Linux.

    Hello,
    Could you please list which options you are selecting when building a
    source distribution (I am assuming you are using LabVIEW 8.0?).
    Do you get this error when clicking on "Generate Preview" button when configuring source distribution properties?
    Under "Distribution Settings" category, could you try checking the
    "Disconnect type definitions and remove unuses polymorphic VI
    instances" option and see if that helps with the build process?
    Also I suggest Mass Compiling your VIs (Tools -> Advanced -> Mass Compile) before creating a source distribution.
    If these do not help, could you attach your project with all the VIs it contains here?
    Thank you and best regards,
    Shakhina P.
    Applications Engineer
    National Instruments

  • How to check special characters in java code using Java.util.regex package

    String guid="first_Name;Last_Name";
    Pattern p5 = Pattern.compile("\\p{Punct}");
    Matcher m5 =p5.matcher(guid);
    boolean test=m5.matches();
    I want to find out the weather any speacial characters are there in the String guid using regex.
    but above code is always returning false. pls suggest.

    Pattern.compile ("[^\\w]");The above will match any non [a-zA-Z0-9_] character.
    Or you could do
    Pattern.compile("[^\\s^\\w]");This should match anything that is not a valid charcter and is not whitespace.

  • Error:  microedition.io.* package does not exists

    Been at this for a few days...frustration...funny.
    Using JDK 1.6 NetBeant 6.8 with WTK 2.5.2 on XP
    Was able to resolve the javax.bluetooth.* package does not exists and xylostudio by doing the following to add the libraries to the project file.
    1) Tools > Libraries
    2) in the pop up Library Manager window click 'New Library'
    3) in the pop up New Library window typed 'bluetooth' > OK
    3) highlight 'bluetooth' in Library Manager scroll menu on left
    4) click add JAR/Folder
    5) added jsr082 from C;\WTK2.5.2_01\lib\jsr082.jar
    6) click OK
    7) right click project and select properites
    8) highlight the library node under Categories on the left side of the Project Properties window
    9) 'Add Library' created 'bluetooth'
    10) click OK
    When the process was followed to resolve the microedition.io.* package does not exist error it was unsuccessful.
    The difference in the two processes being New Library name: 'microedition' and added jsr75, MIDPapi20, jsr118, then MIDPapi21 with no resolution to the errors.
    Also add the jsr75, MIDPapi20, jsr118, and MIDPapi21 directly to the project by clicking the 'Add JAR/Folder' button in the Project Properties window.
    Here is the Output:
    init:
    deps-clean:
    Updating property file: C:\Scholastic\4340MS\REU\ItsAForum\build\built-clean.properties
    Deleting directory C:\Scholastic\4340MS\REU\ItsAForum\build
    clean:
    init:
    deps-jar:
    Created dir: C:\Scholastic\4340MS\REU\ItsAForum\build
    Updating property file: C:\Scholastic\4340MS\REU\ItsAForum\build\built-jar.properties
    Created dir: C:\Scholastic\4340MS\REU\ItsAForum\build\classes
    Created dir: C:\Scholastic\4340MS\REU\ItsAForum\build\empty
    Compiling 8 source files to C:\Scholastic\4340MS\REU\ItsAForum\build\classes
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:8: cannot find symbol
    symbol : class Connector
    location: package javax.microedition.io
    import javax.microedition.io.Connector;
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:9: cannot find symbol
    symbol : class StreamConnection
    location: package javax.microedition.io
    import javax.microedition.io.StreamConnection;
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:10: cannot find symbol
    symbol : class StreamConnectionNotifier
    location: package javax.microedition.io
    import javax.microedition.io.StreamConnectionNotifier;
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:19: cannot find symbol
    symbol : class StreamConnectionNotifier
    location: class mobile.communication.Server
    private StreamConnectionNotifier server = null;
    ^
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:20: cannot find symbol
    symbol : class StreamConnection
    location: class mobile.communication.Server
    private StreamConnection connection = null;
    ^
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:58: cannot find symbol
    symbol : class StreamConnectionNotifier
    location: class mobile.communication.Server
    server = (StreamConnectionNotifier)Connector.open(URL);
    ^
    C:\Scholastic\4340MS\REU\ItsAForum\src\mobile\communication\Server.java:58: cannot find symbol
    symbol : variable Connector
    location: class mobile.communication.Server
    server = (StreamConnectionNotifier)Connector.open(URL);
    ^
    7 errors
    C:\Scholastic\4340MS\REU\ItsAForum\nbproject\build-impl.xml:413: The following error occurred while executing this line:
    C:\Scholastic\4340MS\REU\ItsAForum\nbproject\build-impl.xml:199: Compile failed; see the compiler error output for details.
    BUILD FAILED (total time: 4 seconds)
    any information would be much appreciated. Thanks,
    LD

    By completing the process shown in below link and adding the bluecove jar file directly to the project as of the reply post suggests, all compilation errors were corrected.
    http://forums.netbeans.org/viewtopic.php?t=22823&start=0&postdays=0&postorder=asc&highlight=microedition
    Thanks me for point me in the right direction,
    Me is happy.

Maybe you are looking for

  • Can't enter address in Safari

    I am running Safari 4.1.1 on OSX 10.4.11. When I try to type in a webpage address, Safari freezes up and I need to force quit it. I just downloaded a new 10.4.11 to try to upgrade it, but it still does it. What's up?

  • Layout page shifted in IE 6.0

    Please I need some help! My site looks good in all browsers except in IE 6.0. Content of the page is shifted all the way to the bottom.. Have no idea why.. Been trying to figure this out for the last 2 days! Any suggestions are welcomed. Thanks! Link

  • DMS - Configuration and Business blue Print Doc needed

    Hi, I am looking for following documents, as currently studying DMS - 1.DMS configuration document 2.DMS Business blue print (there were some similar old threads but could not get hold of them) request you to please email at [email protected] Will ap

  • I am unable to see attachments from certain senders.

    Good morning. I receive many different forms of attachments during the week, but I seem to be having a problem with any emails that contain PDF attachments. I know that there is one there, but there is no 'paperclip' and I am unable to download. I ca

  • Harddisk is generating heat

    My harddisk generates quite a bit of heat. Temperature almost always stays above 50 c  and some times even reaches 60 c. I have read that heat is not particularly good for harddisks. I dual boot with windows 7/ Ubuntu 9.10 Karmic Cola on Compaq presa