A Programming Problem I am stuck on

Hello,
I am trying to solve the following problem:
Given a deck of nCards unique cards, cut the deck iCut cards from top and perform a perfect shuffle. A perfect shuffle begins by putting down the bottom card from the top portion of the deck followed by the bottom card from the bottom portion of the deck followed by the next card from the top portion, etc., alternating cards until one portion is used up. The remaining cards go on top. The problem is to find the number of perfect shuffles required to return the deck to its original order. Your function should be declared as:
static long shuffles(int nCards,int iCut);
find the solution of shuffles(1002,101)
So my code, which is pasted below, is a brute force method of solving the problem in that I am passing the entire array symbolizing a unique deck, to a shuffles function then using for loops to shuffle the deck and pass back the array and use for loops again to check if it matches the original deck. My code works for smaller cases but the (1002,101) case, is taking way too long and there is a solution that can solve the problem within a few minutes, I just need to figure it out.
I am thinking rather than passing the entire array, perhaps i need to pass by reference to my shuffles function and use pointers to manipulate just one array and then use a for loop to check it. However, I am also trying to think of other reasons my code is too slow.
Any help is really appreciated.
srahan.
-------------------------My Code in Java----------------------------
import java.awt.*;
import java.awt.event.*;
import java.io.*;
//import java.util.Arrays;
public class Shuffles
public static int ncards;
public static int icut;
public static long counter;
public static void main (String[] args)
long total=0;
ncards = 102;
icut = 11;
counter = 0;
//arrays for original card decks this stays the same order
int[] deck = new int[ncards];
int[] deck2 = new int[ncards];
int[] ogdeck = new int[ncards];
//create original card deck with unique cards, assume 0 is bottom of deck
//and create initial shuffled deck instance
for (int i=0; i<ncards; i++)
ogdeck[i] = i;
deck[i] = i;
System.out.println("ncards: " + ncards);
System.out.println("icut: " + icut);
boolean equal=false;
do
deck2 = shuffledeck(deck);
//equal = Arrays.equals(deck2, ogdeck);
/* System.out.println("");
System.out.println("ogdeck"); //print out original deck used for testing
for (int i=0; i<ncards; i++)
System.out.println(ogdeck);
System.out.println("");
System.out.println("deck2"); //print out shuffled deck used for testing
for (int i=0; i<ncards; i++)
System.out.println(deck2[i]);
for (int i=0; i < ncards; i++)
if (ogdeck[i]==deck2[i])
equal = true;
else
equal = false;
break;
while (equal==false);
if (equal == true)
System.out.println("");
System.out.println("It took " + counter + " perfect shuffles to return the deck to its orginal order");
//shuffle function
public static int[] shuffledeck (int[] decktoshuffle)
int[] tophalf = new int[ncards];
int[] bottomhalf = new int[ncards];
int temp=0;
int place=0;
//cut passed deck into two halfs
for (int i=0; i < (ncards-icut); i++)
bottomhalf[i] = decktoshuffle[i];
for (int i=(ncards-icut); i < ncards; i++)
tophalf[temp] = decktoshuffle[i];
temp++;
//create new deck by shuffling
//if the bottom half has LESS cards than top half
if ((ncards-icut) <= icut)
for (int i=0; i<(ncards-icut); i++)
decktoshuffle[place]=tophalf[i];
decktoshuffle[place+1]=bottomhalf[i];
place=place+2;
//place remaining cards from TOP half on top of new deck
for (int j=(ncards-icut); j<icut; j++)
decktoshuffle[place] = tophalf[j];
place++;
//if the top half has LESS cards than bottom half
if ((ncards-icut) > icut)
for (int i=0; i<(icut); i++)
decktoshuffle[place]=tophalf[i];
decktoshuffle[place+1]=bottomhalf[i];
place=place+2;
//place remaining cards from TOP half on top of new deck
for (int j=(icut); j<(ncards-icut); j++)
decktoshuffle[place] = bottomhalf[j];
place++;
counter++;
return decktoshuffle;

so i consolidated the two functions into one main function but its still too slow....any help would be appreciated.
import java.awt.*;
import java.awt.event.*;
import java.io.*;
//import java.util.Arrays;
public class Class1
     public static int ncards;
     public static int icut;
     public static long counter;
     public static void main (String[] args)
          long total=0;     
          ncards = 1002;
          icut = 101;
          counter = 0;
          int[] shuffdeck = new int[ncards];
          int[] currdeck = new int[ncards];
          int[] deckpointer = new int[ncards];
          int[] ogdeck = new int[ncards];
          //create original card deck with unique cards, assume 0 is bottom of deck
          //and create initial shuffled deck instance
          for (int i=0; i<ncards; i++)
               currdeck[i] = i;
               ogdeck[i] = i;
          System.out.println("ncards: " + ncards);
          System.out.println("icut: " + icut);
          boolean equal=false;
          int i;
          int j;
          int k;
          do
               //i counts through top portion (of nCut cards)
               //j counts through bottom portion (of nCards-nCut cards)
               //k counts through new shuffle deck
               //You can keep track of whether its back to normal during this process to save on time.
               //We start with a deck with 0 on bottom and nCards-1 on top.
               equal=true;
               for(i=(ncards-icut), j=0, k=0; i<ncards && j<(ncards-icut); i++, j++, k+=2)
                    //Take from bottom of Cut
                    shuffdeck[k] = currdeck;
                    //Take from bottom of other half
                    shuffdeck[k+1] = currdeck[j];
                    if ( shuffdeck[k] != k )
                         equal = false;
               //Add remaining cards to deck ( only one of two loops will be entered )
               while ( k < ncards )
                    shuffdeck[k] = currdeck[j];
                    if ( shuffdeck[k] != k )
                         equal = false;
                    j++;
                    k++;
               deckpointer = currdeck;
               currdeck = shuffdeck;
               shuffdeck = deckpointer;                         
               counter++;
               while (equal==false);
          if (equal == true)
               System.out.println("");
               System.out.println("It took " + counter + " perfect shuffles to return the deck to its orginal order");

Similar Messages

  • When I exit firefox it closes the program but it gets stuck in memory so when I open it again i have to kill the process in task manager

    When I exit firefox it closes the program but it gets stuck in memory so when I open it again i have to kill the process in task manager, and it can be right away or I can come back a few hours later and its still stuck in task manager, I am tired of having to kill the processes every time I use firefox.
    == This happened ==
    Every time Firefox opened
    == a week or so a go ==
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; AntivirXP08; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

    Hanging at exit is most often caused by an Extension or a Plugin.
    <u>'''Kill Application'''</u>
    In Task Manager, does firefox.exe show in the <u>'''Processes'''</u> tab?
    See: [http://kb.mozillazine.org/Kill_application Kill Application]
    '''<u>Causes and solutions for Firefox hanging at exit:</u>'''
    [[Firefox hangs]]
    [http://kb.mozillazine.org/Firefox_hangs#Hang_at_exit Firefox hangs at exit]
    [[Firefox is already running but is not responding]]
    <u>'''Safe Mode'''</u>
    You may need to use '''[[Safe Mode]]''' (click on "Safe Mode" and read) to localize the problem. Firefox Safe Mode is a diagnostic mode that disables Extensions and some other features of Firefox. If you are using a theme, switch to the DEFAULT theme: Tools > Add-ons > Themes <u>'''before'''</u> starting Safe Mode. When entering Safe Mode, do not check any items on the entry window, just click "Continue in Safe Mode". Test to see if the problem you are experiencing is corrected.
    See:
    '''[[Troubleshooting extensions and themes]]'''
    '''[[Troubleshooting plugins]]'''
    '''[[Basic Troubleshooting]]'''
    If the problem does not occur in Safe-mode then disable all of your Extensions and Plug-ins and then try to find which is causing it by enabling <u>'''one at a time'''</u> until the problem reappears. <u>'''You MUST close and restart Firefox after EACH change'''</u> via File > Restart Firefox (on Mac: Firefox > Quit). You can use "Disable all add-ons" on the Safe mode start window.

  • Java Programming Problem

    Hi all,
    I was looking for this java programming problem which had to do with a large building and there was some gallons of water involved in it too somehow and we had to figure out the height of the buiding using java. This problem is also in one of the java books and I really need to find out all details about this problem and the solution. NEED HELP!!
    Thanks
    mac

    Yes, it will. The water will drain from the bottom of
    the tank until the pressure from the water inside the
    tank equals the pressure from the pipe. In other
    words, without a pump, the water will drain out until
    there is the same amount of water in the tank as in
    the pipe The water pressure depends on the depth of the water, not the volume. So once the depth of the water inside the pipe reaches the same depth as the water inside the tank it will stop flowing. This will never be above the height of the tank.
    I found this applet which demonstrates our problem. If you run it you can drag the guy up to the top, when water in his hose reaches the level of the water in the tank it will stop flowing out.

  • Problem with a stuck yellow process chain

    Hi all,
    I have a problem with a stuck yellow process chain.
    A Meta chain calling a sub chain. The sub chain loads some master data.
    Some months ago one process stopped in yellow, no processes still running.
    So after that day when the meta chain runs the error msg is as follows
    Diagnosis                                                                               
    The previous run of the current subchain, BW_METADATA_MD_ST , is not yet   
         complete. This leads to communication errors with the metachain called,    
         BW_METADATA_MD .                                                                               
    System response                                                                               
    The current run of the metachain is cancelled.                                                                               
    Procedure                                                                               
    1.  End the previous run of the subchain, or wait until the run is         
             complete.                                                              
             It does not matter whether the run was successfully completed or       
             not.                                                                               
    2.  Restart the metachain.                                                 
    How do I end the previous run of the subchain?
    There is no process running, just want to set the flag to ended.
    Thanks in advance.
    BR
    Lars
    Message was edited by:
            Lars Johnsson

    Hi Lars,
       Have a look this web log : Restarting Processchains
    /people/siegfried.szameitat/blog/2006/02/26/restarting-processchains
    Hope it Helps
    Srini

  • Programming problem

    Subject:
    programming problem
    Date:
    Sun, 10 Mar 2002 19:48:34 +0800
    From:
    LibraryPublicStation <[email protected]>
    Organization:
    Hong Kong University of Science and Technology
    Newsgroups:
    hkust.cs.class.201
    Hi, I have some problems on the following code:
    The code has no compiling error. but
    Why I can't get the RGB value of my image since I can get the width and
    height of the image.
    import java.io.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.Graphics.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.lang.*;
    import java.awt.color.*;
    import com.sun.image.codec.jpeg.*;
    import java.awt.geom.*;
    public class Sun
    public static void main(String args[])
    double[][] database_graph=new double[0][900];
    // put the image in a row with 900 column
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Image image1 = new ImageIcon("imges.jpg").getImage();//load the image to
    image1
    BufferedImage buffer;//Buffer the image to get the RGB value
    buffer = new BufferedImage(image1.getWidth(null),image1.getHeight(null),
    BufferedImage.TYPE_INT_ARGB);
    ColorModel a=buffer.getColorModel();
    System.out.println(a);
    for(int j=0;j<buffer.getWidth();j++)
    for(int k=0;k<buffer.getHeight();k++)
    int rgb=buffer.getRGB(j,k);//get the red,green,blue value of the graph
    int red = ((rgb&0xff0000)>>16);
    int green = ((rgb&0xff00)>>8);
    int blue = rgb&0xff;
    database_graph[0][buffer.getHeight()*j+k] = (red + green + blue)/3;
    System.out.println(database_graph[0][buffer.getHeight()*j+k]+" "+red+"
    "+green+" "+blue);
    } // change back to gray scale

    Try this :
    ImageIcon icon = new ImageIcon("imges.jpg");
    Image image1 = icon.getImage();
    BufferedImage buffer = new BufferedImage(icon.getIconWidth(),icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
    ...But I think, in your problem, you want to get the image in a BuffererdImage ?
    ImageIcon icon = new ImageIcon("imges.jpg");
    BufferedImage buffer= (BufferedImage)icon.getImage();
    ...Denis

  • Coldfusion server problem or programming problem?

    Hello experts,
    I have been experiencing problems when accessing this website using Mac (and Parallels/WinXP).
    http://tinyurl.com/3yh3d8l
    Because there is no problem when using Windows PC, the programmer suggested that it might be a CF server problem, but one of my IT said it's programming issue (basically he said the web programmer is wrong). I have very limited access to PC at work but I need the data from that website. I'd like to give input to the webprogrammer but I don't know what to say. Could you please give me some suggestions? Thank you.

    hi Adam,
    Just tested in Mac, the site works in FireFox. But Safari won't load it at all. Progress bar keep spinning but screen doesn't change.
    So is this something to do with the programming problem or Safari is being picky? I can use FireFox during presentation but I'd like the option to be able to use Safari (iPad?).

  • Cretical programming problem

    dear sirs, i work with forms 6i
    i have programming problem and i want to solve it
    the problem is
    i have table contain the following fields
    AREA_CODE NOT NULL NUMBER(8)
    AREA_NAME NOT NULL VARCHAR2(30)
    EAREA_NAME VARCHAR2(30)
    UP_AREA_CODE NUMBER(8)
    AREA_TYPE NUMBER(1)
    AREA_LEVEL NUMBER(15)
    transfer_fees number(15,3)
    i want to get the value of transfer_fees, depend on the area code which i want, but if transfer_fees is null i should get the other transfer_fees of the up_area_code as the up level of area code, and if also null then get the value of transfer_fees of the up level of area code and so on.
    please help me urgently
    Yasser

    Hi yasser
    it's not precise for me , It needs a lot of details but according to the existing information
    Now we have 3 options
    Option1 : Get the transfer_fees according to AREA_CODE -- i don't know how not clear for me
    Option 2 : IF transfer_fees IS NULL then get it's value from up_area_code (then i am assuming that up_area_code has a value currently during the user input so all we have is to think that we can get it's value from a simple assign statement in WHEN-VALIDATE-ITEM trigger of transfer_fees item as ...
    IF :transfer_fees IS NULL THEN
    :transfer_fees  :=:up_area_code;
    END IF;and so on...
    Hope this helps...
    Regards,
    Amatu Allah

  • OSystem Program Problem Detected Window, asks if I want to report this, then it asks for my Password ? is this ok ?

    I'm new to Ubuntu & Linuz OS. I've started to see a pop-up window that says: System Program Problem Detected- Do you want to report the problem. When I click yes, I'm asked to enter my password to access problem reports of system programs. Should I be asked for my password ???

    I am fairly new to Ubuntu, but that does not sound unexpected. Ubuntu tends to have everyone use a limited account that needs to ask for a password before carrying out operations like installing software.

  • Hi. I've got iPhone 5 64 Gb, and since I upgraded my iOS to iOS 7 I've got some problems as: iPhone stuck, suddenly exiting from  apps and the worst - randomly resting my iPhone... What happen to my phone? How can I fix this soon as possible?

    Hi. I've got iPhone 5 64 Gb, and since I upgraded my iOS to iOS 7 I've got some problems as: iPhone stuck, suddenly exiting from  apps and the worst - randomly resting my iPhone... What happen to my phone? How can I fix this soon as possible?

    basic troubleshooting
    Reset
    Restore with back up
    Rstore as new
    all as required and as described in User guide

  • Unix Darwin program problem stuck in!

    When I turn on my computer it runs in Unix mode and i cannot get out it back to Mac OSX. I have tried typing "reboot" but all it say is "operation not permitted". As far as I can tell the osx software is running fine because it shows it loading from startup but then goes directly to Unix Darwin. I must admit I have no knowledge of how to use this program and can't exit to regular mac. Any help to resolve this problem will be greatly apreciated. Thanks, Matt

    I was starting to have that same problem, among others. The culprit was that there was a capital letter contained in my "Short Name", but I swear I didn't put it there.
    Now, if you could open Disk Utility somehow (perhaps using the OSX boot disk?), you could open System Preferences/Accounts, and you'll either be able to see or create a new account for yourself. Inside the same window pane, on the right, you fill in a name, and the computer should automatically generate a Short Name under that. It is mandatory that the Short Name be all in lower case letters, and it can simply be your first name. Upper case letters used in the Short Name are not permitted in Unix, and your computer will think you're always trying to log into an alternate account that doesn't exist (or something like that). This can result in all kinds of maladies, including the one you're describing. Cog

  • "Show Desktop" bug forces any program windows to be stuck "Always-on-top"

    What I found under Windows 7, when you use the "Show Desktop" feature (I prefer the ⊞ Win + D shortcut) and then bring all windows back by using it again, some windows behave as if they're glued to the front of the z-order. What this means is, say, I have windows
    A B and C open, with focus on A, hit ⊞ Win +D twice, and now it may happen that if I then want to switch to B or C, either by Alt+Tab or by selecting them on the taskbar, the taskbar shows the highlight, but A stays visible (and usable, it's not just a rendering
    issue) in the foreground.
    Imagine the following situations, all three windows cascading and overlapping:
    A (focus)
    B
    C
    -> ⊞ Win + D
    Desktop (focus)
    -> ⊞ Win + D
    A (focus)
    B
    C
    -> click C on taskbar
    A
    C (focus)
    B
    -> click B on taskbar
    A
    B (focus)
    C
    And so on. Focus means actual input focus, i.e. in second situation, any keyboard typing is sent to window B while window A is in the foreground.
    It does not matter what kind of application; in my current case an instance of Outlook and an instance of Explorer is stuck, while a second instance of Explorer and an instance of Firefox behave normally. This should show that this problem can occur even between
    multiple instances of the same application, and that there are no fancy applications involved that like to pretend they are the most important program and internally force "always on top".
    Showing and unshowing the desktop again doesn't help; in the worst case another window might end up with the "glued to the top of the z-order" too. Between those, I can easily switch, but in order to get a window which still behaves normally on top, I have
    to manually minimize the offending windows.
    The only cure seems to close the offending windows so far, I've not found anything else that helps.
    Could it be that Windows 7 has a bug that can force an ALWAYS_ON_TOP flag
    onto some windows when restoring from "Show Desktop", or am I doing something wrong?
    More information from another user:
    I use win+d. Issue easy to replicate, Win7-64bit-Ultimate.
    The affected windows (any program) seem to be placed into a separate "Z" group. You can place multiple/many windows into this always-on-top state, those in the affected state will function normally in relation to each other with the exception that: - The group
    as a whole is always-on-top of any non-affected window - The whole group is on top of the taskbar. - The whole group does not respond to (context on taskbar) "cascade windows" or similar commands.
    The fact that the affected windows are on top of the taskbar and otherwise function as "special windows" shows that windows 7 has a hidden "feature" of always-on-top that gets applied with Win+D. The feature appears to place windows in a super window state
    that is on top of the taskbar. The normal group remaining behind the taskbar. (When you click the start menu or context menu of the taskbar, the start menu/taskbar comes to the foreground of the always-on-top group, however this does not revert the affected
    windows, only a temporary takeover until you switch to something other than the start menu/taskbar)
    This is key to finding an answer. How do we get windows to unassign the special status or not do the assignment in the first place?

    It appeared to have cleared by closing all windows and restarting. Initially I could not reproduce the error, then after opening all my working windows, I did indeed reproduce it on any window.
    I almost think it could be initialized with something to do with multiple windows of Chrome, and then the show desktop problem will crop up once one window has it. This was because: After messing around some more with a chrome session saver (session buddy)
    and restoring sessions and getting the super state, I restored and closed the window I was in and now I am again at a place where I can not reproduce the error, even in my "work environment" with some 35 chrome tabs in two windows, plus other programs, file
    locations, remote desktops and a second chrome profile with another dozen tabs.
    So, back to square one with finding the actual instigator of the super state phenomenon.
    Once you actually have the super sate issue, the following will reproduce:
    Ok, I am doing this as I type it:
    Open chrome (to view this website), then Notepad, then Calculator, (could be any windows, but for the purpose of demonstration, follow along with me)
    The windows should function normally, overlap your windows so that you can see the edge of all windows and the Z-order is (from front to back):the browser on top, then the calculator, then Notepad (you should be able to see part of the background windows).
    Now, with the browser on top, press win+d, then win+d again.
    Click on Calculator, then your browser, your browser is now stuck in the foreground. Clicking on notepad will bring the focus to notepad, and it will be in front of the calculator, yet it will stay behind the browser, as your browser is in "super state". (many
    arrangements of switching focus after returning from win+d will create the problem, with the exeption of clicking the desktop, I also noticed that I could not get calculator into super state unless it overlapped my chrome browser).
    Again, this does not seem to work until at least one of your windows is affected. We do not know how to get the initial window, only subsequent ones.
    I will post back if I find anything else.
    Let me know if there is anything that develops.

  • Employee payroll program problems

    I have done good so far but now im stuck and lost on how to take my program to the next step, kids got sick and i missed like a week of school so im behind. I am suppose to modify the Payroll Program so that it uses a class to store and retrieve the employee?s name, the hourly rate, and the number of hours worked. Use a constructor to initialize the employee information, and a method within that class to calculate the weekly pay. Once stop is entered as the employee name, the application should terminate. I am lost on the bold part..
    here is what I have:
    //Calculates weekly pay for an employee
    import java.util.Scanner; // program uses class Scanner
         public class BeemansPayroll
         private double rate;
         private double hours;
         private String name;
         //Used to save info
    public BeemansPayroll(String Name, double PayRate, double Hours)
         String name = Name;
         double rate = PayRate;
         double hours = Hours;
    private static void Quit()
    System.out.println("Thank You for using Beeman's Payroll");
    System.exit(0);
    // main method begins execution of Java application
    public static void main(String args[])
    // create Scanner to obtain input from command window
    Scanner input = new Scanner(System.in);
    String name = "";
    do {
    System.out.print("Enter Employee Name or stop to quit: ");
    // prompt for name
    name = input.next(); // get name
              if (name.equals("stop"))
    System.out.println("Thank You for using Beeman's Payroll");
    Quit();
    } //end if
    else
    double PayRate;
    double Hours;
    double Pay;
         System.out.print("Please enter Employee payrate:$ "); // prompt
         PayRate = input.nextDouble(); // read first number from user
              while (PayRate <= 0)
                        System.out.println ("Invalid amount, Payrate must be positive");
                        System.out.print("Please enter valid payrate:$ ");
                        PayRate = input.nextDouble();
                   } //end if      
    System.out.print("Please enter Employee hours: "); // prompt
    Hours = input.nextDouble(); // read second number from user
                             while (Hours <= 0)
                        System.out.println ("Invalid amount, Hours must be positive");
                        System.out.print("Please enter hours worked: ");
                        Hours = input.nextDouble();
                   } //end if
    Pay = PayRate * Hours; // multiply numbers
    System.out.printf("Employee Pay for the week %s, is $%.2f\n", name,
    (PayRate * Hours)); // display product
    } //end else
    }while (!name.equals("stop"));
    Quit();
    } // end method main
    } // end class Beeman's Payroll

    john774077 wrote:
    Like I said, I am lost, with all that is going on I have done the reading 4 times , Then try reading a different source such as the Sun Java tutorials. They are excellent and there is no substitute to your reading and learning. We can help you debug an error in your code, but we are not a tutorial service nor a homework production service. Note also that we are all volunteers.
    on top of kids getting sick and taking three algebra all at once. I advice you to not go on and on about this. This is not our problem and won't affect how or if someone helps you. If anything continued mention of this will turn many away who would otherwise help you.
    How or where do I go about breaking it down?You are redeclaring the variables in your constructor, i.e.,:
    String name = Name;  // don't do thisDon't do this because you'll never change the class's name variable this way. Instead in the constructor do something like this for each variable:
    name = Name;or
    this.name = Name;Later you will need to read up on Java naming conventions.
    As for creating the method, you should read up on method creation in your text book or tutorial. That'll give you a better explanation than we can, I think.

  • Forms Service verification program problem

    I have a java verification program that is run from a HPUX server cron job to check
    the status of my 9.0.2.12.2 Oracle 9iAS Forms Services running on a
    Windows 2000 server. The program determines if the Forms Services
    restarted after a cold, off-hours backup by retrieving and reading
    base.htm.
    I have 3 windows servers with "identical" configurations of 9iAS Forms
    Services. The java verification program works when running against the dev and
    test Forms servers but not against the production Forms server. It
    did work against the production Forms server until I upgraded to
    9.0.2.12.2 a few months ago. The only way to reproduce the problem
    against the test Forms server is to rename base.htm so the program
    can't find it. default.env,forms90.conf,formsweb.cfg all appear to be
    identical. Paths and other environmental variables are identical on
    the windows Forms servers. The java program fails or succeeds
    consistently on 3 different HPUX servers both in cron and from the
    command line.
    The error message is: java.io.IOException: Server returned HTTP
    response code: 500 for URL:
    http://productionserver:7778/forms90/f90servlet
    Java is 1.3.1 on all environments.
    import java.io.*;
    import java.net.*;
    public class auRLTest
    public auRLTest()
    try {
    System.out.println("Starting...");
    URL url = new URL("http://productionserver:7778/forms90/f90servlet");
    System.out.println("Opening URL connection ("+url+")");
    URLConnection uc = url.openConnection ();
    System.out.println("Connecting to URL");
    uc.connect();
    System.out.println("Opening input stream.");
    BufferedReader in = new BufferedReader(
    new InputStreamReader( uc.getInputStream() ) );
    System.out.println("Reading file...");
    System.out.println("==========================================================================");
    String inputLine = in.readLine();
    while (inputLine != null)
    System.out.println(inputLine);
    inputLine = in.readLine();
    System.out.println("==========================================================================");
    System.out.println("Closing file.");
    in.close();
    System.out.println("Production Form Server is UP");
    catch( java.net.ConnectException connectException ) {
    System.out.println("***PRODUCTION FORM SERVER IS DOWN***.");
    catch( Exception exception ) {
    System.out.println(exception);
    public static void main(String[] args)
    auRLTest uRLTest = new auRLTest();
    Accessing "http://productionserver:7778/forms90/f90servlet" from IE works fine.
    Any clues or ideas are appreciated.
    Thanks

    I went through the same thing. Look at Appendix II "Case Study" at http://rootshell.be/~yong321/freeware/ckweb.html. Basically, the forms servlet needs some more HTTP headers you didn't pass.
    Yong Huang

  • Trying to open iTunes I got a error message of msvcr80.dll can not be found. I thought that it was an iTunes program problem. I tried reloading iTunes and then got an error message of a program is trying to acces a library file incorrectly. How can I reso

    When trying to open ITunes, I got an error message of msvcr80.dll can not be found.
    Assuming that it was an iTunes file, I reinstalled iTunes.
    Trying to open again, I got an error message of an appication is trying to open a library file incorrectly.
    How do I resolve this problem.
    Neither my PC with Vista nor my my laptop with windows 7 will work?
    Thanks

    Hello Msvcr80.dll,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    iTunes 11.1.4 for Windows: Unable to install or open
    http://support.apple.com/kb/TS5376
    Check for .dll files
    Go to C:\Program Files (x86)\iTunes and C:\Program Files\iTunes and look for .dll files.
    If you find QTMovie.DLL, or any other .dll files, move them to the desktop.
    Reboot your computer.
    Note: Depending on your operating system, you may only have one of the listed paths.
    Uninstall and reinstall iTunes
    Uninstall iTunes and all of its related components.
    Reboot your computer. If you can't uninstall a piece of Apple software, try using the Microsoft Program Install and Uninstall Utility.
    Re-download and reinstall iTunes 11.1.4.
    Best of luck,
    Mario

  • PAYMENT PROGRAM PROBLEM

    When i create a payment proposal today with posting date in the future and the items that have to be paid are in foreign currency the payment run program (that executed in the future date) create postings with exchange rate the rate of proposal creation date and not the posting date.
    Is there any solution to this problem?
    Version 4.6C
    Thanks in advance
    Elias

    Elias
    There are loads of SAP Notes about this.  You'll have to search for the specific one for your system.
    try http://service.sap.com/notes

Maybe you are looking for