Qt simple example crash-on-exit

It's my first time toying with Qt, so please consider not being too harsh on my mistakes.
I wrote this piece of code just to figure out how the build mechanisms worked:
#include <QtGui>
int main(int argv, char **args)
QApplication app(argv, args);
QVBoxLayout layout;
QWidget window;
window.setLayout(&layout);
window.show();
return app.exec();
Saved as app.cpp in qttest2 directory in my home.
The I issued:
qmake -project; qmake; make
All went OK, then, testing the app, I got this backtrace on console:
$ ./qttest2
*** glibc detected *** ./qttest2: free(): invalid pointer: 0xaf871774 ***
======= Backtrace: =========
/lib/libc.so.6(+0x6c301)[0xa6c0d301]
/lib/libc.so.6(+0x6dc4b)[0xa6c0ec4b]
/lib/libc.so.6(cfree+0x6d)[0xa6c11dfd]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xa6db7281]
/usr/lib/libQtGui.so.4(_ZN11QVBoxLayoutD0Ev+0x2a)[0xa6f3348a]
/usr/lib/libQtGui.so.4(_ZN7QWidgetD2Ev+0x153)[0xa6f772c3]
./qttest2[0x8048844]
/lib/libc.so.6(__libc_start_main+0xe6)[0xa6bb7c76]
./qttest2[0x8048711]
======= Memory map: ========
08048000-08049000 r-xp 00000000 08:04 655619 /home/luca/lavori/qttest2/qttest2
08049000-0804a000 rw-p 00000000 08:04 655619 /home/luca/lavori/qttest2/qttest2
09bb0000-09cad000 rw-p 00000000 00:00 0 [heap]
a4e00000-a4e21000 rw-p 00000000 00:00 0
a4e21000-a4f00000 ---p 00000000 00:00 0
a4fe3000-a4fed000 r-xp 00000000 08:04 1623 /lib/libnss_files-2.12.1.so
a4fed000-a4fee000 r--p 00009000 08:04 1623 /lib/libnss_files-2.12.1.so
a4fee000-a4fef000 rw-p 0000a000 08:04 1623 /lib/libnss_files-2.12.1.so
a4fef000-a4ffc000 r-xp 00000000 08:04 7447 /usr/lib/liboxygenstyle.so.4.5.0
a4ffc000-a4ffd000 rw-p 0000d000 08:04 7447 /usr/lib/liboxygenstyle.so.4.5.0
a4ffd000-a5086000 r-xp 00000000 08:04 52943 /usr/lib/kde4/plugins/styles/oxygen.so
a5086000-a508a000 rw-p 00088000 08:04 52943 /usr/lib/kde4/plugins/styles/oxygen.so
a508a000-a50c5000 r-xp 00000000 08:04 5654 /usr/lib/libdbus-1.so.3.5.3
a50c5000-a50c6000 r--p 0003b000 08:04 5654 /usr/lib/libdbus-1.so.3.5.3
a50c6000-a50c7000 rw-p 0003c000 08:04 5654 /usr/lib/libdbus-1.so.3.5.3
a50c7000-a522a000 r-xp 00000000 08:04 84087 /usr/lib/libcrypto.so.1.0.0
a522a000-a523e000 rw-p 00162000 08:04 84087 /usr/lib/libcrypto.so.1.0.0
a523e000-a5241000 rw-p 00000000 00:00 0
a5241000-a528e000 r-xp 00000000 08:04 82299 /usr/lib/libssl.so.1.0.0
a528e000-a5292000 rw-p 0004d000 08:04 82299 /usr/lib/libssl.so.1.0.0
a5292000-a53b3000 r-xp 00000000 08:04 230 /usr/lib/libxml2.so.2.7.8
a53b3000-a53b8000 rw-p 00121000 08:04 230 /usr/lib/libxml2.so.2.7.8
a53b8000-a53b9000 rw-p 00000000 00:00 0
a53b9000-a53f3000 r-xp 00000000 08:04 51628 /usr/lib/libstreams.so.0.7.2
a53f3000-a53f4000 rw-p 0003a000 08:04 51628 /usr/lib/libstreams.so.0.7.2
a53f4000-a5448000 r-xp 00000000 08:04 6145 /usr/lib/libsopranoclient.so.1.2.0
a5448000-a544a000 rw-p 00053000 08:04 6145 /usr/lib/libsopranoclient.so.1.2.0
a544a000-a5584000 r-xp 00000000 08:04 6136 /usr/lib/libsoprano.so.4.3.0
a5584000-a5588000 rw-p 00139000 08:04 6136 /usr/lib/libsoprano.so.4.3.0
a5588000-a55a8000 r-xp 00000000 08:04 16734 /usr/lib/liblzma.so.5.0.0
a55a8000-a55a9000 rw-p 00020000 08:04 16734 /usr/lib/liblzma.so.5.0.0
a55a9000-a55b8000 r-xp 00000000 08:04 1949 /lib/libbz2.so.1.0.6
a55b8000-a55b9000 rw-p 0000f000 08:04 1949 /lib/libbz2.so.1.0.6
a55b9000-a55bd000 r-xp 00000000 08:04 19382 /usr/lib/libXtst.so.6.1.0
a55bd000-a55be000 rw-p 00003000 08:04 19382 /usr/lib/libXtst.so.6.1.0
a55be000-a55eb000 r-xp 00000000 08:04 38896 /usr/lib/libdbusmenu-qt.so.2.3.6
a55eb000-a55ec000 rw-p 0002d000 08:04 38896 /usr/lib/libdbusmenu-qt.so.2.3.6
a55ec000-a5664000 r-xp 00000000 08:04 10896 /usr/lib/libQtDBus.so.4.7.1
a5664000-a5665000 rw-p 00078000 08:04 10896 /usr/lib/libQtDBus.so.4.7.1
a5665000-a56b7000 r-xp 00000000 08:04 14090 /usr/lib/libQtSvg.so.4.7.1
a56b7000-a56b9000 rw-p 00051000 08:04 14090 /usr/lib/libQtSvg.so.4.7.1
a56b9000-a56bd000 r-xp 00000000 08:04 2803 /lib/libattr.so.1.1.0
a56bd000-a56be000 rw-p 00003000 08:04 2803 /lib/libattr.so.1.1.0
a56be000-a56c4000 r-xp 00000000 08:04 2751 /lib/libacl.so.1.1.0
a56c4000-a56c5000 rw-p 00005000 08:04 2751 /lib/libacl.so.1.1.0
a56c5000-a5703000 r-xp 00000000 08:04 14109 /usr/lib/libQtXml.so.4.7.1
a5703000-a5705000 rw-p 0003d000 08:04 14109 /usr/lib/libQtXml.so.4.7.1
a5705000-a5816000 r-xp 00000000 08:04 14177 /usr/lib/libQtNetwork.so.4.7.1
a5816000-a581a000 rw-p 00110000 08:04 14177 /usr/lib/libQtNetwork.so.4.7.1
a581a000-a588a000 r-xp 00000000 08:04 23679 /usr/lib/libsolid.so.4.5.0
a588a000-a5892000 rw-p 00070000 08:04 23679 /usr/lib/libsolid.so.4.5.0
a5892000-a5915000 r-xp 00000000 08:04 51631 /usr/lib/libstreamanalyzer.so.0.7.2
a5915000-a5917000 rw-p 00083000 08:04 51631 /usr/lib/libstreamanalyzer.so.0.7.2
a5917000-a599c000 r-xp 00000000 08:04 23700 /usr/lib/libnepomuk.so.4.5.0
a599c000-a599e000 rw-p 00085000 08:04 23700 /usr/lib/libnepomuk.so.4.5.0
a599e000-a5bf3000 r-xp 00000000 08:04 23653 /usr/lib/libkdecore.so.5.5.0
a5bf3000-a5bff000 rw-p 00255000 08:04 23653 /usr/lib/libkdecore.so.5.5.0
a5bff000-a5f6f000 r-xp 00000000 08:04 23868 /usr/lib/libkdeui.so.5.5.0
a5f6f000-a5f89000 rw-p 0036f000 08:04 23868 /usr/lib/libkdeui.so.5.5.0
a5f89000-a5f8a000 rw-p 00000000 00:00 0
a5f8a000-a61ca000 r-xp 00000000 08:04 27426 /usr/lib/libkio.so.5.5.0
a61ca000-a61d6000 rw-p 0023f000 08:04 27426 /usr/lib/libkio.so.5.5.0
a61d6000-a61d7000 rw-p 00000000 00:00 0
a61fe000-a61ff000 rw-s 00000000 00:04 41975925 /SYSV00000000 (deleted)
a61ff000-a6207000 r-xp 00000000 08:04 52944 /usr/lib/kde4/plugins/gui_platform/libkde.so
a6207000-a6208000 rw-p 00007000 08:04 52944 /usr/lib/kde4/plugins/gui_platform/libkde.so
a6208000-a620e000 r-xp 00000000 08:04 20298 /usr/lib/libXrandr.so.2.2.0
a620e000-a620f000 rw-p 00005000 08:04 20298 /usr/lib/libXrandr.so.2.2.0
a6210000-a621c000 r-xp 00000000 08:04 19339 /usr/lib/libXi.so.6.1.0
a621c000-a621d000 rw-p 0000b000 08:04 19339 /usr/lib/libXi.so.6.1.0
a621d000-a621f000 r-xp 00000000 08:04 19347 /usr/lib/libXinerama.so.1.0.0
a621f000-a6220000 rw-p 00001000 08:04 19347 /usr/lib/libXinerama.so.1.0.0
a6220000-a6228000 r-xp 00000000 08:04 21810 /usr/lib/libXcursor.so.1.0.2
a6228000-a6229000 rw-p 00007000 08:04 21810 /usr/lib/libXcursor.so.1.0.2
a6229000-a622d000 r-xp 00000000 08:04 20361 /usr/lib/libXfixes.so.3.1.0
a622d000-a622e000 rw-p 00003000 08:04 20361 /usr/lib/libXfixes.so.3.1.0
a622e000-a6237000 r--p 00000000 08:04 15494 /usr/share/locale/it/LC_MESSAGES/libc.mo
a6237000-a6239000 r--s 00000000 08:04 2765 /var/cache/fontconfig/699564f050ff7e0f9dae359f33bc56a5-le32d4.cache-3
a6239000-a623a000 r--s 00000000 08:04 2735 /var/cache/fontconfig/ec648e9a1aea82bddd4bd6050028158d-le32d4.cache-3
a623a000-a623b000 r--s 00000000 08:04 10499 /var/cache/fontconfig/2bb5794ea0204a417d14a0dee8a6a354-le32d4.cache-3
a623b000-a626f000 r--s 00000000 08:04 11130 /var/cache/fontconfig/f6b893a7224233d96cb72fd88691c0b4-le32d4.cache-3
a626f000-a62b0000 r--s 00000000 08:04 11128 /var/cache/fontconfig/17090aa38d5c6f09fb8c5c354938f1d7-le32d4.cache-3
a62b0000-a62f1000 r--s 00000000 08:04 11127 /var/cache/fontconfig/df311e82a1a24c41a75c2c930223552e-le32d4.cache-3
a62f1000-a64f1000 r--p 00000000 08:04 45118 /usr/lib/locale/locale-archive
a64f1000-a64f4000 rw-p 00000000 00:00 0
a64f4000-a64f8000 r-xp 00000000 08:04 18012 /usr/lib/libXdmcp.so.6.0.0
a64f8000-a64f9000 rw-p 00003000 08:04 18012 /usr/lib/libXdmcp.so.6.0.0Abortito
Did I do something wrong in the code or in the build process? And what?

