Please help with correcting calling class and method errors

Hi All,
I have created a game (like battleship) for 2 tanks. I can't seem to connect the classes and methods to get the values for the last die face rolled; last direction rolled on a 4 headed dice; the x and y position for each tank; the armour value and the firePower (or hit value) to print.
Each row of these values is supposed to print 50 times using a while loop.
(N.B. The code is appended below my name.)
Could anyone please help me? I would be most grateful. Thank you.
Steve
import java.util.*;
class Client
static Die die;
static Direction dir;
static Tank tk1;
static Tank tk2;
public static final
void main( String[] argv)
die = new Die();
dir = new Direction();
tk1 = new Tank();
tk2 = new Tank();
int lastFace;
int setfaceLast;
int x;
int y;
int armourVal;
int firePower;
int battleNum=0;
int battles;
int moves = 0;
System.out.println("Tank");
System.out.println("'\t' Number");
System.out.println("'\t' Dir");
System.out.println("'\t' xValue");
System.out.println("'\t' yValue");
System.out.println("'\t' Armour");
System.out.println("Firepower"+'\n');
int i=0;
//int getLastFace();
//int LastDirName();
while (i <= 50);
int XPos;
int YPos;
Pos p = new Pos();
p.setXPos(x);
p.setYPos(y);
System.out.println ("'\t' Tank 1-");
//System.out.println ( die.getLastFace());
//System.out.println( dir.getLastDirName());
System.out.println(Pos(x));
System.out.println(Pos(y));
System.out.println(armourVal);
System.out.println(firePower+'\n');
System.out.println ("Tank 2-");
System.out.println ( lastFace);
//System.out.println(LastDir);
System.out.println(x);
System.out.println(y);
System.out.println(armourVal);
System.out.println(firePower+'\n');
moves++;
System.out.println(" '\n' + BATTLE");
class Tank
public static final int MINGRID;
public static final int MAXGRID;
static Die die = new Die();
static Direction dir = new Direction();
private static int battleCount;
private static int moveCount;
private int x;
private int y;
private int armourVal;
private int firePower;
public Tank()
int MINGRID=-10;
int MAXGRID=10;
battleCount=0;
moveCount=0;
x=0;
y=0;
armourVal=10;
firePower=1;
public
int getmove()
die.roll();
dir.roll();
dir.getLastDir();
die.getLastFace();
int x;
int y;
int Pos;
switch( dir.getLastDir() )
case Direction.UP:
y += die.getLastFace();
break;
case Direction.DOWN:
y -= die.getLastFace();
break;
case Direction.RIGHT:
x += die.getLastFace();
case Direction.LEFT:
x-= die.getLastFace();
break;
if ( x > MAXGRID )
x = (2 * MAXGRID) - x;
else if ( x < MINGRID )
x = (-2 * MINGRID) - x;
if ( y > MAXGRID )
y = (-2 * MAXGRID) - y;
else if ( y < MINGRID )
y = (-2 * MINGRID) - y;
if ( x == -3 && y == -3 )
firePower++;
System.out.println("Yipee - more firepower.");
if ( x == 3 && y == 3)
this.armourVal += 10;
System.out.println("Yipee - more armour.");
return Pos;
//printDetails();
public boolean getcontinueBattle(Tank tk2)
moveCount++;
if ( x == tk2.x && y == tk2.y)
battleCount++;
System.out.println("Battle");
tk2.armourVal -= firePower;
armourVal -= tk2.firePower;
if (tk2.armourVal < 0 )
int moveCount, battleCount;
return false;
if ( armourVal < 0 )
int moveCount, battleCount;
return false;
return true;
public int getprintDetails()
int ptDet;
return ptDet;
class Direction
private int lastFaceDir;
private Random rnd;
public static final int UP = 1;
public static final int DOWN = 2;
public static final int LEFT = 3;
public static final int RIGHT = 4;
String direction;
private
int getRandomNum()
int raw = rnd.nextInt();
raw = Math.abs( raw );
raw %= 4;
raw++;
return raw;
public
Direction()
rnd = new Random();
roll();
public
int roll()
lastFaceDir = getRandomNum();
if (lastFaceDir == UP)
direction = "up";
else if (lastFaceDir == DOWN)
direction= "down";
else if (lastFaceDir == LEFT)
direction = "left";
else if (lastFaceDir == RIGHT)
direction= "right";
return lastFaceDir;
public
int getLastFaceDir()
return lastFaceDir;
}// end class
class Die
private int lastFace;
private Random rnd;
private
int getRandomNum()
int raw = rnd.nextInt();
raw = Math.abs( raw );
raw %= 6;
raw++;
return raw;
public
Die()
rnd = new Random();
roll();
public
int roll()
lastFace = getRandomNum();
return lastFace;
public
int getLastFace()
return lastFace;
}// end class

