Understunding this code for having two instanciation of applets

this an exemple i would like to understund how this code work and how it make difference between register() and register(buffer, (short)(offset + 1), (byte)buffer[offset]);
protected MyApplet1(byte[] buffer, short offset, byte length) {
    // data offset is used for application specific parameter.
    // initialization with default offset (AID offset).
    short dataOffset = offset;
    boolean isOP2 = false;
    if (length >= 9) {
      // Install parameter detail. Compliant with OP 2.0.1.
      // | size | content
      // |------|---------------------------
      // |  1   | [AID_Length]
      // | 5-16 | [AID_Bytes]
      // |  1   | [Privilege_Length]
      // | 1-n  | [Privilege_Bytes] (normally 1Byte)
      // |  1   | [Application_Proprietary_Length]
      // | 0-m  | [Application_Proprietary_Bytes]
      // shift to privilege offset
      dataOffset += (short)( 1 + buffer[offset]);
      // finally shift to Application specific offset
      dataOffset += (short)( 1 + buffer[dataOffset]);
      /**@todo: IF NECESSARY, USE COMMENTS TO CHECK LENGTH*/
      // // checks wrong data length
      // if(buffer[dataOffset] !=  <PUT YOUR PARAMETERS LENGTH> )
      //     // return received proprietary data length in the reason
      //     ISOException.throwIt((short)(ISO7816.SW_WRONG_LENGTH + offset + length - dataOffset));
      // go to proprietary data
      dataOffset++;
      // update flag
      isOP2 = true;
    else {
      // Install parameter compliant with OP 2.0.
      /**@todo: IF NECESSARY, USE COMMENTS TO CHECK LENGTH*/
      // if(length != <PUT YOUR PARAMETERS LENGTH> )
      //     ISOException.throwIt((short)(ISO7816.SW_WRONG_LENGTH + length));
    /**@todo: PUT YOUR CREATION ACTION HERE*/
    // register this instance
    if (isOP2) {
      register(buffer, (short)(offset + 1), (byte)buffer[offset]);
    else {
      register();
  }

On a GlobalPlatform compliant card, the constructor of an applet is called during the last step of the applet's installation process.
The "buffer" parameter given as argument to the constructor usually contains: the instance AID, the applet's privileges and applet's specific bytes.
When installing an applet on a card you can specify 3 different kind of AIDs:
- the package AID
- the applet AID
- the applet instance AID
register(buffer, (short)(offset + 1), (byte)buffer[offset]); will register the applet with the JCRE using the applet instance AID specified in the buffer parameter
register(); will register the applet with the JCRE using the applet AID

Similar Messages

  • I've had Photoshop elements 8 on this machine for over two years and all of a sudden it is asking for a serial number. when I put it in it give me a serial number invalid message

    I've had Photoshop elements 8 on this machine for over two years and all of a sudden it is asking for a serial number. when I put it in it give me a serial number invalid message

    I am having the same experience. Did you find a solution??

  • I create an id. on review option when i enter visa card and security code, it always gives an error msg "Invalid Secruity code". but i use this code for money withdraw from ATM and for shopping also. plz tell the solution ????

    i create an id. on review option when i enter visa card and security code, it always gives an error msg "Invalid Secruity code". but i use this code for money withdraw from ATM and for shopping also. plz tell the solution ????

    The code they are asking for is the last three digits of the number on the back of the card (you don't use this when using an ATM or presenting the card in shops).

  • Urgent where i put this code for delete

    hi master
    sir this code is right for my requirment but when i put on_delete event system not respons or not delete record
    where i put this code for conditional deletion
    this is my code
    declare
         recno number;
    begin
    if :system.cursor_block='accbal' then
    delete accbal where accid=:chartofacc.accid;
         go_block('chartofacc');
         next_record;
    elsif :system.cursor_block='chartofacc' then
         select count(*) into recno from accbal where accid=:chartofacc.accid;
         if recno=0 then
         delete_record;
         go_block('chartofacc');
         previous_record;
         else
         message ('system found matching record then no delete master record');
         message ('system found matching record then no delete master record');
         end if;
    end if;
    end;
    please gide me which event i use
    thanking you
    aamir

    Hello,
    The ON-DELETE triger fires only after a COMMIT statment and only for those records that have been deleted in the block.
    Francois

  • HT4623 My loud speaker went out on my phone how can I get it fixed I've had this phone for about two months?

    How come I can only talk on speakerphone? Even on speakerphone I can barely hear the other person. They can't hear me when I'm not on speakerphone. And my music doesn't play very loud like my speaker is blown. What do I do I've had this phone for about two months and no insurance on it.

    iOS: Not responding or does not turn on
    Locate a Service Center
    Call Apple for Service and Support
    Set up service on your own or check options and warranty
    Questions about service and potential costs (Choose your country after selecting your product)

  • URGENT Check this code for me please

    Dear whoeverthisreads, please read and see at the bottom my sourcecode, or whatever I could make of it until (even with help) I failed to see any solution. Please copy, paste and run to see if you can manage to adjust the program to make it work in the way as described. And I think I made it unnecessarily complicated. Whatever you can do for me, I will be very, very grateful.
    Prem Pradeep, email: [email protected]
    (A beginning dutch Java student who is running out of time and hope)
    Catalogue Manager
    Specification:
    a) Develop an object to represent to encapsulate an item in a catalogue. Each CatalogueItem has three pieces of information: an alphanumeric catalogue code, a name, and a price (in dollars and cents), that excludes sales tax. The object should also be able to report the price, inclusive of a 15% sales tax, and the taxed component of the price.
    b) Work out a way to be able to support the inc tax/ex tax price accessors, and the tax component accessor, without needing to store any additional information in the object.
    c) Use an array of 5 CatalogueItem items to store data. (You may assume that no imported goods will be recorded.)
    d) Write a driver program that prompts for three sets of user input (catalogue number, description and price), to be stored in the atalogueItem instance.
    e) The data are to be read for each item in a single line. The data lines will be in the format:
    CatNo:Description:Price
    Use a StringTokenizer object to separate these data lines into their components.
    f) Review the class definition of CatalogueItem, and use modifiers where appropriate to:
    � Ensure that data is properly protected;
    � Ensure that the accessors and mutators are most visible;
    � The accessors and mutators for the catalogue number and description cannot be overridden.
    � The constant for the tax rate is publicly accessible, and does not need an instance of the class
    present in order to be accessible.
    As well as a summary, the program should also calculate and display:
    � All of the cheapest and most expensive item(s) in the catalogue. In the case of more than one
    item being the cheapest (or most expensive), they should all be listed.
    � A total of the pre-tax worth of the goods in the catalogue.
    � The average amount of tax on the items in the catalogue.
    A sample execution of the program may be as follows (output should be tabulated):
    Enter five items of data:
    AA123: Telephone: 52.00
    ZJ282: Pine Table: 98.00
    BA023: Headphones: 23.00
    ZZ338: Wristwatch: 295.00
    JW289: Tape Recorder: 23.00
    LISTING OF ALL GOODS
    Cat      Description      ExTax           Tax           IncTax ~
    ZJ282      pine Table           98.00           14.70           112.70
    AA123 Telephone           52.00           7.80           59.80
    BA023 Headphones      23.00           3.45           26.45
    ZZ338      Wristwatch      295.00      44.25      339.25
    JW289 Tape Recorder      23.00           3.45           26.45
    CHEAPEST GOODS IN CATALOGUE
    Cat      Description      ExTax           Tax           IncTax
    BA023 Headphones           23.00           3.45           26.45
    JW289 Tape Recorder      23.00           3.45           26.45
    MOST EXPENSIVE GOODS IN CATALOGUE
    Cat      Description      ExTax           Tax           IncTax
    ZZ338      Wristwatch      295.00      44.25      339.25
    TOTAL PRE-TAX WORTH OF CATALOGUE ITEMS:      491.00
    AVERAGE AMOUNT OF TAX PAYABLE PER ITEM:      14.73
    The next code is what I could make of it�until I got terribly stuck...
    //CatalogueItem.java
    import java.io.*;
    import java.text.DecimalFormat;
    import java.util.StringTokenizer;
    public class CatalogueItem {
    private static final double TAXABLE_PERCENTAGE = 0.15;
    private String catalogNumber;
    private String description;
    private double price;
    /** Creates a new instance of CatalogueItem */
    public CatalogueItem() {
    catalogNumber = null;
    description = null;
    price = 0;
    public CatalogueItem(String pCatalogNumber, String pDescription, double pPrice) {
    catalogNumber = pCatalogNumber;
    description = pDescription;
    price = pPrice;
    void setCatalogNumber(String pCatalogNumber) {
    catalogNumber = pCatalogNumber;
    String getCatalogNumber() {
    String str = catalogNumber;
    return str;
    void setDescription(String pDescription) {
    description = pDescription;
    String getDescription() {
    String str = description;
    return str;
    void setPrice(String pPrice) {
    price = Double.parseDouble(pPrice);
    double getPrice() {
    double rprice = price;
    return formatDouble(rprice);
    double getTaxAmount(){
    double rTaxAmount = price * TAXABLE_PERCENTAGE;
    return formatDouble(rTaxAmount);
    double getIncTaxAmount() {
    double rTaxAmount = price * (1 + TAXABLE_PERCENTAGE);
    return formatDouble(rTaxAmount);
    double formatDouble(double value) {
    DecimalFormat myFormatter = new DecimalFormat("###.##");
    String str1 = myFormatter.format(value);
    // System.out.println("String is " + str1);
    // System.out.println("The format value : " + value);
    return Double.parseDouble(str1);
    public static void main(String[] args) throws IOException {
    final int MAX_INPUT_SET = 5;
    final String strQ = "Enter five items of data:";
    CatalogueItem[] catalogList = new CatalogueItem[MAX_INPUT_SET];
    String strInput;
    BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
    String header = "Cat\tDescription\tExTax\tTax\tInc Tax";
    String lines = "---\t-----------\t------\t---\t-------";
    // Input of five items with three data each, delimiter ":"
    for (int i = 0; i < MAX_INPUT_SET; i++) {
    catalogList[i] = new CatalogueItem();
    System.out.print(strQ);
    strInput = stdin.readLine();
    StringTokenizer tokenizer = new StringTokenizer(strInput, ":" );
    String inCatNo = tokenizer.nextToken();
    String inDescr = tokenizer.nextToken();
    String inPrice = tokenizer.nextToken();
    catalogList.setCatalogNumnber(inCatNo);
    catalogList[i].setDescription(inDescr);
    catalogList[i].setPrice(inPrice);
    // Listing of all goods
    System.out.println("LISTING OF ALL GOODS");
    System.out.println(header);
    System.out.println(lines);
    for (int i = 0; i < MAX_INPUT_SET; i++) {
    System.out.println(
    catalogList[i].getCatalogNumber() + "\t" +
    catalogList[i].getDescription() + "\t" +
    catalogList[i].getPrice() + "\t" +
    catalogList[i].getTaxAmount() + "\t" +
    catalogList[i].getIncTaxAmount());
    // This should pick the cheapest and most expensive goods in catalogue, but
    // this code is not good:
    // In the case of more than one item being the cheapest (or most expensive),
    // they should all be listed.
    double cheapest = cataloguelist[1].getPrice();
    double mostExpensive = cataloguelist[1].getPrice();
              for(int i=2; i< MAX_INPUT_SET; i++){
                   if (cataloguelist[i].getPrice < cheapest)
              cheapest = i;}
              for(int i=2; i< MAX_INPUT_SET; i++){
                   if (cataloguelist[i].getPrice > mostExpensivet)
              mostExpensive = i;}
    // Lists cheapest goods (not complete enough)
    i = cheapest;
    System.out.println("CHEAPEST GOODS IN CATALOGUE");
    System.out.println(header);
    System.out.println(lines);
    System.out.println(
    catalogList[i].getCatalogNumber() + "\t" +
    catalogList[i].getDescription() + "\t" +
    catalogList[i].getPrice() + "\t" +
    catalogList[i].getTaxAmount() + "\t" +
    catalogList[i].getIncTaxAmount());
    // Lists most expensive goods (not complete enough)
    i = mostExpensive;
    System.out.println("MOST EXPENSIVE GOODS IN CATALOGUE");
    System.out.println(header);
    System.out.println(lines);
    System.out.println(
    catalogList[i].getCatalogNumber() + "\t" +
    catalogList[i].getDescription() + "\t" +
    catalogList[i].getPrice() + "\t" +
    catalogList[i].getTaxAmount() + "\t" +
    catalogList[i].getIncTaxAmount());}}
    // Generates and shows total pre-tax worth of catalogue items (how??)
    // generates and shows amount of tax payable per item (how??)

    How is this:
    import java.io.*;
    import java.text.*;
    import java.util.*;
    public class Cat
         Vector items = new Vector();
    public Cat()
    public void read(String fname)
         FileReader     fr;
        BufferedReader br;
         String         str ="";
        try
             fr = new FileReader(fname);
            br = new BufferedReader(fr);
            while ((str = br.readLine()) != null && items.size() < 30)
                   if (!str.trim().equals(""))
                        StringTokenizer tokenizer = new StringTokenizer(str, ":");
                     String n = tokenizer.nextToken().trim();
                        String d = tokenizer.nextToken().trim();
                        String s = tokenizer.nextToken().trim();
                        double p = Double.parseDouble(s);
                        items.add(new Item(n,d,p));
            fr.close();
        catch (FileNotFoundException e)
            System.out.println("Input file cannot be located, please make sure the file exists!");
            System.exit(0);
        catch (IOException e)
            System.out.println(e.getMessage());
            System.out.println("Application cannot read the data from the file!");
            System.exit(0);
    public void displayAll()
         for (int j=0; j < items.size(); j++)
              Item item = (Item)items.get(j);
              System.out.println(item.toString());
    public void sort()
         Collections.sort(items);     
    public class Item implements Comparable
         String       number, description;
         double       price,pricep;
         final double TAXRATE = 0.15;
    public Item(String number, String description, double price)
         this.number      = number;
         this.description = description;
         this.price       = price;
         this.pricep      = price * TAXRATE;
    public int compareTo(Object o1)
         String o = ((Item)o1).number;
         return(number.compareTo(o));
    public String toString()
         DecimalFormat df = new DecimalFormat("#.00");     
         String        p1 = df.format(TAXRATE*price);
         String        p2 = df.format(TAXRATE*price+price);
         String s = number+"\t "+description+"\t"+price+"\t"+p1+"\t"+p2+"\t" ;
         return(s);
    public static void main (String[] args)
         Cat catalog = new Cat();
         catalog.read("C31.dat");
         String reply = "";
         BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
         while (!reply.equals("e"))
              System.out.println("");
            System.out.println("CATALOGUE MANAGER: MAIN MENU");
            System.out.println("============================");
            System.out.println("a) display all goods        b) display cheapest/dearest goods");
            System.out.println("c) sort the goods list      d) search the good list");
            System.out.println("e) quit");
            System.out.print("Option:");
              try
                   reply = stdin.readLine();
              catch (IOException e)
                System.out.println("ERROR:" + e.getMessage());
                System.out.println("Application exits now");
                System.exit(0);
              if (reply.equals("a")) catalog.displayAll();
              if (reply.equals("c")) catalog.sort();
    Noah

  • Could anyone check this code for errors for me??

    Hi! Could someone please tell me if you see any problems with this code?? a friend wants me to check it for errors, but can't find any. I just wanted to make sure, because there are probably a lot of better scripters than me reading this. Please answer soon!!
    heres the code:
    stop();
    addEventListener(Event.ENTER_FRAME, preLoad);
    function  preLoad(e:Event):void{
    var bytestoLoad):Number = loaderInfo.bytesTotal; 
    var numberLoaded:Number = loaderInfo.bytesLoaded;
    if (bytestoLoad ==  numberLoaded) {
    removeEventListener)Event.ENTER_FRAME, preLoad) 
    gotoAndStop(2);
    }else {
    preLoader.preLoaderFill.scaleX =  numberLoaded/bytestoLoad;
    preLoader.bytePercent.text = Math.floor  (numberLoaded/bytestoLoad*100) + "%";
    Thanks!!
    -Sammy

    I ran it on debug mode and changed it to this? see any problems now? or are they fixed? It looks to me like it took some actions out, I hope that doesn't
    effect it....
    stop();
    addEventListener(Event.ENTER_FRAME, preLoad);
    function preLoad(e:Event):void{
    var bytestoLoad):Number = loaderInfo.bytesTotal;
    var numberLoaded:Number = loaderInfo.bytesLoaded;
    if (bytestoLoad == numberLoaded) {
    removeEventListener)Event.ENTER_FRAME, preLoad)
    gotoAndStop(2);
    i'm kinda new to flash ((I started as a lua scripter (on Roblox)) so I'm a little confused about this. Thanks for the help!!

  • Pls help me to execute this code for pert analysis..

    hi friend;
    i m new in java and i have downloaded some code for pert analysis which is giving some exception called run time .so,pls tell how to give the i/p..bcoz i faceing some at tha time. aur if u have pls send me pert analysis code..
    the code is below.......
    thanks
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.StringTokenizer;
    public class Proyecto {
         * @param args
         public static void main(String[] args) {
              String texto = null;
              int n = 0, t = 0;
              Tarea tareas[] = null, inicio = null, fin = null;
              try {
                   BufferedReader in = new BufferedReader(new InputStreamReader(
                             System.in));
                   texto = in.readLine();
                   n = Integer.parseInt(texto);
                   tareas = new Tarea[n];
                   inicio = new TareaInicio();
                   fin = new TareaFinal();
                   inicio.setNombre("Inicio");
                   inicio.setTiempo(0);
                   fin.setNombre("Fin");
                   fin.setTiempo(0);
                   for (int i = 0; i < n; i++) {
                        texto = in.readLine();
                        tareas[i] = new Tarea();
                        StringTokenizer st = new StringTokenizer(texto, ",");
                        String nombre, tipo, tiempo;
                        nombre = st.nextToken();
                        tipo = st.nextToken();
                        tareas.setNombre(nombre);
                        if (tipo.equals("F")) {
                             tiempo = st.nextToken();
                             tareas[i].setTiempo(Integer.parseInt(tiempo));
                        } else if (tipo.equals("A") || tipo.equals("P")) {
                             tareas[i].setTiempo(0);
                   texto = in.readLine();
                   t = Integer.parseInt(texto);
                   for (int i = 0; i < t; i++) {
                        String org, des;
                        Tarea torg = null, tdes = null;
                        texto = in.readLine();
                        StringTokenizer st = new StringTokenizer(texto, ",");
                        org = st.nextToken();
                        des = st.nextToken();
                        if (org.equals(inicio.getNombre())) {
                             torg = inicio;
                        } else {
                             for (int j = 0; j < n; j++) {
                                  if (org.equals(tareas[j].getNombre())) {
                                       torg = tareas[j];
                                       break;
                        if (des.equals(fin.getNombre())) {
                             tdes = fin;
                        } else {
                             for (int j = 0; j < n; j++) {
                                  if (des.equals(tareas[j].getNombre())) {
                                       tdes = tareas[j];
                                       break;
                        if (torg == null || tdes == null) {
                        torg.addConcecuente(tdes);
                        tdes.addAntecedente(torg);
              } catch (IOException e) {
                   System.out.println("Error en entrada de datos");
              fin.terminacionRapida();
              inicio.inicioTardio();
              System.out.print("Ruta Critica: Inicio, ");
              for (int i = 0; i < n; i++) {
                   if (tareas[i].isCritico()) {
                        System.out.print(tareas[i].getNombre() + ", ");
              System.out.print(" Fin\n");
              System.out.println("Tiempo: " + fin.inicioTardio());
              System.out.println(inicio.getNombre() + " holgura: "
                        + inicio.getHolgura());
              for (int i = 0; i < n; i++) {
                   System.out.println(tareas[i].getNombre() + " holgura: "
                             + tareas[i].getHolgura());
              System.out.println(fin.getNombre() + " holgura: " + fin.getHolgura());
    import java.util.ArrayList;
    public class Tarea {
         private String nombre;
         private int tiempo;
         private int holgura;
         private ArrayList antecedentes;
         private ArrayList consecuentes;
         private int iniciomasrapido;
         private int terminacionmasrapida;
         private int iniciomastarde;
         private int terminaciontarde;
         Tarea(){
              this.antecedentes = new ArrayList();
              this.consecuentes = new ArrayList();
         void setNombre(String nombre){
              this.nombre=nombre;
         void setTiempo(int tiempo){
              this.tiempo=tiempo;          
         public String getNombre() {
              return nombre;
         public int getTiempo() {
              return tiempo;
         public int terminacionRapida(){
              this.iniciomasrapido=0;
              for (int i = 0; i < antecedentes.size(); i++) {               
                   if(((Tarea)antecedentes.get(i)).terminacionRapida()>this.iniciomasrapido){
                        this.iniciomasrapido=((Tarea)antecedentes.get(i)).terminacionRapida();                    
              this.terminacionmasrapida=this.iniciomasrapido+this.tiempo;
              return (this.terminacionmasrapida);
         public int inicioTardio(){
              this.terminaciontarde=999999;
              for (int i = 0; i < consecuentes.size(); i++) {
                   if(((Tarea)consecuentes.get(i)).inicioTardio()<this.terminaciontarde){
                        this.terminaciontarde=((Tarea)consecuentes.get(i)).inicioTardio();                    
              this.iniciomastarde=this.terminaciontarde-this.tiempo;
              return (this.iniciomastarde);
         int getHolgura(){
              this.holgura=this.iniciomastarde-this.iniciomasrapido;
              return this.holgura;
         @SuppressWarnings("unchecked")
         public void addAntecedente(Tarea t){
              this.antecedentes.add(t);
         @SuppressWarnings("unchecked")
         public void addConcecuente(Tarea t){
              this.consecuentes.add(t);          
         boolean isCritico(){
              return (this.getHolgura()==0);          
    public class TareaFinal extends Tarea {
         public int inicioTardio(){
              return this.terminacionRapida();          
         public int getHolgura(){
              return 0;          
    public class TareaInicio extends Tarea {
         public int terminacionRapida(){
              return 0;
         public int getHolgura(){
              return 0;          

    Here is your code in code tags
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package proyecto;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintStream;
    import java.util.StringTokenizer;
    public class Proyecto {
        private static int i;
         * @param args the command line arguments
        public static void main(String[] args) {
            String texto = null;
    int n = 0, t = 0;
    Tarea tareas[] = null, inicio = null, fin = null;
    try {
    BufferedReader in = new BufferedReader(new InputStreamReader(
    System.in));
    texto = in.readLine();
    n = Integer.parseInt(texto);
    tareas = new Tarea[n];
    inicio = new TareaInicio();
    fin = new TareaFinal();
    inicio.setNombre("Inicio");
    inicio.setTiempo(0);
    fin.setNombre("Fin");
    fin.setTiempo(0);
    for (int i = 0; i < n; i++) {
    texto = in.readLine();
    tareas[i] = new Tarea();
    StringTokenizer st = new StringTokenizer(texto, ",");
    String nombre, tipo, tiempo;
    nombre = st.nextToken();
    tipo = st.nextToken();
    tareas.setNombre(nombre);
    if (tipo.equals("F")) {
    tiempo = st.nextToken();
    tareas[i].setTiempo(Integer.parseInt(tiempo));
    } else if (tipo.equals("A") || tipo.equals("P")) {
    tareas[i].setTiempo(0);
    texto = in.readLine();
    t = Integer.parseInt(texto);
    for (int i = 0; i < t; i++) {
    String org, des;
    Tarea torg = null, tdes = null;
    texto = in.readLine();
    StringTokenizer st = new StringTokenizer(texto, ",");
    org = st.nextToken();
    des = st.nextToken();
    if (org.equals(inicio.getNombre())) {
    torg = inicio;
    } else {
    for (int j = 0; j < n; j++) {
    if (org.equals(tareas[j].getNombre())) {
    torg = tareas[j];
    break;
    if (des.equals(fin.getNombre())) {
    tdes = fin;
    } else {
    for (int j = 0; j < n; j++) {
    if (des.equals(tareas[j].getNombre())) {
    tdes = tareas[j];
    break;
    if (torg == null || tdes == null) {
    torg.addConcecuente(tdes);
    tdes.addAntecedente(torg);
    } catch (IOException e) {
    System.out.println("Error en entrada de datos");
    fin.terminacionRapida();
    inicio.inicioTardio();
    System.out.print("Ruta Critica: Inicio, ");
    for (int i = 0; i < n; i++) {
    if (tareas[i].isCritico()) {
    PrintStream printf = System.out.printf(tareas[i].getNombre(), ", ");
    System.out.print(" Fin\n");
    System.out.printf("Tiempo: ", fin.inicioTardio());
    System.out.printf(inicio.getNombre()+ " holgura: ", inicio.getHolgura());
    System.out.printf(tareas[i].getNombre()+ " holgura: ", tareas[i].getHolgura());
    System.out.printf(fin.getNombre()+ " holgura: ", fin.getHolgura());
    }the a another class /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package proyecto;
    import java.util.ArrayList;
    * @author Kenneth Rinderhagen
    class Tarea {
    private String nombre;
    private int tiempo;
    private int holgura;
    private ArrayList antecedentes;
    private ArrayList consecuentes;
    private int iniciomasrapido;
    private int terminacionmasrapida;
    private int iniciomastarde;
    private int terminaciontarde;
    Tarea(){
    this.antecedentes = new ArrayList();
    this.consecuentes = new ArrayList();
    void setNombre(String nombre){
    this.nombre=nombre;
    void setTiempo(int tiempo){
    this.tiempo=tiempo;
    public String getNombre() {
    return nombre;
    public int getTiempo() {
    return tiempo;
    public int terminacionRapida(){
    this.iniciomasrapido=0;
    for (int i = 0; i < antecedentes.size(); i++) {
    if(((Tarea)antecedentes.get(i)).terminacionRapida()>this.iniciomasrapido){
    this.iniciomasrapido=((Tarea)antecedentes.get(i)).terminacionRapida();
    this.terminacionmasrapida=this.iniciomasrapido+this.tiempo;
    return (this.terminacionmasrapida);
    public int inicioTardio(){
    this.terminaciontarde=999999;
    for (int i = 0; i < consecuentes.size(); i++) {
    if(((Tarea)consecuentes.get(i)).inicioTardio()<this.terminaciontarde){
    this.terminaciontarde=((Tarea)consecuentes.get(i)).inicioTardio();
    this.iniciomastarde=this.terminaciontarde-this.tiempo;
    return (this.iniciomastarde);
    int getHolgura(){
    this.holgura=this.iniciomastarde-this.iniciomasrapido;
    return this.holgura;
    @SuppressWarnings("unchecked")
    public void addAntecedente(Tarea t){
    this.antecedentes.add(t);
    @SuppressWarnings("unchecked")
    public void addConcecuente(Tarea t){
    this.consecuentes.add(t);
    boolean isCritico(){
    return (this.getHolgura()==0);
    then another class /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package proyecto;
    * @author Kenneth Rinderhagen
    public class TareaInicio extends Tarea {
    public int terminacionRapida(){
    return 0;
    public int getHolgura(){
    return 0;
    }and then  the tereaFinal class/*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package proyecto;
    * @author Kenneth Rinderhagen
    public class TareaFinal extends Tarea {
    public int inicioTardio(){
    return this.terminacionRapida();
    public int getHolgura(){
    return 0;

  • My current idea for having two synchronized libraries...will this work?

    I want to be able to have identical iPhoto libraries on my iMac and MacBook.. I understand that they can't be synchronized in the traditional way as other documents.
    My current idea is to move the library to an external drive. This would allow me to operate iPhotos off either computer in the house. But I would also (manually, I guess) then occasionally recopy the external library back onto each machine. (Essentially creating a backup of the library on the computer itself.)
    The iMac backup wouldn't need to be used. But the MacBook backup could be accessed when I left the house. Obviously, I then would have transfer the laptop changes to the external drive when I got back home.
    Seems cumbersome, but is there any better way to accomplish what I want? (Two computers. Identical iPhoto library. Ability to leave the house with the laptop.)

    Yes. I ran a test library from my G5 and MacBook Pro. Changes made by one computer was picked up by the other. Even though Dropbox states that if both change a document at the same time it the person who saves first will "win" and the other's document will be includes as a separate file so the user can decide. That might be OK for a Word document but for a library it could get messy. Primarily since the size limit on the free Dropbox is 2GB getting a second library would most assuredly run you over the limit and it would not be saved.
    The safest scenario is just allow one user at a time. I've contacted the developer regarding the 2 GB limit and the upgrade path. Currently there's only a 50GB upgrade at $99/yr. Both are too high in my opinion. I've suggested they consider a "family pack" of some type and with a sliding scale of upgrades, 5, 10, 15, 20, etc., with a similar scale for price.
    I'll add you to the library and you'll get an email from Dropbox. Just download and install, go to the DB web site and accept. It will immediately put the library (4 pictures) in your dropbox and we can test it out. The invite is on it's way.
    OT

  • TRIED THis CODE for TO FIND THE FIBONACCI USING THREAD ,BUT SHOWING ERROR FOR FOLLOWING CODE  fib = fib(k+1);

    showing following error in line 34
    error: cannot find symbol
    fib = fib(k+1);
           ^
      symbol:   method fib(int)
      location: class FibN
    1 error
    import java.util.*;
    class AsynchFunctionTest
    public static void main(String[]args)
    Scanner in = new Scanner(System.in);
    System.out.print("enter value for n");
    int n = in.nextInt();
    FibN t = new FibN(n);
    t.start();
    try
      t.join();
    catch(InterruptedException e){}
    System.out.println("Fib("+n+") = "+ t.getResult());
    class FibN extends Thread
    private int n;
      private long result;
    public FibN(int nn)
      n = nn;
      public void run()
    long fib = 1;
    int k = 0;
    while(k < n){
    fib = fib(k+1);
    k++;
    result = fib;
    public long getResult()
    return result;

    rinojoseph wrote:
    sorry for that this is the error i getting for that code
    error: cannot find symbol   line 34
    fib = fib(k+1);
           ^
      symbol:   method fib(int)
      location: class FibN
    1 error
    Process completed.
    sorry
    Hmm - well you declared 'fib' like this:
    >
    long fib = 1;
    >
    So how do you expect to call a 'long' as if it were a function?

  • Procedure for having two Y-Axis using scripts?

    Hi all
    I am planning to display two different channels on two differnt y-axis using VBscript....Like for example : i have two channels namely 1.Torque 2. Speed 3.Time, so i would like hav e this way, time on x-axis, speed on y-axis, And Torque on Y1-axis.......I would be very glad if some one could give me some example program or coding regarding this.....
    With regards
    Kenni

    Hi Kenni,
    The easiest way to do this is to prepare a REPORT layout and to use a script assign the channel which should be drawn (see attachment).
    To get the syntax to assign the channels please open the REPORT object (in your case the 2D axis system) and use CRTL-A. This copies the necessary commands to the clipboard and than you can paste it into your script (or use the teach-in mode than CTRL-A copies the commands directly into the script).
    Greetings
    Walter
    Attachments:
    Example1.zip ‏5 KB

  • Can someone explain the code for having the Accordion panels closed?

    I located the answer to my own question (how to get all the accordion panels to remain closed when the browser opens) but I still don't understand the answer. Can someone explain this?
    This feature is only supported when using variable height panels, so you must pass a false into the Accordion's constructor for the "useFixedPanelHeights" constructor options, and a -1 for the "defaultPanel" option:
    <script type="test/javascript">
    var acc1 = new Spry.Widget.Accordion ("Acc1", { useFixPanelHeights: false, defaultPanel: -1});
    </script>
    Angela

    GPDMTR25 wrote:
    I located the answer to my own question (how to get all the accordion panels to remain closed when the browser opens) but I still don't understand the answer. Can someone explain this?
    This feature is only supported when using variable height panels, so you must pass a false into the Accordion's constructor for the "useFixedPanelHeights" constructor options, and a -1 for the "defaultPanel" option:
    <script type="test/javascript">
    var acc1 = new Spry.Widget.Accordion ("Acc1", { useFixPanelHeights: false, defaultPanel: -1});
    </script>
    Angela
    Hi Angela,
    You are right, the only way it will work is by setting the fixed height to false. As for the for the default panel option, -1 is not a panel and if you had 3 panels we could have used the number 3 (panel1 = 0) or 99 or whatever as long as there is no panel with that number. If we had used the number 1 for instance, then the 2nd panel would be opened by default.
    Hope this helps.
    Ben

  • We are using this code for deleting messege but not working ,

    it is only wokring when i only assign value to sub1 variableassign
    <html>
    <body>
    <%@ page language="java" import="java.sql.*" %>
    <%
    String[] list=request.getParameterValues("list");
    // String list=request.getParameter("list");
    int i;
    String sub1;
    for(i=0;i<list.length;i++)
    try
    sub1=list;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:dsn1","","");
    Statement stmt=con.createStatement();
    stmt.execute("delete from mes where sub='"+sub1+"'");
    out.println(sub1);
    stmt.close();
    con.close();
    catch(Exception e)
    {out.println(e);}
    %>
    Click here
    </body>
    </html>

    How to iterate through an array:
    String[] array = getItSomehow();
    for (int i = 0; i < array.length; i++) {
    String item = array;
    // Do your thing with 'item'.
    }Or even better, if you're using at least Java
    1.5:String[] array = getItSomehow();
    for (String item : array) {
    // Do your thing with 'item'.
    ode]
    And I recommend you to connect only once, before the
    loop, to save time and to use PreparedStatement to
    avoid SQL injections. And don't forget to close at
    least the connection, otherwise you're leaking
    resources.it is not deleting any message from database but when i assign value as sub1="something"; then it is deleting but i dont understand why it is so please give me its solution

  • Please tell me whats wrong with this code for sendRedirect

    /**AckController.java**/
    import java.io.IOException;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    import java.sql.*;
    import java.util.*;
    * @version      1.0
    * @author
    public class AckController extends HttpServlet {
         * @see javax.servlet.http.HttpServlet#void (javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              System.out.println("in AckController.doGet():action: "+req.getParameter("action"));
              String viewName = "";
              viewName = "/TransportersLogin/jsp/dealerAck/DealerAddAck.jsp";
              req.setAttribute("temp","temp");
              System.out.println("1..in AckController.doGet():viewName: "+viewName);     
              resp.sendRedirect(viewName);
         * @see javax.servlet.http.HttpServlet#void (javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              doGet(req,resp);
    /*********end of servlet**********/
    /****DealerAddAck.jsp****/
    <%@ page session="true" language="java" %>
    <%@ page import="javax.servlet.*,javax.servlet.http.*,java.net.*"%>
    <%
    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>New Page 1</title>
    <link rel="stylesheet" href="/TransportersLogin/theme/stylesecure.css">
    <%
         out.println("in jsp");
         out.println("in jsp: temp value: "+(String)request.getAttribute("temp"));
    %>
    <script>
    function consolidate()
         alert("wait");
         //document.forms[0].action = "DealerConfirmAck.html";
         //document.forms[0].submit();
    </script>
    </head>
    <body>
    <form name="frmaddclaim">
      <table border="0" cellpadding="3" cellspacing="1" width="100%">
      </table>
      <table width="100%" border="0" cellspacing="1" cellpadding="3">
        <tr>
          <td class="TDHeader" height="18" colspan="2">Add Acknowledgement Receipt</td>
        </tr>
        <tr>
          <td class="TDcolorgreybold" height="18" align="left">
               Available Invoices
          </td>
        </tr>
      </table>
      <table width="100%" border="0" height="26" cellpadding="3" cellspacing="0">
        <tr>
          <td class="tdheader" colspan="2" height="22" align="right">
          <input type="button" value="Add Receipt" name="B3" onClick="javascript:consolidate();"></td>
        </tr>
      </table>
      <table width="100%" border="0" height="26" cellpadding="3" cellspacing="0" align="left">
        <tr>
          <td class="labeltextRed" height="18" align="left">Select an Invoice from the
          list and click "Add Receipt". </td>
        </tr>
      </table>
    </form>
    </body>
    </html>I am trying to set an attribute in the request object (attribute name is temp). But in the jsp it is not getting the value of the attribute. The request is not getting transferred. Please let me know what correction is needed.
    I have used RequestDispatcher as well but in that case the control doesnt go the jsp when i used sendRedirect the control goes only if there isnt any request.getattribute in the JSP page.
    Thanks
    Nikesh

    You can;t transfer the request object using response.sendRedirect;
    Use RequestDispatcher to transfer the request object into another page.
    For Example:
    RequestDispatcher dispatcher  = getServletContext().getRequestDispatcher(viewName);
                dispatcher.include(req, resp);

  • Could you please check this code

    Hi There,
    The scenario here is :
    I have written this piece of code but its not showing desired result .I think the problem is in the AVGRANGE.
    Please look into this and let me know if I am doing anything wrong.
    I need to accomplish this task ,if employee E1 & E2 are in Entity1 in Grade S in forecast1 and now in forecast 2 a new employee namely E3 has come in this new forecast and whether he belongs to same entity can be identified by a new account say "F",If "F" is present for that Employee in that particular entity means he belongs to that Entity .Then I need to calculate.
    "P" value for E3 for a month=Avg of "P" value for E1 & E2 in Entity1 in Grade S for that month.
    I think this code is calculating for invalid combination also.
    FIX (&CurrFctScenario,&CurrFctVersion,&CurrYear)
    FIX (&SeedCurrency)
    FIX(@descendatns("Entity"),@descendatns(GRADE),@Descendants(Employee)
    FIX (&CurrMonth:"MAY"
    , &SeedHSP
    "P"(
    IF ( "F"!=#Missing AND "P"==#Missing)
    @AVGRANGE(SKIPNONE,"P",@children(Employee)->@currmbr(Grade)->@currmbr(entity));
    ENDIF;
    ENDFIX
    ENDFIX
    One more thing as I am testing this code for say two three employees then its working fine but as I am uisng @children(Employee) then I am getting error message
    Error: 1012704 Dynamic Calc processor cannot lock more than [200] ESM blocks during the calculation, please increase CalcLockBlock setting and then retry(a small data cache setting could also cause this problem, please check the data cache size setting).
    Is there any other way of doing this calculation?
    Edited by: user10760185 on Jun 1, 2011 5:35 AM

    Thanks a lot Alp...
    Please find the logic of the calculation below:
    In forecast1,here E1=employee,S1=Grade,P1=Account member
    E1->S1->Entity1->P1= 100
    E2->S1->Entity1->P1=200
    In forecast2,E3,a new employee has come and if he/she belongs to S1 and Entity1 ,then the value should be
    If (E3->F!->@currmbr(grade)->@currmbr(entity)=#Missing AND P1==#Missing)
    E3->S1->Entity1->P1= (100+200)/2
    I will read the document and will check my cache settings.
    Edited by: user10760185 on Jun 1, 2011 11:36 PM

Maybe you are looking for

  • Mac Os X 10.6.8   Safari keeps freezing

    Safari freezes very often. It then tells me to either cancel or force reload. After I do the force reload all of my passwords for different websites are gone.             I only had the computer for one year, and I don't know how to fix this problem.

  • Solution: iTunes for Windows installation interrupted

    Hi everyone. From my experience... If you are running Windows XP Professional and have updated to Service Pack 2, you will not be able to install iTunes+QuickTime. You will need to un-install Service Pack 2 and then install iTunes+QuickTime. You can

  • How to get the channel info of the image

    I insert an image into the view. I want to get the channel info of it, how to get it?

  • ITunes reinstall question on a new HDD.

    Ok, this may be a bit different...I have not located an answer on the boards to solve this. I installed a new HDD due to several persistent issues even after restoring from Time Machine more than once. I figured the issue was imbedded in my OS that l

  • Why doesn't Wi-Fi turn OFF when USB Ethernet is connected?

    When I get into the office, I connect my MacBook Air (2011/Lion) via USB Ethernet (we have Wi-Fi too). When connected through USB Ethernet, my Wi-Fi stays connected as well. Is it possible to have Wi-Fi turn off automatically when connected via USB E