The problem is that you allocated your QVBoxLayout object on the stack, though it's supposed to be on the heap so that the Qt framework can free the memory on its own once the object is no longer needed.

Similar Messages

  • Explain User exit concept with simple example

    Hi friends
    I am new member of this forum & i am learning ABAP.
    Kindly send me user exit concept with simple example to my mail ID so i can able to use it.
    mail ID  [email protected]
    thanks in advance
    Thanks & Regards

    Code SE18 is used to Identify the BADI available.
    Look for the string 'CL_EXITHANDLER' in the standard program. This is a class which has a method 'GET_INSTANCE' which is used to trigger BADI's from the Standard Program. The interface parameter for this static method 'EXIT_NAME' is used to pass the BADI to the method.
    Open Standard Program and do a global search 'CL_EXITHANDLER'.
    SE18 > give the BADI name found through above search.
    CUSTOMER_ADD_DATA > which has a method SAVE_DATA.
    T.Code SE19 is used to Implement BADI.
    SE19 > give the implementation name > Give the Definition name as CUSTOMER_ADD_DATA and the Short Text.
    Intro.....
    http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm
    Check these links for info about badi..
    BADI's
    http://support.sas.com/rnd/papers/sugi30/SAP.ppt
    BADI's
    http://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htm
    http://support.sas.com/rnd/papers/sugi30/SAP.ppt
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm
    http://members.aol.com/_ht_a/skarkada/sap/
    http://www.ct-software.com/reportpool_frame.htm
    http://www.saphelp.com/SAP_Technical.htm
    http://www.kabai.com/abaps/q.htm
    http://www.guidancetech.com/people/holland/sap/abap/
    http://www.planetsap.com/download_abap_programs.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htm
    /people/thomas.weiss/blog/2006/04/03/how-to-define-a-new-badi-within-the-enhancement-framework--part-3-of-the-series
    /people/thomas.weiss/blog/2006/04/18/how-to-implement-a-badi-and-how-to-use-a-filter--part-4-of-the-series-on-the-new-enhancement-framework
    http://www.esnips.com/web/BAdI
    http://www.allsaplinks.com/badi.html
    New to Badi
    check any fo the below links. this will def help u.
    http://www.allsaplinks.com/badi.html
    And also download this file....
    http://www.savefile.com/files.php?fid=8913854
    There are other tutorials on this site...
    http://sapbrain.com/Tutorials/tuto_download.html
    What are BAdIs?
    -> is an anticipated point of extension – these points act like sockets and exist in the original source code
    -> based on ABAP Objects. BAdI defines an interface that can be implemented by BAdI-implementations that are transport objects of their own
    ->Important! There are 2 roles: Enhancement Option-provider & Implementer.
    -> In the above context, Enhancement Implementation can be done only if option (hook) is provided by the Option-provider. In simple words there are no implicit BAdIs.
    Note: In the following slides, Definitions are created so as to understand the method of BAdI definition & for example purpose. As stated above this is the role of Enhancement Option-Provider.
    Classic BAdIs already exist since SAP Release 4.6
    BAdIs have been Re-implemented in ECC7.0 under the new Enhancement Framework & Switch Framework
    Classic BAdIs
    To understand what a powerful pattern a BAdI is, we will now define & then implement a BAdI
    BADI Class is created automatically.
    The various options are described below in detail:
    1. Enhanceable: Enhanceability of filter types can only be specified for filter-dependent BADI definitions under very special conditions. For example, the domain belonging to the filter type must be linked with a value table that is of the type E or G. A BADI implementation can then be created in one step by creating a new filter value that is automatically entered into the value table at save and also copied into the transport order of the BADI implementation. In addition, it is also possible to create a new filter value and, at the same time, a BADI implementation with the same name. Naturally, you can also specify existing filter values.
    You should select this feature if there is a prerequisite that a new filter value is created together with a new BADI implementation - that is, that BADI implementations are not created solely with existing filter values, although this, too, is possible.
    2. Multiple-Use
    3. Filter-Dependent
    Instance Methods can access all of the attributes of a class and can trigger all events of a class. Static Methods can only access static attributes and static events.
    Exceptions:
    Events:
    Events can be defined in classes or in interfaces. Corresponding methods can trigger these events with the RAISE EVENT statement. Each class (or interface) that is going to handle the corresponding event must implement a relevant handler method, and register it using the SET HANDLER statement. When an event occurs, the system calls all of the handler methods registered for that event.
    Like method definitions, events have a parameter interface. The only difference is that events may only have EXPORTING parameters.
    BADI : Businees Add IN's
    Business Add-Ins are SAP enhancement technique based on ABAP Objects.
    Where the SAP standard program is not going to fullfill the client requirement , we are going to add our own program to SAP standard program, without changing the standard prog.
    Each Business Add-In has
    – at least one Business Add-In definition
    – a Business Add-In interface
    – a Business Add-In class that implements the interface
    Each BADI has two different Views.
    1.Definition view
    2.Implementation view
    T.C for BADI Definition is SE18.
    T.C for BADI Implementation is SE19.
    There are multiple ways of searching for BADI.
    • Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE
    • Finding BADI Using SQL Trace (TCODE-ST05).
    • Finding BADI Using Repository Information System (TCODE- SE84).
    1. Go to the Transaction, for which we want to find the BADI, take the example of Transaction VD02. Click on System->Status. Double click on the program name. Once inside the program search for ‘CL_EXITHANDLER=>GET_INSTANCE’.
    Make sure the radio button “In main program” is checked. A list of all the programs with call to the BADI’s will be listed.
    The export parameter ‘EXIT_NAME’ for the method GET_INSTANCE of class CL_EXITHANDLER will have the user exit assigned to it. The changing parameter ‘INSTANCE’ will have the interface assigned to it. Double click on the method to enter the source code.Definition of Instance would give you the Interface name.
    2. Start transaction ST05 (Performance Analysis).
    Set flag field "Buffer trace"
    Remark: We need to trace also the buffer calls, because BADI database tables are buffered. (Especially view V_EXT_IMP and V_EXT_ACT)
    Push the button "Activate Trace". Start transaction VA02 in a new GUI session. Go back to the Performance trace session.
    Push the button "Deactivate Trace".
    Push the button "Display Trace".
    The popup screen "Set Restrictions for Displaying Trace" appears.
    Now, filter the trace on Objects:
    • V_EXT_IMP
    • V_EXT_ACT
    Push button "Multiple selections" button behind field Objects
    Fill: V_EXT_IMP and V_EXT_ACT
    All the interface class names of view V_EXT_IMP start with IF_EX_. This is the standard SAP prefix for BADI class interfaces. The BADI name is after the IF_EX_.
    So the BADI name of IF_EX_CUSTOMER_ADD_DATA is CUSTOMER_ADD_DATA
    3. Go to “Maintain Transaction” (TCODE- SE93).
    Enter the Transaction VD02 for which you want to find BADI.
    Click on the Display push buttons.
    Get the Package Name. (Package VS in this case)
    Go to TCode: SE84->Enhancements->Business Add-inns->Definition
    Enter the Package Name and Execute.
    Here you get a list of all the Enhancement BADI’s for the given package MB.
    Have a look at http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htm
    http://support.sas.com/rnd/papers/sugi30/SAP.ppt
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm
    http://members.aol.com/_ht_a/skarkada/sap/
    http://www.ct-software.com/reportpool_frame.htm
    http://www.saphelp.com/SAP_Technical.htm
    http://www.kabai.com/abaps/q.htm
    http://www.guidancetech.com/people/holland/sap/abap/
    http://www.planetsap.com/download_abap_programs.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htm
    /people/thomas.weiss/blog/2006/04/03/how-to-define-a-new-badi-within-the-enhancement-framework--part-3-of-the-series
    /people/thomas.weiss/blog/2006/04/18/how-to-implement-a-badi-and-how-to-use-a-filter--part-4-of-the-series-on-the-new-enhancement-framework
    How to develop BADI
    Rewards if useful.

  • Seeking simple example pl/sql to create text file from table data

    hello,
    I am hoping someone can provide very simple example of creating a file on my local harddrive using a pl/sql program. The basic steps are as follows:
    First, I store some text in a varchar2 variable like this:
    1. select sometext into otextvar from mytable where recordid = 1;
    Second, I want this text to become a file in my data directory:
    2. c:\data\sometext.txt
    The second step is where I need help.
    Any suggestions are greatly appreciated.

    Use this function
    It will create for you a file in your /home/oracle directory with sysdate name and will insert all table names in it
    CREATE OR REPLACE PROCEDURE my_proc AS
    CURSOR cursor1 IS
    SELECT table_name from all_tables;
    CURSOR cursor2 IS
    SELECT sysdate from dual;
    rec1 cursor1%ROWTYPE;
    rec2 cursor2%ROWTYPE;
    created_file_name VARCHAR2(100);
    file_name utl_file.file_type;
    BEGIN
    OPEN cursor2;
    LOOP
    FETCH cursor2 INTO rec2;
    EXIT WHEN cursor2%NOTFOUND;
    created_file_name:=rec2.sysdate;
    file_name := utl_file.fopen('/home/oracle', created_file_name,'W');
    OPEN cursor1;
    LOOP
    FETCH cursor1 INTO rec1;
    EXIT WHEN cursor1%NOTFOUND;
    utl_file.putf(file_name, '%s\n',rec1.TABLE_NAME);
    END LOOP;
    utl_file.fclose(file_name);
    END LOOP;
    END my_proc;
    SQL>exec my_proc;

  • InCopy CS5 Crashes Upon Exit

    Hello.  I am currently working with InCopy CS5 and have an issue with the software crashing when exiting the app. This error reads:
    Windows XP (32 bit) =>  "DDE Server Window:  InCopy.exe - Application Error  --  The instruction at "0x008f77f3" referenced memory at 0x0a9f6f18".  The memory could not be "read".  Click OK to terminate...."
    Windows 7 (64 bit) => "Adobe InCopy CS5 has stopped working."  ...details below
    Problem signature:
    Problem Event Name: APPCRASH
    Application Name: InCopy.exe
    Application Version: 7.0.3.535
    Application Timestamp: 4ca67239
    Fault Module Name: Public.dll
    Fault Module Version: 7.0.3.535
    Fault Module Timestamp: 4ca671ad
    Exception Code: c0000005
    Exception Offset: 001777f3
    OS Version: 6.1.7600.2.0.0.256.4
    Locale ID: 1033
    Additional Information 1: 0a9e
    Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
    Additional Information 3: 0a9e
    Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
    This ONLY happens when working with files on a network share (eiter UNC or mapped drive letter).  Copying the same files locally (c:\temp for example) works just fine.  Not knowing much about CS5, I obtained the files the tester was working with.  There are two fonts missing from the story / project that get replaced with the default font, and it was created with CS3.  Wouldn't suspect corrupt files if working with them locally doesn't have the problem...
    For installation, first is the base code from the CS5 disk followed by updates including Bridge 4.0.3, InCopy 7.0.3, Player for Embedding 3.1, Extended Script Toolkit 3.5.1, CS Live Services Update for CS5, and Photoshop Camera Raw 6.2.  All Adobe products are up to date according to the Adobe Applicaiton Manager.  Yes, the workstations have been rebooted.
    I don't see anything related in the support forums or through a google search.  Looking for assistance troubleshooting / resolving.  Thanks in advance.
    -Seth

    That is a sign that your preference files are becoming corrupt. Something is wrong with your system if this is happening regularly.
    Bob

  • Trying to create a simple example. Need Help!

    I'm trying to create a very simlpe examlpe using Swing components to illustrate a MVC architecture.
    I have a JFrame containing a JTree and a JButton.
    What I'd like to happen is when I click the JButton the JTree model is changed in some fashion and the the view is refreshed due to the models change.
    If anyone out there has a simple example of any MVC architecture involving Swing components I'd love to see it.
    Thx

    Sure, look at any of the Sun tutorials. For example, look in your API documentation for JTree; it has a link to a tutorial about how to use JTree.

  • Is there a simple example, I can see how to connect to a db using Flash 8 and actionscript? (not with components)

    I have been looking all over for a simple "hello world"
    example, on how to connect to a database, and pass a param, and
    return a dataset. I would like one that does not use components.
    (Actionscript only). That uses ColdFusion 7.x and Flash 8. Can
    anyone point me to one?

    Thanks Craig, I saw that example, but it was meant for Flash
    MX, and according to the Flash 8 documentation, the NetServices is
    now deprecated. Anyway, I posted my question on another site and
    some supplied me with a simple example. Here is the url if anyone
    is interested...
    sample

  • Looking for a simple example of the Minimax algorithm in java

    Hey everyone,
    I'm currently working on a Gameboy emulator program as a pet project, and for one of the game's I'd like for the enemy AI to use the Minimax algorithm, but I don't have any experience with it (or recursion in general, for that matter). Could anyone maybe post a simple example of how this algorithm works?

    WTF? I'm sure you can find plenty of examples on google. It's on you to take the time to go through them, study them, and, if you still don't understand something, post a clear, concrete question that indicates what you read and what you didn't understand about it.
    As is, you're essentially treating folks here as your research flunkies and saying, "Give me an example that's better than all the ones already easily available to me. Read my mind to know why I didn't like them."

  • I need for a simple example of  reading a xml file using jdom

    Hello
    I have been looking for a simple example that uses Jdom to read am xml file and use the information for anything( ), and I just can't find one.since I'm just beggining to understand how things work, I need a good example.thanks
    here is just a simple cod for example:
    <xmlMy>
         <table>
              <item name="first" value="123" createdDate="1/1/90"/>
              <item name="second" value="456" createdDate="1/4/96"/>
         </table>
         <server>
              <property name="port" value="12345"/>
              <property name="maxClients" value="3"/>
         </server>
    </xmlMy>Dave

    Hi,
            FileInputStream fileInputStream = null;
            try {
                fileInputStream = new FileInputStream("my_xml_file.xml");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } finally{
                if (fileInputStream == null) return;
            SAXBuilder saxBuilder = new SAXBuilder();
            saxBuilder.setEntityResolver(new EntityResolver() {
                public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
                    return new InputSource(new StringReader(""));
            Document document = null;
            try {
                document = saxBuilder.build(fileInputStream);
            } catch (JDOMException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                if (document == null) return;
            Element element = document.getRootElement();
            System.out.println(element.getName());
            System.out.println(element.getChild("table").getName());

  • Could u plz help me to find simple example for how to save data file in a spread sheet or any other way in the real time controller for Sbrio 9642 using memory or usb flash memory

    Could u plz help me to find simple example for how to save data file in a spread sheet or any other way in the real time controller for Sbrio 9642 using memory or usb flash memory

    Here are a few Links to a helpful Knowledge Base article and a White Paper that should help you out: http://digital.ni.com/public.nsf/allkb/BBCAD1AB08F1B6BB8625741F0082C2AF and http://www.ni.com/white-paper/10435/en/ . The methods for File IO in Real Time are the same for all of the Real Time Targets. The White Paper has best practices for the File IO and goes over how to do it. 
    Alex D
    Applications Engineer
    National Instruments

  • Photoshop CS3 Extended Crash on exit

    Problem with AdobeOwl.dll according to debug report. Also Variations not working. I can send jpg of crash report if you like.

    My CS3 Extended has just started to exhibit this crash on exit error: "This application has encountered an error and needs to close". It ran perfectly until about 1 week ago and I am wondering if it has anything to do with the latest Windows XP update to the Microsoft.NET Framework 3 as this is the only update I ran after returning from a weeks holiday.

  • I need some simple examples to start with for Oracle ESB

    Hi All,
    Please share some simple examples to startwith for Oracle ESB.
    I need to understand, what are the files are created, once created an ESB project.
    What is the use of the files how to edit them with out using JDeveloper.
    Iam trying to create a simple example.
    I would like to create a file which has only "HELLO" in that file, simple text file inside a folder "INPUT" in my c:\ drive.
    I wanted to create a ESB service which picks up the file and add a string to it like "HELLO" + "ESB" and drop this file into "OUTPUT" folder in c:\ drive.
    How do i do that. I tried to do it when i deploy the integration server connection is gettting hit badly. I dont see that connection any more and i dont see that connection in my JDeveloper.
    I dont want to start with existing code.
    Please help
    Regards,
    Vijay.B
    Message was edited by:
    Vijay.B
    Message was edited by:
    Vijay.B

    Hi,
    If you want to do it from scratch you can basically do the following:
    Make sure you have created an application server and integration server connection in JDeveloper.
    1) Create a new JDeveloper project of type ESB project.
    2) Possibly add a ESB System/Group (open the esb file and click "Create System/Group") to group ESB projects.
    3) Create an XML schema describing your input XML file. Probably one element of type xsd:string.
    4) Create an example XML file which is well-formed and valid according to the XSD from step 3.
    5) Create a new File adapter (inbound/read). A routing service is automatically created.
    6) Create a new File adapter (outbound/write).
    7) Create a routing rule in the routing service in which you invoke the write method of the outbound file adapter. Possibly add a transformation using the XSL mapper.
    8) Deploy the ESB project to the server.
    9) Drop your XML file (from step 4) in the directory in which the inbound file adapter is polling.
    10) If it is ok, the file should be picked up, transformed and dropped in the outbound directory. A new ESB instance should be visible in the ESB console.
    See what files are generated on the filesystem in each of the above steps.
    Regards, Ronald

  • RCP application on Windows JVM 1.6.0_12 crashed with exit code = 1073807364

    A user was using my RCP-based application over several days. At one point, when he apparently wasn't actively using it, the JVM crashed with exit code 1073807364. After some research, I haven't been able to determine what this exit code refers to.
    On additional, possibly helpful bit of information is that the hex equivalent 0x40010004 is used to indicate Windows task status. However, this app is not running Windows tasks that I know of, although perhaps RCP, SWT or the SQL Server JDBC layer is doing so without my knowledge.
    Can anyone tell me what this exit code indicates, or how to find out?

    [http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/crashes.html]

  • Taskkill /F broken in windows 8 when applied to a process that crashes on exiting

    It appears that Windows 8 has broken the taskkill command in part at least (actually, I think it is more likely a broken ability to set the debug attribute, which in prior Windows versions allowed taskkill to kill programs even if in a different security
    context; but I don't know exactly how to test that or prove my hypothesis).  When attempting to kill a process that is hung on exit (e.g., attempted a normal exit from the program, but it hangs and fails to exit, and continues to consume system resources),
    there appears to be no way to terminate the application/service, and an "access denied" error is generated even though run from the administrator command prompt.
    I have had this happen now many times with chrome.exe (which seems to have lots of issues with Windows 8 in general, but especially when exiting), as well as Skype.exe (a perpetual problem child program under any system).  It is repeatable if you can
    get any program to crash/hang on exit:
    (1) start a bunch of chrome.exe windows, especially ones that require resources like scripts, and then attempt to exit chrome window by window - this will cause chrome to crash on exit 5/10 times.  Confirm hung process via ctr-shift-esc and see
    that at least one chrome task is still running (chrome window may or may not still be visible)
    (2) From the administrator command line: "taskkill /IM chrome /F" which will give the access denied error.
    (3) psutils is also unsuccessful: pskill chrome /F also gives same error (run from administrator command prompt)
    As I understand prior Windows releases, there is a debug attribute that was set by these particular utilities (under Windows 7 and earlier) which allowed taskkill and pskill to kill processes even when the task manager failed to do so.  It seems
    that something is broken under Windows 8 now in that regard.
    Any ideas how to fix?  is there a registry fix?  Another utility that works under Windows 8?
    JeffN

    Hi,
    I tried the command in Windows 8, it works with no problem. I can even kill explorer.
    Juke Chou
    TechNet Community Support
    The problem is with killing certain "runaway" processes.  I can kill chrome just fine ... until it crashes!  Once it crashes, it is unkillable.  Something is not right.
    JeffN

  • Can't get "Simple Example Doclet" to run -- Cannot find

    I am trying to run the "Simple Example Doclet" at http://java.sun.com/j2se/1.3/docs/tooldocs/javadoc/overview.html.
    It appears to compile ok, but when I go to run it I get the message "javadoc: Cannot find doclet class ListClass".
    Listed below is:
         1. The execution command and error message
         2. The version (output of javadoc -J-version)
         3. The javac compile command and input and output files
    All directories have been kept the same as in the example.
    Any help would be appreciated.
    Thanks
    1. C:\jdk1.3>javadoc -doclet ListClass -classpath C:\jdk1.3\lib\tools.jar MyClass.java
    javadoc: Cannot find doclet class ListClass
    1 error
    2. javadoc -J-version
         gives
              java version "1.3.1_01"
              Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
              Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode).
    3. javac -classpath C:\jdk1.3\lib\tools.jar ListClass.java
         appears to give good compile ....
              e. g. Input source file ListClass.java is as follows:
                   import com.sun.javadoc.*;
                   public class ListClass {
                   public static boolean start(RootDoc root) {
                   ClassDoc[] classes = root.classes();
                   for (int i = 0; i < classes.length; ++i) {
                   System.out.println(classes);
                   return true;
              and.....
              decompiled ListClass.class file is as follows:
                   // Decompiled by DJ v2.8.8.54 Copyright 2000 Atanas Neshkov Date: 10/11/2001 4:09:46 PM
                   // Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
                   // Decompiler options: packimports(3)
                   // Source File Name: ListClass.java
                   import com.sun.javadoc.RootDoc;
                   import java.io.PrintStream;
                   public class ListClass
                   public ListClass()
                   public static boolean start(RootDoc rootdoc)
                   com.sun.javadoc.ClassDoc aclassdoc[] = rootdoc.classes();
                   for(int i = 0; i < aclassdoc.length; i++)
                   System.out.println(aclassdoc[i]);
                   return true;

    Sorry to be so late in getting back to you .. I was on vacation.
    ListClass is in the current directory. I did get it to work however... In order to get it to work I had to do two things:
    1. use -docletpath (even thought it was in the current path) e. g. -docletpath C:\jdk1.3\ListClass.jar
    AND
    2. Make the class file a jar file -- I could not get it to work otherwise.
    p.s. the typo was a decompiler error.

  • Need help with a very simple example.  Trying to reference a value

    Im very new to Sql Load and have created this very simple example of what I need to do.
    I just want to reference the ID column from one table to be inserted into another table as DEV_ID.
    Below are my: 1) Control File, 2) Datafile, 3) Table Description, 4) Table Description
    1) CONTROL FILE:
    LOAD DATA
    INFILE 'test.dat'
    APPEND
    INTO TABLE p_ports
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    DEV_id REF(CONSTANT 'P_DEVICES',NAME),
    NAME FILLER ,
    PORT_NO
    2) DATAFILE:
    COMM881-0326ES09,6
    3) TABLE DESCRIPTION:
    SQL> describe p_ports
    Name Null? Type
    ID NOT NULL NUMBER(10)
    DEV_ID NOT NULL NUMBER(10)
    PORT_NO     NUMBER(3)

    hi,
    i managed to do this for my app. (think i referred to viewTransitions sample code and modified quite a bit)
    i can't remember this well cos i did this quite a while back, but i will try to help as much as possible
    1) from the appdelegate i initialize a root controller (view controller class)
    2) this root controller actually contains two other view controllers, let's call it viewAController and viewBController, for the screens which u are going to toggle in between. and there's also a function, let's call it toggleMenu, which will set the menus to and fro. i copied this whole chunk from the sample code. it actually defines the code on what to do, i.e. if current view is A switch to B and vice versa.
    3) inside the controller files, you need to implement the toggleMenu function too, which basically calls the rootController's toggleMenu
    4) we also need viewA and viewB files(view class)
    5) need to add the .xib files for the respective views and link them up to the controller class. i did not use the .xib files for ui layout though, because of my app's needs. however, it will not work properly without the .xib files.
    5) inside the view class of both views, i.e. viewA.m and viewB.m, you need to create a button, that will call the toggleMenu function inside the respective controller class.
    it will look something like this:
    [Button addTarget:ViewAController action:@selector(toggleMenu:) forControlEvents:UIControlEventTouchUpInside];
    so the flow is really button (in view)-> toggleMenu(viewController) -> toggleMenu(rootController)
    i'm sorry it sounds pretty hazy, i did this part weeks before and can't really remember. i hope it helps.

Maybe you are looking for

  • Can't zoom on video mode on the iPad mini running IOS 7

    Hi! i was playing with my iPad mini's camera app because of boredom, and i notice that if you switch to video on the default camera app there is no zoom... the virtual zoom? doesn't work, but on beta phase it was working fine... but now i'm running t

  • UPDATE_INSERT Error

    Hi Experts, Need urgent help. Right now i am using UPDATE_INSERT for my Receiver JDBC Adapter. But i am getting error in communication channel monitoring that : *ORA-00933: SQL command not properly ended * and in oracle if i am trying to run the belo

  • Drop outs every few hours

    Hi all hope someone can help as i am coming to the end of my tether with my BT Faster Broadband connection it drops out every few hours and has done for almost 2 months.  i cant watch a movie or play a game without losing connection at least once, ma

  • I keep getting an error message when i try to send emails.

    I just got the palm treo 650 on alltel.  didn't realize it was going to be so involved. lol  I got email set up but keep getting an error message when i try to send.  the message is 530 5.7.0 must issue a STARTTLS command first.  What does that mean

  • Missing the edit and refresh at my contacts

    i had missing the edit logo + and logo refresh icon of the contacts list. how can i reset it back it back the icon.