I got this sorted!
I unzipped the JAR and loaded the classes individually - so now the "reference" issue went away. Instead I now have a new problem, but I will post that seperately.

Similar Messages

  • Calling Classes and Methods in Transformation Rules

    Hi,
    I have transformations from Level 1 to Level 2 ODS where based on the source fields Date of Sale(ZDSALE) I have to derive Period to Date and Year to Date from the class ZBI_UTILITY_METHODS and method ATTRIBUTES_GET.  How do i incorporate this in my start and transformation routines. Can someone please give me the code for this and also give some sample codes where classes and methods are called in the transformation rules.
    Thanks
    Priya.

    Hi Priya,
    I suggest you the way to call method in the class like this:
      DATA: o_model          TYPE REF TO ZBI_UTILITY_METHODS.
    " define v_return variables based on type the method give the value
      CREATE OBJECT: o_model.
      v_return = o_model->ATTRIBUTES_GET( transfer parameter ).
      free o_model.
    Hopefully it can help you a lot.
    Regards,
    Niel.

  • What is wrong with this Java class and method?

    Created a managed bean and following method as shown below.
    public void setEvent(DisclosureEvent disclosureEvent, CoreShowDetail detail) {
    if (disclosureEvent.isExpanded()) {
    detail.setDisclosed(!detail.isDisclosed());
    -- Then integrated above in the following jspx.
    <af:showOnePanel inlineStyle="width:400px;height:300px;"
    binding="#{ShowApanel.showOnePanel1}"
    id="showOnePanel1">
    <af:showDetailItem text="ADF Faces Components"
    binding="#{ShowApanel.showDetailItem3}"
    id="showDetailItem3" disclosureListener="#{ShowApanel.setEvent}">
    <af:panelHeader text="ADF Faces Components First Child"
    binding="#{ShowApanel.panelHeader6}"
    id="panelHeader6"/>
    <af:panelHeader text="ADF Faces Components Second Child"
    binding="#{ShowApanel.panelHeader5}"
    id="panelHeader5"/>
    </af:showDetailItem>
    <af:showDetailItem text="Architecture"
    binding="#{ShowApanel.showDetailItem2}"
    id="showDetailItem2"
    disclosureListener="#{ShowApanel.setEvent}">
    <af:panelHeader text="Architecture First Child"
    binding="#{ShowApanel.panelHeader4}"
    id="panelHeader4"/>
    <af:panelHeader text="Architecture Second Child"
    binding="#{ShowApanel.panelHeader3}"
    id="panelHeader3"/>
    </af:showDetailItem>
    </af:showOnePanel>
    THE ISSUE:[b]
    I am still not able to programmatically disclose or undisclose the panel component.
    Where am I going wrong? Please help.
    Thanks,
    Ruchir

    Hello Frank,
    I put several print statments but none of them is executing on browser. Does this mean that the method is not being called even once?
    public void setEvent(DisclosureEvent disclosureEvent, CoreShowDetail detail) {
    System.out.println("HelloServer Exiting ...");
    if (disclosureEvent.isExpanded()) {
    System.out.println("HelloServer Exiting1 ...");
    // detail.setDisclosed(!detail.isDisclosed());
    System.out.println("HelloServer Exiting2 ...");
    Thanks,
    Ruchir

  • Please help with the URL class

    Hello,
    I am trying to write a Java app that will take a url and download it.
    I believe you can do this with the URL class but I don't understand how to. For example, if the http url location points to a picture file, how would I code the app to retrieve this picture and save it to a specified directory?
    Also, is there a way that my java app could open another program, let's say Microsoft Internet Explorer?
    Please be as specific as possible, thanks!

    You'll see below an example to download a file
    private static String copyFile (String url, String nomFichier){
         // construction du fichier de sortie
         File outputFile = new File(repertoire + "\\fichiers\\" + nomFichier);
         // si le fichier existe d�j�, il ne sert � rien de le t�l�charger !
    if (outputFile.exists())
         return "fichiers/" + nomFichier;
              try {     
         HttpURLConnection connect = (HttpURLConnection)new URL(url).openConnection();
    boolean connected = false;
    while (!connected){
    try {
    connect.connect();
    connected = true;
         catch (java.io.IOException e1) { System.out.print("...Tentative de connection"); }     
    DataInputStream reader = new DataInputStream(
    connect.getInputStream());
         FileOutputStream out = new FileOutputStream(outputFile);
         int length = 1024;
         byte[] buf = new byte[length];
         int offset = 0;
         long offsetCourant = 0;
         int nb=0;
         while ((nb=reader.read(buf,offset,length))!= -1) {
              out.write(buf,0,nb);
         out.close();
         catch (java.net.MalformedURLException e) { System.out.println("pb d'url"); }
         catch (java.io.IOException e1) { System.out.println(e1.getMessage()); }
         return "fichiers/" + nomFichier;
    }

  • Please help with the FOR loop and the array..

    I was trying to place some words in the Movie Clip
    "TextPanel" and set a
    random position to each of them.
    But it's not working.
    1) I created a Movie Clip "word" and inside that MC I created
    a text field
    and gave it an identifier "textFiled".
    2) The linkage name for Movie Clip "word" I set to "word".
    3) In the actionscript I created an Array called "aWords".
    4) Then I created a FOR loop that should
    place (attach) Movie Clips "word0", "word1", "word2" and
    "word3" to the
    movie clip TextPanel, and set the textField text for each of
    them to the
    text from the Array.
    But the script attaches 4 Movie Clips with a name
    "Undefined", instead of 4
    different names (from the Array).
    What is wrong with this script?
    var aWords:Array = [apple,banana,orange,mango];
    for(i=0;i<aWords.length;i++){
    var v = TextPanel.attachMovie("word","word"+i,i);
    v.textFiled.text = aWords
    v._x = randomNumber(0,Stage.width);
    v._y = randomNumber(0,Stage.height);
    Thanks in advance

    But in my Post I already wrote v.textFiled.text = aWords
    so I don't understand what were you correcting..
    And one more:
    I have tested it by changing the
    v.textFiled.text = aWords; to v.textFiled.text = "some
    word";
    and it's working fine.
    So there is something wrong with the Array element, and I
    don't know why..
    "aniebel" <[email protected]> wrote in
    message
    news:ft2d5k$lld$[email protected]..
    > Change:
    > v.textFiled.text = aWords;
    >
    > to:
    > v.textFiled.text = aWords
    >
    > It needs to know which element inside the array you want
    to place in the
    > textfield (or textfiled) :)
    >
    > If that doesn't work, double check that your instance
    name is correct
    > inside
    > of "word".
    >

  • Please help with this Premiere Pro CS5 encoding error

    VBR 2 pass encoding getting stuck at 50% in Premire Pro CS5. I assume this is the starting point of pass #2. The Error message states that one of the temporary files created during first pass cannot be read. I confirmed that said file exists, it is in the correct location and has the correct file name. Interestingly, at times, the 2 pass encoding proceeds through completion without issues, but I haven't been able to identify the reason for this. PLEASE HELP!! Thank you.

    Thank you so much for replying. I tried running as administrator and it did not correct the issue. Luckily I did figure out the problem after trying various ways. It so happens that Windows seven sets "read Only" attributes to files within folders that you create by right clicking on the drive name and using "New Folder". So, when the encoder tries to over-write on one of the temporary files it created during the first pass it can't do it and it issues the error "Cannot open file for writing...etc.". I fixed it by right clicking inside the folder contents and changing the attribute. Now it works. This is the error that I was getting:

  • Please help with writing a class

    i need help getting started with this assignment. i haven't done anything with writing classes, so i don't know where to start.
    i need to create a bank account class that will keep a name, balance, up to 50 deposits, and up to 50 withdrawls. i need to include 2 arrays for the deposits and withdrawls.
    Here's what i know:
    I need a constructor that takes zero arguments. This constructor would initialize the numeric value to zero.
    I need a 2nd constructor that takes one argument, a name as a String value. This constructor would initialize the numeric value to zero.
    I need a 3rd constructor that takes two arguments, a name as a String value and a starting "balance" as a double value

    Sorry, I was watching a movie with my wife ...imagine that. Study my examples here and try to understand what I have done. You will follow the same methodology for the rest of the program. Use main to test the methods in your program.
    public class mdlAccount {
      String name;
      double balance;
      int currentDeposit = 0;
      int currentWithdrawl = 0;
      double[] deposits = new double[50];
      double[] withdrawals = new double[50];
      public mdlAccount() {
        name = "";
        balance = 0.0;
      public mdlAccount(String name) {
        this.name = name;
        balance = 0.0;
      public mdlAccount(String name, double balance) {
        this.name = name;
        this.balance = balance;
      // When the instructor says: Have a method that does deposits...
      // You need to create a method, similar to the constructors,
      // but with a return value, even if it returns void (nothing).
      // Like this:
      public void deposit( double amount ) {
        // Do some error checking.
        if ( currentDeposit < 50 && amount > 0 ) { // > is a greater than sign
          // If all is ok, add to the balance...
          balance += amount;
          // and add the entry to the array of deposits
          deposits[currentDeposit] = amount;
          // Finally, add 1 to the currentDeposit variable.
          currentDeposit++;
      // We need the 'return the balance' method so we can see if
      // the program runs correctly. This time we return a double,
      // instead of void. (void means don't return anything at all).
      public double getBalance() {
        return balance;
    // Now you create the next method for withdrawals...
    //  if ( currentWithdrawl < 50 ) {
    //    deposits[currentWithdrawl] = amount;
    //    currentWithdrawl++;
      // You want a main method so this class can be executed.
      // You can remove it later if you want to use this class
      // from within another larger program.
      public static void main(String[] args) {
        mdlAccount acct = new mdlAccount( "GumB", 100.0 );
        System.out.println("Initial balance is " + acct.getBalance());
        acct.deposit( 50.0 );
        System.out.println("Current balance is " + acct.getBalance());

  • Please help with workflow - iMovie '08 and Panasonic HDC-SD1

    My two teenage sons play high school basketball and I've been videotaping their games using our new Panasonic SD1. Picture quality is terrific, but I've been taken aback by how much time it takes to get the footage from the camera into iMovie and then how long it takes to burn a DVD from that iMovie file. I'm hoping I'm doing something wrong and that there's a quicker way to get the job done.
    The kids play four periods and I've been stopping and starting the camera in between, so I end up with four separate files on the SD card. Total time is usually an hour and change.
    Okay here's the workflow from there:
    ~ When I get back to my iMac (2.16 Core 2 Duo with 3GB of RAM) I place the SD card in a card reader and import the four files into iMovie from there. Importing the hours' worth of video takes a couple of hours.
    ~ I then make one project with all four files for export to iTunes so the boys can watch on our Apple TV. Exporting, using the "large" format takes another couple of hours.
    ~ I then use the same exported file to make a DVD for the coach using iDVD. That process takes more than three hours.
    I'd actually like to split out the four quarters of the game into separate menu items on the DVD. My thought was to make each quarter a different iMovie project, but it looks like I can't queue the four exports so I'd have to stay close to the computer to do them individually.
    Thanks in advance for the help.
    ...Barry

    If you only have 1 file per quarter, one obvious thing to do would be to edit out the time in between plays, the time-outs, and the like. That is easily done in iMovie.
    Having said that, importing (and exporting) in high definition takes time, and your times do not seem unreasonable.
    Message was edited by: AppleMan1958

  • Please help with Logic Express 7 and using DFH plugin!

    Hey guys, I'm really in a tight spot here as I have no idea how to get my setup working properly. I recently bought an entirely new Imac, Logic Express 7, and a drum plugin called Drumkit From **** Superior (VSTi I believe is the type of plugin they call it). It is supposed to be compatable but I see no way to get it to show up as a plugin. I tried some other programs and it shows up as a plugin and I'm able to get into the interface, but I can't in LE7.
    It is supposed to be compatable as a "rewire" plugin or something like that, but I'm not too sure how to approach that differently, both manuals are very vague.
    Basically, I'm wondering:
    1. How would I go about getting Drumkit From **** Superior to show up as a "plugin" (and what it would be under) if I have to use it a "rewire"?
    2. If I could get it running as a plugin, how would I go about programming a drum part using that "drumkit" in Logic Express?
    Thanks, any help is greatly appreciated.
    -Daniel

    It's a tough one man, I'm actually wanting to go for EZdrummer which I think comes under the same umbrealla as DFH, the patch will come to let you upgrade to intel hopefully by September so hold onto that plug in as I think it'll be worth it in the long run. In the mean time do you have any other options to make beats?
    I use Reason 3.0, I sequence my beats using Reason Drum Kits 2.0 and export them as WAV or AIFF files into Logic, do you have anything similar that you can do? write you beats else where and import into Logic?

  • Please help with correct color settings

    I'm using ID CC. Depending on which one, my printers want my final PDFs either as PDF/x-1a (I know what it does in terms of flattening) or PDF/x-4.
    I need all color images to wind up as CMYK regardless of what they were when placed. I need all 100%K blacks to stay that way and not get converted to a rich black.
    Presently, my document color settings are as follows:
    Settings: North America General Purpose 2
    Working Spaces:
    RGB: sRGB IE61966-2.1
    CMYK U.S. Web Coated (SWOP) v2
    Color Management Policies:
    RGB: Preserve Embedded Profiles
    CMYK: Preserve Numbers (Ignore LInked Profiles)
    Conversion Options:
    Engine: Adobe (ACE)
    Intent: Relative Colorimetric
    I use the default settings for either PDF/x-1a or PDF/x-4 (plus having ink manager convert all spots to process) and and always receive a yellow warning triangle with the following warning under general:
    The preset specifies source profiles that don't match the current color settings file. Profiles specified by the color settings file will be used.
    What do I need to check in my document color settings to avoid that error message (the resulting files do seem to be correct for what I need; just want to make sure I've set it right in terms of that error). Of course, any other thoughts are always appreciated too.
    Also, what should my document color settings be if the final document will be black & white (grayscale) and only contains data on the black plate?

    Peter Spier wrote:
    That warning is normal and nothing to worry about. It just means your document color settings don't match the preset, and the document settings will be used, which you want.
    But the other part of your post that IS bothersome is that by definition PDF/X-4 does not convert colors, and it preserves embedded profiles, so that color conversion can be done at the RIP. There's no way that's compatible with "I need all color images to wind up as CMYK regardless of what they were when placed."
    Thank you. I had just begun testing PDF/X-4 at the insistence of people here that it was the way to go. Then it looks like for these jobs wehre I must wind up with everything as CMYK I should continue using PDF/x1-a which does do that and which I've used for that in the past.
    What about for work that is all b/w (grayscale)? Any advice on settings for that?

  • Please help with mail server choice and setup

    Hello dear arch users, for begining i`ll start with litle intro what i know, and what i dont understand, so it would be easyer to help solve my problem, thanks for reading this.
    I've been using arch for some time (few months) but i still dont know very much about it..
    I have successfully installed lighttpd+php (fcgi)+mysql+phpmyadmin, ssh and mc allso of cource, serveral times, so i know how to solve little problems
    I need everything lightweight because my arch's box is not so fresh as i could want
    p2 350mhz CPU
    192mb of RAM
    8Gb HDD
    10Mbit internet connection
    whole project is for personal use only, and it will not even reach 10 user limit (me and some friends are using this..)
    Now i`m willing to install mail server with some webmail ( i dont like outlook express thunderbird and other clients, only web acces)
    I have googled for tutorials for 2 days now, just looking for best thing for newbie like me, with little knowlage of linux.
    SquirrelMail or RoundCube wich one is bether ? I like RoundCube because it has nicer web design, but is it bether that SquirrelMail ?
    Postfix and Dovecot are they enough good, or is there anything bether ?
    Spamassasin and Graylistening will this work, or i`ll need something stronger?
    Did i miss anything ?
    I just want to say thanks for reading this, and helping me out. Thanks!
    ps will this be good enough tutorial to follow ? http://www.hypexr.org/linux_mail_server.php
    Karlis.
    Last edited by karlis (2010-01-10 13:49:14)

    Hi, thanks for response
    SSL certificate is generated ... ok so it wont be so hard to help here are my configs
    main.cf
    # Paths
    queue_directory = /var/spool/postfix
    command_directory = /usr/sbin
    daemon_directory = /usr/lib/postfix
    mail_owner = postfix
    # Domain settings
    myhostname = <mydomain>
    myorigin = <mydomain>
    mydestination = $myhostname, localhost.$mydomain, localhost
    # SMTP settings
    smtpd_tls_cert_file=/etc/ssl/certs/mail.crt
    smtpd_tls_key_file=/etc/ssl/private/mail.key
    smtpd_use_tls=yes
    smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache
    smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_scache
    smtpd_tls_loglevel = 1
    smtpd_sasl_auth_enable = yes
    smtp_sasl_auth_enable = yes
    smtpd_recipient_restrictions = permit_sasl_authenticated,
    permit_mynetworks,
    reject_unauth_destination,
    check_policy_service inet:127.0.0.1:10030
    smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks
    smtpd_sasl_security_options = noanonymous
    # SASL
    smtpd_sasl_type = dovecot
    smtpd_sasl_path = /var/run/dovecot/auth-client
    # Email and mailbox settings
    alias_maps = hash:/etc/postfix/aliases
    alias_database = $alias_maps
    home_mailbox = Maildir/
    virtual_alias_domains = <mydomain>
    virtual_alias_maps = hash:/etc/postfix/virtual
    mailbox_size_limit = 0
    dovecot.conf
    protocols = imap imaps
    disable_plaintext_auth = yes
    log_timestamp = "%b %d %H:%M:%S "
    ssl = yes
    ssl_cert_file = /etc/ssl/certs/mail.crt
    ssl_key_file = /etc/ssl/private/mail.key
    mail_access_groups = mail
    mechanisms = plain login
    socket listen {
    client {
    path = /var/run/dovecot/auth-client
    mode = 0660
    user = postfix
    group = postfix
    here are some of my config uncommented part, if its nececery i can zip and upload bouth configs to be 100% clear wheres the problem..
    Karlis
    Last edited by karlis (2010-01-13 18:02:23)

  • HT1553 Hi. My ipad froze with a message that iCloud hasn't been backed up in 11weeks. Please help with steps to unfreeze and back up the ipad.

    Hi.
    My iPad froze with a message "icloud backup" I clicked ok but it will not budge or unfreeze for me to do anything. I tried to power it off with no luck. Please someone help.

    You posted in the wrong forum, Snow Leopard.  You need to post in the iPad forums.  It's where the iPad users hang out at.

  • Please help with restoring different apps and their data between 2 iPads

    I just bought a new iPad Air 2 . I currently have 2 iPads, 1st gen and iPad 2nd, each with its own set of apps and their data. I backed up each older iPad manually as  a full backup. I created a separate library for one of them when doing this. Now I want to transfer iPad 1st gen apps and data to iPad 2nd, so I reset iPad 2nd to factory and then restored from the manual back up of the iPad 1st gen and it seems to work fine. Before that I had backed up iPad 2nd's current data. So now I now I want to transfer the iPad 2nd apps and data to the new iPad Air. I selected the backup by the time stamp that I had backed up iPad 2nd. I didn't know how to rename each iPad to something unique. It restored from backup, but it's all the apps and data from my iPad 1st gen backup, not iPad 2nd.
    I'm utterly confused. Even when I have the separate iTunes library open it shows all the manual backups I performed, so it's not truly a separate library. Do I need to manually install/remove the various apps on the newer iPad?

    If you only have 1 file per quarter, one obvious thing to do would be to edit out the time in between plays, the time-outs, and the like. That is easily done in iMovie.
    Having said that, importing (and exporting) in high definition takes time, and your times do not seem unreasonable.
    Message was edited by: AppleMan1958

  • ADO Database Connection: Need help with correct syntax for 'Execute' Method

    My server Windows 2008R2 taking more than 30 hours to complete backup
    so next backup getting fail
    is there any option to set start backup after 24 hours if previous backup complete

    I have a script that I am trying to cobble together, but I am stuck at attempting to execute an SQL query against and ADO connection. My code is as follows:Powershell $FQDNUpper = $Computer.ToUpper() + ".domain.dn1.dn2" $FQDNLower = $Computer.ToLower() + ".domain.dn1.dn2" $shell = New-Object -ComObject "Wscript.Shell" # for use later in script $cnn = New-Object -ComObject "ADODB.Connection" $cnn.ConnectionString = "Connection_String" $cnn.Open() $query = "SELECT CAST(ID AS nvarchar(50)) ID FROM Machine WHERE Name=$FQDNUpper AND Role = 0" $rs = $cnn.Execute($query,' ',1) #If statement that will qualify if $FQDNUpper returned anything else try $FQDNLowerWhen executing the code I receive an error:
    PowershellArgument: '2' should be a System.Management.Automation.PSReference. Use [ref].At line:9 char:5+ $rs = $cnn.Execute($query,' ',1)+ ...

  • Need help with check out form - Payment method error

    When I check out error comes up "Payment Method must be selected" though it is.
    The 30 day account option works but Credit cards get the above error.
    Anyone able to help me?
    Andrew
    <h1>Checkout</h1>
    <p class="required-h1-tip"><span>*</span> Required field</p>
    <p>Please fill out the required fields, delivery address and payment fields.</p>
    <hr />
    <section class="checkout form-container">
    <form name="catwebformform42059" class="form-generic-a checkout-a" id="catwebformform42059" onsubmit="return checkWholeForm42059(this)" action="/FormProcessv2.aspx?WebFormID=10850&amp;OID={module_oid}&amp;OTYPE={module_otype} &amp;EID={module_eid}&amp;CID={module_cid}" enctype="multipart/form-data" method="post">
        <fieldset>
        <h2 class="a">1. Account Information</h2>
        <!--<div class="row">
        <p class="field field-a">
        <label for="username">User Name <em>*</em></label>
        <input type="text" value="{module_username}" id="f-username" class="text" name="UserName" />
        </p>
        <p class="field field-b">
        <label for="password">Password <em>*</em></label>
        <span class="half">
        <input type="password" value="{module_password}" id="f-password" class="text" name="Password" />
        </span></p>
        <p class="field field-b">
        <label for="confirm-password">Confirm <em>*</em></label>
        <span class="half">
        <input type="password" value="{module_password}" id="f-password-confirm" class="text" name="PasswordConfirm" />
        </span></p>
        </div>-->
        <div class="row">
        <p class="field field-a">
        <label for="first-name">First Name <em>*</em></label>
        <input type="text" name="FirstName" class="text" id="f-first-name" value="{module_firstname}" />
        </p>
        <p class="field field-a">
        <label for="last-name">Last Name <em>*</em></label>
        <input type="text" name="LastName" class="text" id="LastName" value="{module_lastname}" />
        </p>
        </div>
        <div class="row">
        <p class="field field-a">
        <label for="email">Email Address <em>*</em></label>
        <input type="text" name="EmailAddress" class="text" id="f-email" value="{module_emailaddress}" />
        </p>
        <p class="field field-a">
        <label for="phone">Phone Number <em>*</em></label>
        <input type="text" name="HomePhone" class="text" id="f-phone" value="{module_homephone}" />
        </p>
        </div>
        <div class="row checkbox"><span class="tick">
        <input type="checkbox" name="CampaignList_20945" class="tick" id="f-updates" />
        </span>
        <label for="newsletter-a">Keep me up to date on product information, sales, and special offerings.</label>
        </div>
        </fieldset>
        <hr />
        <fieldset>
        <h2 class="a">2. Shipping Address</h2>
        <div class="row">
        <p class="field field-a">
        <label for="ShippingAttention">Shipping Name: <em>*</em></label>
        <input type="text" class="text" id="ShippingAttention" name="ShippingAttention" />
        </p>
        </div>
        <div class="row">
        <p class="field field-a">
        <label for="shipping-addr-1">Address Line 1 <em>*</em></label>
        <input type="text" class="text" id="ShippingAddress" name="ShippingAddress" />
        </p>
        <p class="field field-a">
        <label for="shipping-addr-2">Address Line 2</label>
        <input type="text" class="text" id="ShippingAddress2" name="ShippingAddress2" />
        </p>
        </div>
        <div class="row">
        <p class="field field-a">
        <label for="shipping-city">City <em>*</em></label>
        <input type="text" class="text" id="ShippingCity" name="ShippingCity" />
        </p>
        <p class="field field-a">
        <label for="shipping-state">State <em>*</em></label>
        <input type="text" class="text" id="ShippingState" name="ShippingState" />
        </p>
        </div>
        <div class="row">
        <div class="field field-a">
        <p class="field-b">
        <label for="ShippingZip">Zip / Postal Code <em>*</em></label>
        <input type="text" class="text" id="ShippingZip" name="ShippingZip" />
        </p>
        </div>
        <!--  <p class="field field-a">
                        <label for="shipping-phone">Phone Number <em>*</em></label>
                        <input type="text" id="shipping-phone" name="shipping-phone" />
                    </p> -->
        </div>
        </fieldset>
        <hr />
        <fieldset>
        <h2 class="a">3. Billing Address</h2>
        <div class="row checkbox"><span class="tick">
        <input type="checkbox" class="tick" value="1" id="f-shipping-same" name="same_shipping" />
        </span>
        <label for="billing-same-as-shipping">Check this box if billing address is the same as shipping address.</label>
        </div>
        <div class="row">
        <p class="field field-a">
        <label for="billing-addr-1">Address Line 1 <em>*</em></label>
        <input type="text" value="{module_homeaddress}" id="BillingAddress" class="text" name="BillingAddress" />
        </p>
        <p class="field field-a">
        <label for="billing-addr-2">Address Line 2 <em>*</em></label>
        <input type="text" class="text" id="BillingAddress2" name="BillingAddress2" />
        </p>
        </div>
        <div class="row">
        <p class="field field-a">
        <label for="billing-city">City <em>*</em></label>
        <input type="text" value="{module_homecity}" id="BillingCity" class="text" name="BillingCity" />
        </p>
        <p class="field field-a">
        <label for="billing-state">State <em>*</em></label>
        <input type="text" value="{module_homestate}" id="BillingState" class="text" name="BillingState" />
        </p>
        </div>
        <div class="row">
        <p class="field field-b">
        <label for="BillingZip">Zip / Postal Code <em>*</em></label>
        <input type="text" value="{module_homezip}" id="BillingZip" class="text" name="BillingZip" />
        </p>
        </div>
        </fieldset>
        <hr />
        <fieldset id="credit-card-information">
        <h2 class="a">4. Payment Options</h2>
        <div class="row">
        <h4>Approved 30 DayAccount Customer</h4>
        <p class="field">Please select   
        </p>
        <input type="radio" name="PaymentMethodType" id="PaymentMethodType" value="8" /><span style="font-size: 18px; color: #ffff00;">Account Customers Only</span><hr />
        <h2>Pay by Credit Card</h2>
        <p class="row row-accepted-cards">
        We accept the following credit cards: <img alt="" src="temp/cards.png" />            </p>
        <label for="card-type">Card Type <em>*</em></label>
        <span class="select">
        <select name="CardType" class="text" id="f-cc-type">
        <option selected="selected" value="1">Visa</option>
        <option value="2">Master Card</option>
        <option value="4">American Express</option>
        </select>    </span>
        </div>
        <div class="row">
        <p class="field field-a">
        <label for="name-on-card">Name on Card <em>*</em></label>
        <input type="text" name="CardName" class="text" id="f-cc-name" />
        </p>
        <p class="field field-a">
        <label for="card-number">Card Number <em>*</em></label>
        <input type="text" name="CardNumber" class="text" id="f-cc-number" />
        </p>
        </div>
        <div class="row">
        <p class="field card-expiration">
        <label for="card-exp-month">Card Expiration <span class="offset">Month</span> <em>*</em></label>
        <span class="select one">
        <select name="CardExpiryMonth" class="s" id="f-cc-exp-month">
        <option selected="selected" value="1">January</option>
        <option value="2">February</option>
        <option value="3">Mar</option>
        <option value="4">Apr</option>
        <option value="5">May</option>
        <option value="6">Jun</option>
        <option value="7">Jul</option>
        <option value="8">Aug</option>
        <option value="9">Sep</option>
        <option value="10">Oct</option>
        <option value="11">Nov</option>
        <option value="12">Dec</option>
        </select>
        </span>
        <label class="offset" for="card-exp-year">Card Expiration Year<em>*</em></label>
        <span class="select">
        <select name="CardExpiryYear" class="xs" id="f-cc-exp-year">
        <option value="2015">2015</option>
        <option value="2016">2016</option>
        <option value="2017">2017</option>
        <option value="2018">2018</option>
        <option value="2019">2019</option>
        <option value="2020">2020</option>
        <option value="2021">2021</option>
        <option value="2022">2022</option>
        </select>
        </span></p>
        </div>
        <div class="row">
        <div style="display: none;">
        <input type="radio" name="PaymentMethodType" class="tick" id="f-payment-method-cc" value="1" />
        <input type="radio" name="PaymentMethodType" id="PaymentMethodType_9" value="10" />
        </div>
        </div>
        <div class="row">
        <p class="field ccvn">
        <label for="ccv-number">CCV Number <em>*</em></label>
        <span class="ccv">
        <input type="text" name="CardCCV" class="text" id="f-cc-cvv" />
        </span></p>
        </div>
        </fieldset>
        <div class="wrap total">
        <p class="sum">Total: <strong><span class="amountSpan"></span></strong></p>
        <p class="action"><button class="button-a" type="submit">Checkout</button></p>
        </div>
        <input type="hidden" name="Amount" class="cat_textbox" id="Amount" readonly="readonly" />
        <script type="text/javascript" src="/CatalystScripts/ValidationFunctions.js"></script>
        <script language="javascript" type="text/javascript">
                //<![CDATA[
                var submitcount42059 = 0;function checkWholeForm42059(theForm){var why = "";if (theForm.Username) why += isEmpty(theForm.Username.value, "Username"); if (theForm.Password && theForm.PasswordConfirm) { why += isEmpty(theForm.Password.value, "Password"); why += isEmpty(theForm.PasswordConfirm.value, "Confirm Password"); if (theForm.Password.value != theForm.PasswordConfirm.value) why += appendBreak("- Password and its confirmation do not match."); if (theForm.Password.value.length < 6) why += appendBreak("- Password must be 6 characters or longer."); }if (theForm.FirstName) why += isEmpty(theForm.FirstName.value, "First Name"); if (theForm.LastName) why += isEmpty(theForm.LastName.value, "Last Name"); if (theForm.HomePhone) why += isEmpty(theForm.HomePhone.value, "Phone Number"); if (theForm.EmailAddress) why += checkEmail(theForm.EmailAddress.value);if (theForm.ShippingAttention) why += isEmpty(theForm.ShippingAttention.value, "Shipping Name");if (theForm.ShippingAddress) why += isEmpty(theForm.ShippingAddress.value, "Shipping Address"); if (theForm.HomePhone) why += isEmpty(theForm.HomePhone.value, "Phone Number"); if (theForm.ShippingState) why += isEmpty(theForm.ShippingState.value, "Shipping State");  if (theForm.ShippingCity) why += isEmpty(theForm.ShippingCity.value, "Shipping City");  if (theForm.ShippingZip) why += isEmpty(theForm.ShippingZip.value, "Shipping Zipcode");
                if (theForm.BillingAddress) why += isEmpty(theForm.BillingAddress.value, "Billing Address");  if (theForm.BillingState) why += isEmpty(theForm.BillingState.value, "Billing State");  if (theForm.BillingCity) why += isEmpty(theForm.BillingCity.value, "Billing City");  if (theForm.BillingZip) why += isEmpty(theForm.BillingZip.value, "Billing Zipcode");
                 if (!theForm.PaymentMethodType || getRadioSelected(theForm.PaymentMethodType) == 1) { if (theForm.CardName) why += isEmpty(theForm.CardName.value, "Name on Card"); if (theForm.CardNumber) why += isNumeric(theForm.CardNumber.value, "Card Number"); if (theForm.Amount) why += isCurrency(theForm.Amount.value, "Amount"); } if (theForm.PaymentMethodType) why += checkSelected(theForm.PaymentMethodType, "Payment Method");if(why != ""){alert(why);return false;}if(submitcount42059 == 0){submitcount42059++;theForm.submit();return false;}else{alert("Form submission is in progress.");return false;}}
                // Credit Card info is not required if paying by PayPal, Hosted Credit Card, COD etc
                function ShowCCFields(val) {                           
                    if (!document.getElementById('paymentdiv'))
                        return;         
                    if (val != 1)
                        document.getElementById('paymentdiv').style.display = 'none';               
                    else
                        document.getElementById('paymentdiv').style.display = 'inline';
                //]]>
            </script>
    </form>
    </section>

    Locking this thread.
    You only need one post on something

Maybe you are looking for