Problems quicksorting my linkedlist (extention from other thread)

Ok so now that I've got my concepts down I went to do a sort method and I'm having problems with my sort method. (the previous thread with my actual class is http://forum.java.sun.com/thread.jspa?messageID=10222048)
Here is the sort method. Can anyone help me figure out what I'm doing wrong? (for reference..I'm getting a NullPointerException somewhere)
public WordList sort()
          Node pivotNode=head;
          remove(head.data);
          WordList small = new WordList(br);
          WordList big = new WordList(br);
          Node first = head;
          while(first!=null)
               if(first.data.compareTo(pivotNode.data)<0)
                    small.add(first.data);
               else
                    big.add(first.data);
               first=first.next;
          big.addToFront(pivotNode.data);
          small = small.sort();
          big = big.sort();
          while(big.head!=null)
               small.add(big.head.data);
               big.head=big.head.next;
          return small;
     }

remove(head.data);
Node first = head;
if(first.data.compareTo(pivotNode.data)<0)Looking at those statements in order, I see the possiblity for a problem with null.
Wouldn't first.data be null?
Edited by: Newworld20 on Apr 24, 2008 3:42 PM

Similar Messages

  • Problems With PrE 8 - Split From Other Thread

    GEAtkins (Glenn) posted some info on his system into another THREAD. He posted a lot of good information on his system and also on some diagnostics, that I asked for. For anyone, who wants to see his info and a complete statement of his problems, please see the link above. It's a well-detailed post, and he's been quick to furnish the requested data. It's being reviewed now, but would also like for others to review it too, as there might be additional ideas.
    I do not want to pollute that other thread with work on Glenn's issue, or drag it on a tangent, so I'd appreciate that anybody with input on Glenn's problems post to this thread. I will be doing so, as soon as the review of the diagnostics is done. I also did not want to re-post all info provided here, so please just link and read.
    I hope that this will be beneficial to Glenn and not interfere with another thread requesting reports on how PrE 8 runs on others' systems.
    Thanks,
    Hunt

    Glenn, it appears that you have 3x HDD's, 1x = 250GB, 2x = 350GB. Are these 3x physical HDD's, and not partitions?
    How are these HDD's allocated? I see that D:\ is nearly full. How is this drive, especially, used?
    I hope that you do not mind my calling in an expert on this, but I knew that Harm would find more things, than I would. First, his eyesight is better than mine, and he's also smarter! [plus most people say he's also better looking, than I am.]
    To distill my recs., and I think most of Harm's:
    Look into static Virtual Memory management in Windows. Up the size of the Page File. Around 2 - 2.5x installed RAM works well for NLE work.
    There are some Processes that can probably removed from Startup. iTunes Helper is one of those. When doing an editing session, I strongly recommend not having any on-line presence, and then freeing up resources, for that session, by turning OFF some of your security functions. Then, using a Process manager, like EndItAll, to eliminate those Processes, that are not needed. Even on my workstation, for all but the most simple edits, I do this routinely. It is easy, and one can come back and turn those on manually, or just re-boot, and they'll all be loaded.
    Also, please let me know about your I/O sub-system, i.e. your HDD's. The main questions are above.
    Harm and I are pretty much in agreement that there should not be any conflicts with your NLE and audio-editing programs. I have most on my workstation, plus many more audio-editing programs (just not Sony). I have no issues doing so. I believe that all were installed after PrPro, and I've seen no priority issues with any CODEC, or modules. All runs fine, so I do not think that there would be a conflict there. I have observed that Adobe, CyberLink and Magix all seem to play very well together, at least in my installation.
    Good luck,
    Hunt
    PS - Harm, thank you so much for your time and your report. I know that your efforts will help Glenn, and I appreciate your input, as always. Thanks! The next bottle of Montrachet is on my tab, OK?
    [Edit] One last question: regarding the SearchIndexer, do you have Windows' Indexing turned on for your HDD's? That program can not only rob resources, but will "lock" your Folders, while it tries to do its thing. It can be useful for .DOC, .TXT, etc. files, but for AV files, and especially the large working files that any NLE generates, it cannot extract any useful info, yet it will try, and try. Every time that a file is changed, like your PREL file, or those working files, it'll run in and "lock" that file, while it tries to extract info from it - every time. It can be turned OFF in your My Computer>[Drive Letter]>Properties panel. In XP, one can determine it's indexing by folders, so one could leave it ON for say your .DOC folder. I do not know how finely you can tune it in Vista, or Win7. I keep it OFF for all HDD's, and a Search is not much slower. Remember, it cannot extract useful data from the AV, or working files, no matter how many times it tries, so all it's doing is hogging resources and "locking" files, that your NLE needs and changes all the time.
    Message was edited by: the_wine_snob - Added [Edit]

  • Hi all, i can't sync over wifi between my iPhone 4 and Windows 7 64 bit, wifi sync works with the same phone and my Windows 8 machine, tried solutions from other threads with no luck, just thought i'd see if anyone else had any ideas, thanks.

    Hi all, i can't sync over wifi between my iPhone 4 and Windows 7 64 bit, wifi sync works with the same phone and my Windows 8 machine so the problem seems confined to Windows 7. I've tried solutions from other threads -
    Making sure everything is allowed through firewall
    Rebooting phone/laptop/router
    Disabling ipv6
    Disabling all networks except the one curently on
    Re-installing iTunes
    Restoring iPhone
    No luck with any of those unfortunately so i just thought i'd see if anyone else is still without wifi sync after trying those as well and if you ever found a fix, thanks.

    I just wanted to leave a note that it's working now. I'm not sure if it was the latest iTunes update that got it working or that i decided to start a new library instead of using the one i had backed up on Windows 8 (it didn't occur to me to check using the old library when i re-installed iTunes). But if anyone is having this problem, it might be worth trying again with a new installation of iTunes to see if the latest update works for you, and if not, try using a fresh library instead of a backup (by fresh library i mean discard your old library completely and start a new library, not just restore as new iPhone, a whole new library).

  • Problem with headerline in OO   again     -  other thread was locked  -

    Problem with headerline in OO  
    Hello,
    I've the problem that I cannot give values from an inertnal table to
    an variable because the itab has no headerline, because in oo it is not possible.
    Here the coding:
    structure in se11 ZACTIVITYIF with components:
    DESCRIPT
    CATEGORY
    PRIORITY
    OBJECT
    DATE_FRO
    DATE_TO
    TIME_FRO
    TIME_TO
    CONT_NO
    LANGTEXT
    STATUS
    OO-Coding:
    DATA: lt_itab TYPE TABLE OF zactivityif.
    DATA: itab TYPE zactivityif.
    Loop at dbtab
    itab-status = '005'.
    APPEND itab TO lt_itab
    endloop.
    set variable for bapi
    lss_text-tdline = lt_itab-langtext. <= here I get error: no tablerwith headerline
    How can I fill an internal table in OO or how can I fill this variable lss_text-tdline ?
    Any ideas ?
    LANGTEXT is type TLINE
    I calling bapi for creating an activity
    Sorry for this double thread -the other was locked however.
    Thanks G

    The other one was locked because handling internal tables without header lines is extremely basic .
    Read the documentation, search the forum search the web.
    Or if your question is not as basic as it seems, post a new one with a better explanation.
    Locked again
    Rob

  • Win32 SetCursor from other thread (Wait Cursor)

    As soon as my application starts to decode a bitmap, i need to update two static text labels to show current progress. Updating them for every decoded pixel would be too overkill so I decided to make every update inside a timer every 150ms.
    This obviously implies the use of a worker thread that leaves the main UI thread able to process WM_TIMER messages thus updating these two textlabels, and invalidate the possibility of just surrounding my work code in two SetCursor functions.
    I googled a bit and found that handling WM_SETCURSOR could do the trick, and so I tested it this way :
    case WM_SETCURSOR:
    if (DecodingThreadRunning) SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_WAIT)));
    else SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
    break;
    Somehow the call gets executed with no errors but the cursor remain the same.
    I also tried to surrond the working thread with the AttachThreadInput function but still no luck :
    HWND hWnd = GetForegroundWindow();
    DWORD foregroundThreadID = GetWindowThreadProcessId(hWnd, 0);
    DWORD currentThreadID = GetCurrentThreadId();
    AttachThreadInput(foregroundThreadID, currentThreadID, TRUE);
    SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_WAIT)));
    //Do the work
    AttachThreadInput(foregroundThreadID, currentThreadID, FALSE);
    Honestly I feel lost since i'm not even sure that the IDC_WAIT cursor was supposed to be used in this case, since the main GUI remains actually usable and stable (although few option gets disabled)
    Thanks in advance for any help
    PS: Running an update every nth pixel would not be as stable and fancy looking as the more accurate update of a timer
    PPS: That's it I'm a retard.    I forgot to return TRUE from WM_SETCURSOR.
    I'll change the core of the question then : is the wait cursor supposed to be used in this case ? why attachthreadinput does not work ? Does it needs the thread to have a message queue ?

    Somehow the call gets executed with no errors but the cursor remain the same.
    Set a breakpointer to check if SetCursor method is reached.
    if (DecodingThreadRunning)
    And how do you determine your thread is running? Do you use WaitForSingleObject method? We need some more information to reproduce this issue.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Problem creating a PDF file from other PDF files

    Normally, the process works, but sometimes produces the following error (in Spanish):
    El documento no se pudo archivar. Problema al leer el documento (110)
    Does anyone know the origin of the error? We have reviewed the security of files and is correct
    Thanks

    I am not sure, but it may be a font mismatch between the files. Fonts is one of the issues that often crops up as a problem when combining PDFs.

  • Problem with loading a project from other system

    Hi!
    I am tring to load a project that being done on logic with audiowerk card on other computer. I can open the project but when I am choosing a channel and changing the sound-card name to my card (core audio) I can hear the sund but all the plug-ins/instruments disapear allthough i got the plug-ins and most of them are logic built in plug-ins.
    What should I need to do in order to keep the plug ins and still be able to play the project from my sound card.
    I have logic 7.1,Mac g5 and M-box.
    Thanks,
    Eshy.

    You should have chosen the other option when first launcing it
    Convert to CA=yes
    Usually this dialogue comes up, sounds like you brought it from an OS 9 system. The Logic plugs should follow through and the VSTs, well, you're kinda stuck there. Ask your client/friend to send the presets for 3rd party VSTs if you have them as AUs. Session interchange between your 2 platforms is not very rewarding, so do it as little as possible.

  • Problem with report with filter from other query

    Hi All,
    I have some report with two queries:
    1. First contain Date(1) converted to int (like 20140807). This query calculate Date as getdate minus number of day which I could define (for example -8 return getdate minus 8 days).
    2. The second contain also Date(2) converted to int. I would like to add filter where Date(2) will be on the list from results in query 1. When I try do this I receive:
    Database error: [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.. (IES 10901) (WIS 10901)
    When I have changed number of days from -8 to -30 in query 1, query 2 return some records.
    I do not know why it work sometimes, sometimes not.

    Sathish, but I use defined by me objects (today number + days) and (today number) in BO so I do not want to change it manually.
    Arijit, the second query without any filters return records with Date(2) equal 20140715. When I add filter with Date(2) = returned data from query 1 (getdate minus 8 days) I receive error. I know that getdate minus 8 days return dates (20140807...20140801) so 20140715 is out of the range. In this case query should return blank page.
    When I change query 1 from 8 to 30 days is working correctly because 20140715 is in this range. Maybe it help to help me
    This is condition from query1:
    WHERE
      dbo_Date.DateID(1)  BETWEEN  year( ( cast(convert(varchar, dateadd(day,@Prompt('Enter the number of X days',  'N',,Mono,Free, Persistent),getdate()) , 102) as datetime) ) )*10000 + month(( cast(convert(varchar, dateadd(day,@Prompt('Enter the number of X days',  'N',,Mono,Free, Persistent),getdate()) , 102) as datetime) ))*100 + day( ( cast(convert(varchar, dateadd(day,@Prompt('Enter the number of X days',  'N',,Mono,Free, Persistent),getdate()) , 102) as datetime) ) )  AND  year( getdate() )*10000 + month(getdate())*100 + day( getdate() )
    but I use the same condition in other reports and it is work.

  • PB 1.67 HiRes - chimes, won't boot. Tried suggestions in other threads.

    sorry -- I hate cross-posting but i'm not getting many hits in the "Using..." forum.
    I've tried everything I can find here and elsewhere to get it to boot.
    The powerbook chimes and the screen stays black. - No beeping as you would expect with memory problems. HD and optical drives make less sound than they should, for a minute or so. and then it's only fans whirring, it's dead quiet in there.
    I've disconnected the optical drive and the PRAM battery, which I suspect was dead anyway. I learned from other threads that PowerBooks do not need a PRAM battery to boot, but a dead PRAM battery can keep your mac from booting. The replacement battery is very expensive so I've just pulled it for now.
    With optical drive disconnected, the HD only whirs faintly for 20 seconds but does not seem to be loading the boot sequence.
    I've tried replacing the HD with a fresh HD, containing a cloned backup of a PB system (same model) - thought at least that would boot. Did not.
    I've tried unseating the RAM and reseating it, and I've tried putting RAM in ONLY the upper or ONLY the lower slot. Still no boot, and no beep either.
    I've reset the PMU. I've tried PRAM reset (before removing that), and OF reset, and many other key combinations at startup chime. None had any noticeable effect.
    When optical drive was connected, it whirred indecisively but did not spin up.
    I discovered a DVD stuck in the drive, which I have removed by disassembling the drive, but when reconnected, the drive whirred exactly as before.
    I've also DiskWarriored the original HD and it's in good shape, with the directory rebuilt.
    Thanks in advance if any of ye troubleshooters have any advice.

    The powerbook chimes and the screen stays black.
    Have you hooked up an external screen to see if it's a display issue? If you look really carefully, can you see anything faintly on the Powerbook screen?
    I've tried replacing the HD with a fresh HD, containing a cloned backup of a PB system (same model) - thought at least that would boot. Did not.
    Have you tried booting to an OS X disk in the DVD drive by holding the C key down?
    Have you tried a safe boot holding the option key down?
    Do you have an external firewire enclosure you can mount the hard drive in, and reboot holding the alt/option key down, then choosing that?
    Have you tried the Apple hardware test, where you insert the first OS X disk that came with your system and reboot holding the alt/option key down, choose AHT, and choose extended test when prompted?
    If the answers to those questions are all fail, then it sounds like your logic board has failed.

  • Problems with RelationalDataSample exceptions thrown from VS2005

    I am not sure which version of the Oracle.DataAccess .Net assy to use. But both of them throw an exception at run time.
    With version 10.2.0.100 I get the following run time error.
    This is the file location of this version - C:\XEClient\bin\Oracle.DataAccess.dll
    As you can see this is the XE client version.
    Error occurred: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception.
    System.TypeInitializationException was unhandled
    Message="The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception."
    Source="Oracle.DataAccess"
    TypeName="Oracle.DataAccess.Client.OracleConnection"
    StackTrace:
    at Oracle.DataAccess.Client.OracleConnection.Dispose(Boolean disposing)
    at System.ComponentModel.Component.Finalize()
    With version 2.111.6.20 I get the following run time error.
    This is the file location of this version - C:\app\john\product\11.1.0\client_1\ODP.NET\bin\2.x\Oracle.DataAccess.dll
    As you can see this is the 11g install.
    System.BadImageFormatException was unhandled
    Message="Could not load file or assembly 'Oracle.DataAccess, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format."
    Source="RelationalDataSample"
    FileName="Oracle.DataAccess, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342"
    FusionLog="=== Pre-bind state information ===\r\nLOG: User = PureVirtual-1\\john\r\nLOG: DisplayName = Oracle.DataAccess, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342\n (Fully-specified)\r\nLOG: Appbase = file:///C:/Users/john/Documents/Visual Studio 2005/Projects/RelationalDataSample/RelationalDataSample/bin/Debug/\r\nLOG: Initial PrivatePath = NULL\r\nCalling assembly : RelationalDataSample, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.\r\n===\r\nLOG: This bind starts in default load context.\r\nLOG: No application configuration file found.\r\nLOG: Using machine configuration file from C:\\Windows\\Microsoft.NET\\Framework64\\v2.0.50727\\config\\machine.config.\r\nLOG: Post-policy reference: Oracle.DataAccess, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342\r\nLOG: Attempting download of new URL file:///C:/Users/john/Documents/Visual Studio 2005/Projects/RelationalDataSample/RelationalDataSample/bin/Debug/Oracle.DataAccess.DLL.\r\nERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.\r\n"
    StackTrace:
    at RelationalDataSample.ConnectionMgr.getDBConnection(String username, String password, String connectString)
    at RelationalDataSample.EmpForm.btnConnect_Click(Object sender, EventArgs e) in C:\Users\john\Documents\Visual Studio 2005\Projects\RelationalDataSample\RelationalDataSample\EmpForm.cs:line 528
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
    at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    at RelationalDataSample.EmpForm.Main() in C:\Users\john\Documents\Visual Studio 2005\Projects\RelationalDataSample\RelationalDataSample\EmpForm.cs:line 509
    at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    Any help with this is greatly appreciated.
    Thank you,
    John

    Hi John,
    Are you still chasing this issue down?
    I have found that one of the causes of the "System.BadImageFormatException" exception results from the following set of circumstances:
    o 32-bit ODP.NET installed on 64-bit o/s
    o .NET application compiled with either "Any CPU" or "x64" set for the "Platform target"
    o The application is then deployed to the 64-bit host with the 32-bit ODP.NET installed
    o The application executes as a 64-bit application but tries to load the 32-bit ODP.NET, thus the exception
    Not sure if this might apply to your situation, but I see "C:\\Windows\\Microsoft.NET\\Framework64" in the text you provided. Since there is not yet a 64-bit release of ODP.NET 11g I wonder if this might be the case.
    For what it's worth, I have not experienced any of the problems you've described in your other threads, but I am using 10.2.0.4 on Intel 64-bit with Win 2003...
    - Mark

  • Updating CniNumEdit from another thread

    I get the following Exception,
    First-chance exception in pmdcsimulator.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
    My call Stack looks as below,
    KERNEL32! 77f1d479()
    MSVCRTD! _CxxThrowException@8 + 57 bytes
    AfxThrowOleDispatchException(unsigned short 0, const char * 0x00433e1c, unsigned int 0) line 1574
    PMDCSIMULATOR! NI::CNiControl::CheckThreadId(void) + 91 bytes
    PMDCSIMULATOR! NI::CNiControl::ValidateControl(void) + 22 bytes
    PMDCSIMULATOR! NI::CNiNumEdit:etValue(double) + 62 bytes
    CPmdcsimulatorDlg::AcquisitionWorkFunction() line 1147
    CPmdcsimulatorDlg::AcqProcessThreadFunction(void * 0x0012f2dc) line 1159
    _AfxThreadEntry(void * 0x0012ec58) line 112 + 13 bytes
    _threadstartex(void * 0x010
    96f80) line 212 + 13 bytes
    KERNEL32! 77f04ede()
    How do I update the control..?

    The UI control classes in Measurement Studio 1.0.1 do not support access from other threads. The next release of Measruement Studio will remedy this problem. Until then, there is an example program that shows how you can use a user message to work around this here: http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&24C350515009D6A1862569AC0073ACC6&cat=61B119A9F74ADC07862568C50070CE22
    Best Regards,
    Chris Matthews
    Measurement Studio Support Manager

  • Problem calling two perl modules from java in seperate threads(JVM CRASHES)

    Dear Friends,
    I have one severe problem regarding calling perl modules from java
    I had to call two perl modules simultaneously (i.e.) from two threads,,, but jvm crashes when one of the perl calls is exiting earlier
    I am unable to spot out why ....
    For calling perl from java ...., We are first calling C code from java using JNI and then Perl code from C
    All works fine if we call only one perl call at a time.... If we call them in a synchronized manner the JVM is not crashing .... But we don't want blocking..
    The following is the code snippet
    <JAVA FILE>
    class Sample
         static {
              System.loadLibrary("xyz");  // Here xyz is the library file generated by compiling c code
         public native void call_PrintList();
         public native void call_PrintListNew();
         Sample()
              new Thread1(this).start();     
         public static void main(String args[])
              System.out.println("In the main Method");
              new Sample().call_PrintList();
         class Thread1 extends Thread
              Sample sample;
              Thread1(Sample sam)
                   sample=sam;
              public void run()
                   sample.call_PrintListNew();     
    }<C FILE>
    #include <EXTERN.h>
    #include <perl.h>
    static PerlInterpreter *my_perl;
    static char * words[] = {"alpha", "beta", "gamma", "delta", NULL } ;
    static void
    call_PrintList(){
         printf("\nIn the Call method of string.c\n");
            char *wor[] = {"hello", "sudha", NULL } ;
               char *my_argv[] = { "", "string.pl" };
               PERL_SYS_INIT3(&argc,&argv,&env);
               my_perl = perl_alloc();
                   PL_perl_destruct_level = 1; //// We have mentioned this also and tried removing destruct call
               perl_construct( my_perl );
               perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
              PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
               perl_run(my_perl);
         dSP ;
            perl_call_argv("PrintList",  G_DISCARD, wor) ;
    PL_perl_destruct_level = 1;
    //     perl_destruct(my_perl);
    //          perl_free(my_perl);
    //           PERL_SYS_TERM();
    static void
    call_PrintListNew(){
    printf("In the new call method\n");
    char *wor[] = {"Hiiiiiiiiiiiiiii", "Satyam123333", NULL } ;
            char *my_argv[] = { "", "string.pl" };
            PERL_SYS_INIT3(&argc,&argv,&env);
            my_perl = perl_alloc();
    PL_perl_destruct_level = 1;
            perl_construct( my_perl );
            perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
            PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
            perl_run(my_perl);
            dSP ;
            perl_call_argv("PrintListNew",  G_DISCARD, wor) ;
    PL_perl_destruct_level = 1;
      //      perl_destruct(my_perl);
      //      perl_free(my_perl);
       //     PERL_SYS_TERM();
    void callNew()
    call_PrintListNew();
    void call ( )
    call_PrintList();
    //char *wor[] = {"hello","sudha",NULL};
    /*   char *my_argv[] = { "", "string.pl" };
          PERL_SYS_INIT3(&argc,&argv,&env);
          my_perl = perl_alloc();
          perl_construct( my_perl );
          perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
         PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
          perl_run(my_perl);*/
       //   call_PrintList();                      /*** Compute 3 ** 4 ***/
    /*      perl_destruct(my_perl);
          perl_free(my_perl);
          PERL_SYS_TERM();*/
        }And Finally the perl code
    sub PrintList
                my(@list) = @_ ;
                foreach (@list) { print "$_\n" }
    sub PrintListNew
                my(@list) = @_ ;
                foreach (@list) { print "$_\n" }
            }Please help me in this regard

    Dear Friends,
    I have one severe problem regarding calling perl modules from java
    I had to call two perl modules simultaneously (i.e.) from two threads,,, but jvm crashes when one of the perl calls is exiting earlier
    I am unable to spot out why ....
    For calling perl from java ...., We are first calling C code from java using JNI and then Perl code from C
    All works fine if we call only one perl call at a time.... If we call them in a synchronized manner the JVM is not crashing .... But we don't want blocking..
    The following is the code snippet
    <JAVA FILE>
    class Sample
         static {
              System.loadLibrary("xyz");  // Here xyz is the library file generated by compiling c code
         public native void call_PrintList();
         public native void call_PrintListNew();
         Sample()
              new Thread1(this).start();     
         public static void main(String args[])
              System.out.println("In the main Method");
              new Sample().call_PrintList();
         class Thread1 extends Thread
              Sample sample;
              Thread1(Sample sam)
                   sample=sam;
              public void run()
                   sample.call_PrintListNew();     
    }<C FILE>
    #include <EXTERN.h>
    #include <perl.h>
    static PerlInterpreter *my_perl;
    static char * words[] = {"alpha", "beta", "gamma", "delta", NULL } ;
    static void
    call_PrintList(){
         printf("\nIn the Call method of string.c\n");
            char *wor[] = {"hello", "sudha", NULL } ;
               char *my_argv[] = { "", "string.pl" };
               PERL_SYS_INIT3(&argc,&argv,&env);
               my_perl = perl_alloc();
                   PL_perl_destruct_level = 1; //// We have mentioned this also and tried removing destruct call
               perl_construct( my_perl );
               perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
              PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
               perl_run(my_perl);
         dSP ;
            perl_call_argv("PrintList",  G_DISCARD, wor) ;
    PL_perl_destruct_level = 1;
    //     perl_destruct(my_perl);
    //          perl_free(my_perl);
    //           PERL_SYS_TERM();
    static void
    call_PrintListNew(){
    printf("In the new call method\n");
    char *wor[] = {"Hiiiiiiiiiiiiiii", "Satyam123333", NULL } ;
            char *my_argv[] = { "", "string.pl" };
            PERL_SYS_INIT3(&argc,&argv,&env);
            my_perl = perl_alloc();
    PL_perl_destruct_level = 1;
            perl_construct( my_perl );
            perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
            PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
            perl_run(my_perl);
            dSP ;
            perl_call_argv("PrintListNew",  G_DISCARD, wor) ;
    PL_perl_destruct_level = 1;
      //      perl_destruct(my_perl);
      //      perl_free(my_perl);
       //     PERL_SYS_TERM();
    void callNew()
    call_PrintListNew();
    void call ( )
    call_PrintList();
    //char *wor[] = {"hello","sudha",NULL};
    /*   char *my_argv[] = { "", "string.pl" };
          PERL_SYS_INIT3(&argc,&argv,&env);
          my_perl = perl_alloc();
          perl_construct( my_perl );
          perl_parse(my_perl, NULL, 2, my_argv, (char**)NULL);
         PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
          perl_run(my_perl);*/
       //   call_PrintList();                      /*** Compute 3 ** 4 ***/
    /*      perl_destruct(my_perl);
          perl_free(my_perl);
          PERL_SYS_TERM();*/
        }And Finally the perl code
    sub PrintList
                my(@list) = @_ ;
                foreach (@list) { print "$_\n" }
    sub PrintListNew
                my(@list) = @_ ;
                foreach (@list) { print "$_\n" }
            }Please help me in this regard

  • Anybody having problems in Mail when sending reply messages from a thread and the message is not showing in the Sent mailbox?

    Hello Folks;
    Got a weird one...
    I am sending replies from a thread in Mail and they seem to have been sent (sounds) but they don't show in the Sent mailbox... O-0 These messages seem to have been delivered to cyberspace as they don't show in my Sent mailbox on my IMAP server... This has been happening for the last month... I have checked and verified all of my IMAP settings and Mailbox behavior settings... This is really weird and maybe a bug.... I checked all of my other clients that have access to the server on the same account and these messages do not show there either.... Any ideas?
    --prd54usa

    The messages are getting to the recipient...
    I am on a Comcast IMAP server if this has anything to do with it and the server settings are following the correct server port numbers, SSL settings, etc... I save Sent messages on the IMAP server for 90 days.... None of these "disappearing" messages were on the server for more than a couple of days.. Typically, these messages will get 'hung' in the Outgoing Mailbox for @30 seconds before sending... like they are being scanned for viruses or Mail can't connect to the server all of a sudden...
    I anybody else here is on a Comcast IMAP server, and having this problem of disappearing Sent messages... This would tell us that it might be a Mail Provider issue with their outgoing server...
    --prd54usa

  • Problem update JTextArea with message from thread

    I have a JTextArea to present the actually status of an running thread. The thread sends strings like: System.out.println("Reading in new message...");to the standardoutput.
    The problem is, that my application freezes when it should update the JTextArea. Any idea and what type of actionListener is recommend to use for the JTextArea?
    try
       BufferedReader breader = new BufferedReader(new InputStreamReader(System.in));
       statusmsg = breader.readLine();
       statusTextArea.append(statusmsg);
    catch (Exception e){};Cheers

    In general, you can't update the Swing stuff from "side" threads. Side threads talk with the Swing event thread by creating Runnable objects which contains the necessary data (in your case, for instance, the JTextArea or its parent panel/window, and the text to append), and then invoking SwingUtilities.invokeLater() to have this object run() method called by the Sing event thread. See:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html

  • Problem doing stuff from a thread

    Hey ja'll,
    Hope you all can take time away from kayman's thread to hook my up with some help on this one...
    I am pulling data off of a series of databases. I start a thread for each database i pull from. Each thread calls my Database class which loads the correct driver and returns the connection.
    My problems occurs when one of the databases is down. Its seems to get hung on
    DriverManager.getConnection
    (which i am doing in my database class)
    until it figures out that it is not going to get a connection. All the the other threads DO NOT go on thier merry way, they wait for the retard database to error and return untill they try to get connections to thier databases.
    Is their any way that I can make them not wait?

    Each thread calls my Database class...A static method, right? And is it synchronized? If so, then that's your problem right there. But if it isn't synchronized, then perhaps it's calling something that is.

Maybe you are looking for

  • Can I store photos in Photoshop Elements Editor?

    I have OSX Lion 10.7.  Before spending $80 on Photoshop Elements 10 Editor from the  Apple App Store, I have a couple of questions...      1.  Can I download photos from my camera directly to Photoshop Elements, or must thry go to iPhoto first?     

  • Bypass an Open Item from being selected

    Hi there, I have a "Z" FBL5N t-code to selection of Customer Open Items. The Open Items that were selected must be blocked to avoid selection (and editing) by another user and besides that, cannot appear in any search until being unblocked in future

  • Cannot open PDF files in AIR app on Mac OS

    Hello, I am having trouble opening a PDF file in adobe air application on Mac OS. I already installed adobe reader 11 and air on mac. I also traced HTMLLoader.pdfCapatibility, which returns 3204 (An error was returned by the OS when trying to load th

  • ATI HD2600 MacPro DVI problem with HP LP2275w monitors !!

    booting up from 10.5.1 all was OK... after updating OSX my 2 HP LP2275w monitors stay dark. it seems the DVI signal isnt present to switch ON the screens. after some freaking with input selection from the OSD of the HP LP2275w monitor image appears :

  • Offline or Online Backup after switching off and on the archving mode

    Hello guys, I am doing an SAP (on Oracle) upgrade. In the upgrade guide there are two completely different statements about making a backup of the Oracle database during upgrade. 1st statement: "If you deactivate archiving, you have to make a full ba