Modeling integer ranges

I would really appreciate some input on what will probably seem a very academic exercise but will have very practical value to me. I have abstracted the problem to simplify it. My goal is to use SQL modeling to list integers in a range where only the range endpoints are given. For example, let's say a table has these three rows:
STARTING, ENDING
100,115
200,210
300,305
I see the following output using MODEL:
101,102,103,104,105,106,107,108,109,110,111,112,113,114
201,202,203,204,205,206,207,208,209
301,302,303,304
(I don't care whether the output is in the form of a delimited list or records with single values.)
I'm quite familiar with how to model integers in a range with endpoints defined in the SQL, but not when the endpoints come from a table.
The solution needs to handle endpoints coming from a table rather than hard-coded in the SQL.
I am open to non-modeling solutions, but prefer MODEL, and would prefer not to use PLSQL for the purpose I have.
Thanks for your help!

ltps wrote:
(I don't care whether the output is in the form of a delimited list or records with single values.)Records with single values:
select  starting,
        ending,
        num
  from  tbl1
  model
    partition by(rowid rid)
    dimension by(1 d)
    measures(starting,ending,starting num)
    rules
      num[for d from 2 to ending[1] - starting[1] + 1 increment 1] = starting[1] + cv(d) - 1
order by num
  STARTING     ENDING        NUM
       100        115        100
                             101
                             102
                             103
                             104
                             105
                             106
                             107
                             108
                             109
                             110
  STARTING     ENDING        NUM
                             111
                             112
                             113
                             114
                             115
       200        210        200
                             201
                             202
                             203
                             204
                             205
  STARTING     ENDING        NUM
                             206
                             207
                             208
                             209
                             210
       300        305        300
                             301
                             302
                             303
                             304
                             305
33 rows selected.
SQL> SY.

Similar Messages

  • Returning a range of integer in sql

    Dear all,
    I would like ask if there is any query method that can return a dump set of integer range. E.g. if there is any query that can return a range of number from 1 to 10, each of them as a row using any dummy table?
    Thank you!

    And of course you can extend this to any range:
    select * from
    select level lvl
    from dual
    connect by level <= &to_num
    where lvl >= &from_num
    /

  • Is there a way to boost range of the WRT610N?

    Good evening,
    I purchased the WRT610N a few months ago, and until now, it has worked just fine, and I had no problems with the range.
    But,
    I moved to a new house, which apparently has thicker walls :/ and the signal is very very poor now, and I have no idea how to fix it...
    Now i know this model has range issues, and now i can really see it :/
    It is impossible to run a cable to fix it, as well, its a rather large house, and well, the whole point of getting it was to go..wireless, ya know?
    I was reading around, and, could a bridge or a repeater be the solution? If so, how does that work, and could someone suggest a good one that doesn't have too much trouble working with the router...
    I am anxiously awaiting your reply, as i have a 124Mb connection now thats running on less than 12 with this range :/ I'm not expecting full speed of course, but i would be happy with it even reaching it halfway xD
    Thanks!

    Try changing the wireless channel on the router and see if that makes any difference in wireless signal strength.
    You can try using the combination of wireless bridge ( WET610N ) and wireless access point ( WAP610N ) to expand the range of wireless signal.
    Or you can also try using Wireless access point WAP4410N which has a repeater mode.

  • Integer Validation Simple Type

    Hi to all
    we have requirement that the value entered should be with in the range 0 to 9999
    For this in webdynpro for java i tried to create a simple type of integer  with minimum inclusive as 0 and maximum inclusive as 9999
    but if we give say 99999 it gives valid message -- Value 99999 must be smaller than MaxExclusive 9999
    if we give  23423423423423423423 it gives the java message integer range should be with in this range -2147483648 and  +21...)
    if we give decimal values it gives the same java message integer range should be with in this range
    2147483648 and  +21...)
    For me
    i should always be able to get this message Value 99999 must be smaller than MaxExclusive 9999 or
    Value -1 must be greater than or the same as Minclusive 0
    irrespective of the input
    is there any way that i can have this kind of message
    to conclude what ever the input i give it should give me message value should be with in the range 0 to 9999
    could some one please help in this tricky requirement
    Thanks in advance
    Regards
    Chandra

    Saleem, the user is entering a numeric value, question is which data type it is, int/float/long/double
    Chandra,
    Value 1.1 is not an integer value or a long value. The data type is float.
    when you converted it in a string, look for the indexof(.), and check the value of string after (.), it should not be greater than 0. If it is, the entered number is not an integer.
    so it goes like this
    string a = substring( string after " ." ) ;
    int i = int value of a ;
    if ( i > 0 ) "please enter an integer value " ;
    else{ conver to lang and do remaining process }
    Regards,
    Nitin
    Edited by: Nitin Mahajan on Jun 19, 2009 12:16 AM

  • A thought on looping over ranges

    I've had the following idea about iterating in java. I haven't found it being proposed anywhere else, so I thought I'd open a thread on it, see what people think.
    One of my favorite recent additions to Java is the for each construct. In fact, I like it so much, that now the old fashioned for loops I use to iterate over a range of numbers look and feel very cumbersome. It should be possible to use the fore each loop for iterating over a range of numbers as well. For instance, where you would normally type:
    for(int i = 0; i < 100; i++) {}You might type something like this:
    for(int i : Integer.range(100) ) {}Integer.range() returns a List<Integer>. The range method could be overloaded to allow specification of the starting integer and the step size. Similar constructs are possible for the other number classes.
    Of course the returned object would be a special lightweight list or collection that doesn't need to store anything else than these three values, so the memory use would be negligible in most situations. In cases where speed is very important, the old construct could be used again (similar to the choice between using arrays or collections).
    I'm curious about the following things:
    - Has this sort of thing been proposed before? Any serious drawbacks that I haven't thought of?
    - Is there a (better) place to suggest things like these informally? Getting involved with the JCP seems like a big step for something a simple as this.

    Well, java is pretty consistent in declaring ranges from an inclusive index to an exclusive index, so that could be expected here as well (which is how python does it too). There may be non-obvious aspects, but the original for loop has that too.
    I remember when I just started programming, I had to write for-loops very carefully to make sure I was getting it right, because the second statement must be read as a while statement rather than an until statement, which is something that isn't explicit in the original syntax. The only reason it's second nature to me now, is that I've written it so often. That would happen far more quickly with the range syntax.
    Also, I'm not necessarily arguing that the range syntax is less verbose (it really only is at the price of a static import), but that it is clearer. It reads closer to the intent of (most) for loops. Your first thought when you write a for loop is the range of numbers you want to iterate over, not the combination of two statements and a boolean that would cause a specific loop syntax to assign a specific variable the required values in succession. I'm fairly sure that for beginning programmers, the range syntax is less bug prone. The three expression for syntax only seems logical because we're so used to it.
    (I realize the point is academic since Josh Bloch has already commented that he doesn't see the use, and in this type of implementation the benefits wouldn't outweigh the performance cost, but it's an interesting discussion nevertheless).

  • [Solve]Compile Ada code with integer_IO ,error integer.ads not found.

    Hello all again.
    I do some programming in Ada and i am very fascinated this language.
    I got problem when using integer_IO in my code.
    When it compiling I got strange error integer.ads not found.
    BTW.My compiler is GNAT 4.4.1.
    Thanks for help.
    Last edited by SpeedVin (2010-03-01 17:30:56)

    drcouzelis wrote:
    I also think Ada is fascinating. I wrote a small video game in Ada and I use Ada a little at work.
    "integer_IO" and "Integer_IO" doesn't matter, because Ada is case insensitive.
    I'm not home right now, but I think "Integer_IO" is a subpackage of "Text_IO":
    with Ada.Text_IO.Integer_IO;
    If you want, you can post your code and I'll see if I can compile it.
    Are you an Ada beginner? Even though I have been working with Ada for more than a year now, I still don't think I'm very good at it. I wish there was more documentation and more projects used Ada.
    Yes I'm new  into this language.
    I really won to that there will be more project's/program's written in ADA.
    This is my program code:
    With Text_IO;
    Use Text_IO;
    With Ada.Text_IO.Integer_IO;
    procedure file is
    Age :integer range 0..100;
    begin
    if Age < 18 then
    put_line("BABY!!!");
    else
    put_line("OLD MAN!!!");
    end if;
    end;
    When I try to compile it I get error:
    file.adb:3:17: "Integer_IO" is a nested package, not a compilation unit

  • Can anyone figure out why this runs into an infinite loop?

    Hi,
    I have the following class, and if i run it, I encounter an infinite loop. I have pinpointed the problem and it is because of the lines:
    try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            catch (Exception exp) {
                   System.err.println("Failed");
                exp.printStackTrace();
            }Here is the class. Any and all help is greatly appreciated. Thanks!
    package org.aemf.clinical.tol.gui.printing;
    import org.aemf.clinical.tol.model.TOLBion;
    import org.aemf.clinical.tol.model.Range;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.*;
    import java.awt.print.*;
    import java.awt.*;
    import java.util.Iterator;
    import java.util.ArrayList;
    * Created by IntelliJ IDEA.
    * User: arashn
    * Date: Feb 9, 2005
    * Time: 1:26:38 PM
    public class printTableTest implements Printable, Pageable {
         private PageFormat pf;
         private String[] headers = { "Heading 1", "Heading 2", "Heading 3"};
         private java.util.List bions = null;
         private ArrayList<Object[][]> data = new ArrayList<Object[][]>();
         public printTableTest(PageFormat format) {
              this.pf = format;
         public int getNumberOfPages() {
            return 1;
        public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException {
            return pf;
         public void setBions(java.util.List b) {
              bions = b;
              for(int x=0; x < 3; x++) {
                   //TOLBion bion = (TOLBion) bions.get(x);
                   int ndx = 0;
                   //Object[][] tempData = new Object[bion.getNumRanges()][3];
                   Object[][] tempData = new Object[2][3];
              //     for (Iterator itr = bion.getRanges(); ndx < 2 && itr.hasNext(); ) {
                   for (; ndx < 2 ; ) {
                   // Range range = (Range)itr.next();
                        //tempData[ndx] = new Object[] { new Integer(range.getFrequency()), range.getLowerBound(), range.getUpperBound() };
                        tempData[ndx] = new Object[] { "col 1: " + x, "col 2: " + x, "col 3: " + x };
                        ndx++;
                   data.add(tempData);
        public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException {
            return this;
         public int print(Graphics g, PageFormat format, int pageIndex) throws PrinterException {
              if(pageIndex > 1) {
                   return Printable.NO_SUCH_PAGE;
                                                                              System.err.println("Page: " + pageIndex);
              JFrame frame = null;
              JTable tableView = null;
              Graphics2D g2 = (Graphics2D) g;
              //Object[][] data = new Object[3][3];
              g2.setColor(Color.black);
              g2.translate(format.getImageableX() + 72, format.getImageableY() + 72);
              for(int x=0; x < data.size(); x++) {
                   tableView = new JTable(new PrintTableModel(headers, data.get(x)));
                   frame = new JFrame();
                   JScrollPane scrollpane = new JScrollPane(tableView);
                   scrollpane.setPreferredSize(new Dimension(300, 80));
                   frame.getContentPane().setLayout(new BorderLayout());
                   frame.getContentPane().add(BorderLayout.CENTER,scrollpane);
                   frame.pack();
                   tableView.paint(g2);
                   g2.translate(0, - tableView.getTableHeader().getHeight());
                   tableView.getTableHeader().paint(g2);
                   g2.translate(0, format.getImageableHeight()/3);
              return Printable.PAGE_EXISTS;
         public static void main(String args[]) {
              PrinterJob printerJob = PrinterJob.getPrinterJob();
              try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            catch (Exception exp) {
                   System.err.println("Failed");
                exp.printStackTrace();
             int INCH = 72;
              double LETTER_WIDTH = 8.5 * INCH;
              double LETTER_HEIGHT = 11 * INCH;
            Paper paper = new Paper();
              int margin = INCH/6; // << set your margins here
              double pageWidth = LETTER_WIDTH - 2 * margin;
              double pageHeigth = LETTER_HEIGHT - 2 * margin;
              paper.setImageableArea(margin, margin, pageWidth, pageHeigth) ;
              PageFormat format = printerJob.defaultPage();
              format.setPaper(paper);
            printTableTest pp = new printTableTest(format);
            pp.setBions(new ArrayList());
              printerJob.setPageable(pp);
              boolean doPrint = printerJob.printDialog();
              if (doPrint) {
                   try {
                        printerJob.print();
                   } catch (PrinterException exception) {
                        System.err.println("Printing error: " + exception);
             System.exit(0);
         private class PrintTableModel extends AbstractTableModel {
              private Object[][] data = null;
              private String[] headers = null;
              public PrintTableModel(String[] headers, Object[][] data) {
                   this.headers = headers;
                   this.data = data;
              public int getColumnCount() { return headers.length; }
              public int getRowCount() { return data.length; }
              public Object getValueAt(int row, int col) { return data[row][col]; }
              public String getColumnName(int column) { return headers[column]; }
              public Class getColumnClass(int col) { return getValueAt(0,col).getClass(); }
              public boolean isCellEditable(int row, int col) { return false; }
              public void setValueAt(Object aValue, int row, int column) { data[row][column] = aValue; }
    }

    I have managed to create an even simpler version which tries to print the same header 3 times. Again, if you remove the setLookAndFeel line, everything works out great.
    import javax.swing.table.*;
    import javax.swing.*;
    import java.awt.print.*;
    import java.awt.*;
    * Created by IntelliJ IDEA.
    * User: arashn
    * Date: Feb 9, 2005
    * Time: 1:26:38 PM
    public class printTableTest implements Printable, Pageable {
         private PageFormat pf;
         public printTableTest(PageFormat format) {
              this.pf = format;
         public int getNumberOfPages() {
            return 1;
        public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException {
            return pf;
        public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException {
            return this;
         public int print(Graphics g, PageFormat format, int pageIndex) throws PrinterException {
              if(pageIndex > 1) {
                   return Printable.NO_SUCH_PAGE;
              System.err.println("Printing Page: " + pageIndex);
              Graphics2D g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              g2.translate(format.getImageableX() + 72, format.getImageableY() + 72);
              DefaultTableColumnModel dtcm = new DefaultTableColumnModel();
              TableColumn tc = new TableColumn();
              tc.setHeaderValue("Heading 1");
              dtcm.addColumn(tc);
              tc.setHeaderValue("Heading 2");
              dtcm.addColumn(tc);
              tc.setHeaderValue("Heading 2");
              dtcm.addColumn(tc);
              JTableHeader tableHeader = new JTableHeader(dtcm);
              JScrollPane scrollpane2 = new JScrollPane(tableHeader);
              scrollpane2.setPreferredSize(new Dimension(300, 80));
              JFrame frame2 = new JFrame();
              frame2.getContentPane().add(BorderLayout.NORTH,scrollpane2);
              frame2.pack();
              for(int x=0; x < 3; x++) {                   
                   tableHeader.paint(g2);
                   g2.translate(0, format.getImageableHeight()/3);
              return Printable.PAGE_EXISTS;
         public static void main(String args[]) {
              PrinterJob printerJob = PrinterJob.getPrinterJob();
              try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            catch (Exception exp) {
                   System.err.println("Failed");
                exp.printStackTrace();
             int INCH = 72;
              double LETTER_WIDTH = 8.5 * INCH;
              double LETTER_HEIGHT = 11 * INCH;
            Paper paper = new Paper();
              int margin = INCH/6; // << set your margins here
              double pageWidth = LETTER_WIDTH - 2 * margin;
              double pageHeigth = LETTER_HEIGHT - 2 * margin;
              paper.setImageableArea(margin, margin, pageWidth, pageHeigth) ;
              PageFormat format = printerJob.defaultPage();
              format.setPaper(paper);
            printTableTest pp = new printTableTest(format);
              printerJob.setPageable(pp);
              boolean doPrint = printerJob.printDialog();
              if (doPrint) {
                   try {
                        printerJob.print();
                   } catch (PrinterException exception) {
                        System.err.println("Printing error: " + exception);
             System.exit(0);
    }

  • Still null . Uuuuh

    Hello!
    The following program gives null for Integer.getInteger(System property name) but on the other hand System.getProperty("os.name") (say) is giving the correct result. . Why null for Integer.getInteger(spn) instead of an Integer object.
    import java.util.Properties ;
    class IntegerMethods {
    public static void main(String args[]) {
      int  n1 = -1 , n2 = 500 ;  //Change and Check equivalent conversions.
      int ir = 8  ;              //ir = integer radix
      Integer  i1 = new Integer(n1);                
      Integer  i2 = new Integer(n2);
      Integer  is = new Integer("200");
      String sg = new String("10000000");   //Decode range -2147683648  ---   2147483647
      //Properties p = new Properties();
      System.out.println("Integer i1 = " + i1 + " i2 = "+i2+" Radix = "+ir+" radix can be set to values other than 2,8,10,16");
      System.out.println("Integer                            Integer.MIN_VALUE : " + Integer.MIN_VALUE);
      System.out.println("Integer                            Integer.MAX_VALUE : " + Integer.MAX_VALUE);
      System.out.println("Integer                                  i.hashCode(): " + i2.hashCode());
      System.out.println("Integer                            byte i.byteValue(): " + i1.byteValue());
      System.out.println("Integer                              int i.intValue(): " + i1.intValue());
      System.out.println("Integer                          short i.shortValue(): " + i1.shortValue());
      System.out.println("Integer                            long i.longValue(): " + i1.longValue());
      System.out.println("Integer                          float i.floatValue(): " + i1.floatValue());
      System.out.println("Integer                        double i.doubleValue(): " + i1.doubleValue());
      System.out.println("Integer                         boolean I1.equals(I2): " + i1.equals(i2));
      System.out.println("Integer                          int I1.compareTo(I2): " + i1.compareTo(i2));
      try {
      System.out.println("Integer                           int I1.compareTo(O): " + i1.compareTo(i2));
      System.out.println("Integer                      static Integer decode(s): " + Integer.decode(sg));    //Decodable Strings :See JDK1.4 Help
      System.out.println("Integer                        static int parseInt(s): " + Integer.parseInt(sg));
      System.out.println("Integer                      static int parseInt(s,"+ir+"): " + Integer.parseInt(sg,ir));
      System.out.println("Integer                     static Integer valueOf(s): " + Integer.valueOf(sg));
      System.out.println("Integer                   static Integer valueOf(s,"+ir+"): " + Integer.valueOf(sg,ir)); 
      }catch(ClassCastException e) {
       System.out.println("Exception Condition:" + e);
      }catch(NumberFormatException e) {
       System.out.println("Exception Condition:" + e);
      System.out.println("Integer                           String I.toString(): " + i1.toString());
      System.out.println("Integer                 static String I.toString("+ n2 + "): " + Integer.toString(n2));
      System.out.println("Integer               static String I.toString("+n2+","+ir+"): " + Integer.toString(n2,ir));
      System.out.println("Integer             static String toBinaryString("+ n2 + "): " + Integer.toBinaryString(n2));
      System.out.println("Integer              static String toOctalString("+ n2 + "): " + Integer.toOctalString(n2));
      System.out.println("Integer                static String toHexString("+ n2 + "): " + Integer.toHexString(n2));
      System.out.println("Integer        static Integer getInteger(Sys propName): " + Integer.getInteger("os.version"));
      System.out.println("Integer      static Integer getInteger(Sys propName,i): " + Integer.getInteger("os.version",n1));
      System.out.println("Integer      static Integer getInteger(Sys propName,I): " + Integer.getInteger("os.version",i1));
      System.out.println("Integer static Integer getInteger(sun.arch.data.model): " + Integer.getInteger("sun.arch.data.model"));
      System.out.println("Integer             static Integer getInteger(os.arch): " + Integer.getInteger("os.arch"));
      System.out.println("Integer             static Integer getInteger(os.name): " + Integer.getInteger("os.name"));  
      System.out.println("Integer          static Integer getInteger(os.version): " + Integer.getInteger("os.version"));
      System.out.println("Integer            static Integer getInteger(user.dir): " + Integer.getInteger("user.dir")); 
      System.out.println("Integer           static Integer getInteger(user.home): " + Integer.getInteger("user.home"));
      System.out.println("Integer           static Integer getInteger(user.name): " + Integer.getInteger("user.name"));  
      System.out.println("Integer           static Integer getInteger(java.home): " + Integer.getInteger("java.home")); 
      System.out.println("Integer         static Integer getInteger(java.vendor): " + Integer.getInteger("java.vendor"));
      System.out.println("Integer      static Integer getInteger(file.separator): " + Integer.getInteger("file.separator"));
      System.out.println("Integer      static Integer getInteger(path.separator): " + Integer.getInteger("path.separator"));
      System.out.println("Integer      static Integer getInteger(line.separator): " + Integer.getInteger("line.separator"));
      System.out.println("System         static Integer.getInteger(java.vm.name): " + Integer.getInteger("java.vm.name"));
      System.out.println("Integer     static Integer getInteger(java.vendor.url): " + Integer.getInteger("java.vendor.url"));
      System.out.println("Integer     static Integer getInteger(java.class.path): " + Integer.getInteger("java.class.path"));
      System.out.println("Integer  static Integer getInteger(java.class.version): " + Integer.getInteger("java.class.version"));
      System.out.println("System                     System.getProperty(os.name): " + System.getProperty("os.name"));
      System.out.println("System                     System.getProperty(os.arch): " + System.getProperty("os.arch"));
      System.out.println("System                  System.getProperty(os.version): " + System.getProperty("os.version"));
      System.out.println("System                   System.getProperty(user.name): " + System.getProperty("user.name"));
      System.out.println("System                    System.getProperty(user.dir): " + System.getProperty("user.dir"));
      System.out.println("System                   System.getProperty(user.home): " + System.getProperty("user.home"));
      System.out.println("System             System.getProperty(java.class.path): " + System.getProperty("java.class.path"));
      System.out.println("System          System.getProperty(java.class.version): " + System.getProperty("java.class.version"));
      System.out.println("System                   System.getProperty(java.home): " + System.getProperty("java.home"));
      System.out.println("System                System.getProperty(java.vm.name): " + System.getProperty("java.vm.name"));
      System.out.println("System              System.getProperty(java.vm.vendor): " + System.getProperty("java.vm.vendor"));
      System.out.println("System                 System.getProperty(java.vendor): " + System.getProperty("java.vendor"));
      System.out.println("System             System.getProperty(java.vendor.url): " + System.getProperty("java.vendor.url"));
      System.out.println("System                  System.setProperty(os.name,XP): " + System.setProperty("os.name","Windows XP"));
      System.out.println("System                     System.getProperty(os.name): " + System.getProperty("os.name"));
    }

    Thanks for reply to all of you.
    See the first line , giving an Integer value 32 for "sun.arch.data.model". Similarly I expect to get an Integer value for the rest of the properties that can easily be
    checked through
    System.getProperty(property name) ;
    class GetInteger {
    public static void main(String args[]) {
      System.out.println("Integer static Integer getInteger(sun.arch.data.model): " + Integer.getInteger("sun.arch.data.model"));
      System.out.println("Integer             static Integer getInteger(os.arch): " + Integer.getInteger("os.arch"));
      System.out.println("System                     System.getProperty(os.arch): " + System.getProperty("os.arch"));
      System.out.println("Integer             static Integer getInteger(os.name): " + Integer.getInteger("os.name"));
      System.out.println("System                     System.getProperty(os.name): " + System.getProperty("os.name"));
      System.out.println("Integer          static Integer getInteger(os.version): " + Integer.getInteger("os.version"));
      System.out.println("System                  System.getProperty(os.version): " + System.getProperty("os.version"));
      System.out.println("Integer           static Integer getInteger(java.home): " + Integer.getInteger("java.home")); 
      System.out.println("System                   System.getProperty(java.home): " + System.getProperty("java.home"));
    }

  • Not Printing the Content of Object:SOme Garbage Value on Screen

    i have made one program of Vehicle class which adds and prints the Details of Vehicles in the ArrayList but it always showa the Garbage Value in return.
    import java.util.*;
    import java.awt.*;
    import java.lang.*;
    import java.io.*;
    public class Vehicle
         private int reg_no;
         private String model_name;
         private int model_no;
         private int yr_manufacture;
         private String veh_type;
         private int price;
         private int weight;
         private String veh_status;
         public ArrayList vehicles;
         static BufferedReader keyboard = new BufferedReader (new InputStreamReader (System.in));
         public Vehicle()
              //super();          
              vehicles=new ArrayList(10);
         public Vehicle(int regno,String mo_name,int mo_no,int year_manu,String type_veh,int cost,int weight,String status)
         this.reg_no=regno;
         this.model_name=mo_name;
         this.model_no=mo_no;
         this.yr_manufacture=year_manu;      
         this.veh_type=type_veh;
         this.price=cost;
         this.weight=weight;
         this.veh_status=status;
         public void addVehicle() throws IOException
              int regno;
              String mo_name;
              int mo_no;
              int year_manu;
              String type_veh;
              int weight=0;
              int no_person;
              int cargo;
              int cost;
              String status;
              String confirm;
              int countvehicle=0;
              //start of do-while loop
              do {
                   System.out.print("Input the Vehicle Registration Number(Integer):");
                   regno=Integer.parseInt(keyboard.readLine().trim());
                   System.out.print("Input the Vehicle Make(String)eg. Mercedes,Ferrari,BMW etc: ");
                   mo_name=keyboard.readLine();
                   System.out.print("Input the Vehicle Model(Integer): ");
                   mo_no=Integer.parseInt(keyboard.readLine().trim());
                   System.out.print("Input the Vehicle Manufactured Year(Integer): ");
                   year_manu=Integer.parseInt(keyboard.readLine().trim());
                   System.out.print("Input the Vehicle Type:(CAR/BUS/TRUCK)");
                   type_veh=keyboard.readLine();
                   System.out.print("Where do u want this Vehicle to be Loaded:(Type F or I)?");
                   status =keyboard.readLine();
                        if(countvehicle>6 && status.equals("I"))
                        System.out.println("Sorry.........Ferry is Overloaded your Vehicle will be Loacally on the Island");
                        status="Island";
                        System.out.println("Vehicle in Island");
                        else
                             System.out.println("Vehicle loaded on to Ferry");
                             status="Ferry";
                   //decide the weight Factor for the Vehicle
                   if(type_veh.equals("CAR"))
                        weight=1500;                
                   else if(type_veh.equals("BUS"))      
                        System.out.print("Input the boarding No of Person in Bus: ");
                        no_person=Integer.parseInt(keyboard.readLine().trim());
                        weight=(10000+(no_person*75));// Assuming the weight of one Person is 75kg.
                   else if(type_veh.equals("TRUCK"))
                        System.out.print("Input the Truck Cargo Load: ");
                        cargo=Integer.parseInt(keyboard.readLine().trim());
                        weight=(4500+cargo);                
                   System.out.print("Input the Vehicle Price: ");
                   cost=Integer.parseInt(keyboard.readLine().trim());
                   Vehicle regVehicle= new Vehicle (regno,mo_name,mo_no,year_manu,type_veh,cost,weight,status);
                   vehicles.add(regVehicle);//Add to the Vector
                   regVehicle.printall();
                   //Saving the Added Object in File
                   /*try
                             FileOutputStream f_out = new FileOutputStream("Added.txt");                    
                             ObjectOutputStream obj_out = new ObjectOutputStream(f_out);
                             obj_out.writeObject(vehicles.add(regVehicle));
                        catch (FileNotFoundException e)
                             System.err.println("Error:"+ e.getMessage());
                        catch (IOException e)
                             System.err.println("Error:"+ e.getMessage());
                   countvehicle++;
                   System.out.print ("Add a new vehicle (y or n)? ");
                   System.out.flush();      
         confirm= keyboard.readLine();
                   } while (confirm.equals("y")); //end of do while loop
         public Vehicle getVehicle(int index) throws IOException
              return (Vehicle)vehicles.get(index);
         public int getRegNo() throws IOException
              return reg_no;               
         public Vehicle lookUpVehicle (int accnos)throws IOException
    //start of for loop
              for(int i=0;i<vehicles.size();i++)
              //checks if the information entered are correct using an if statement
              if((((Vehicle)vehicles.get(i)).getRegNo()) == accnos)
                   return ((Vehicle)vehicles.get(i));
    return null;
         public void printDetails()throws IOException
              System.out.println("--------Vehicle Details------------ ");
         for(int i=0;i<vehicles.size();i++)
              System.out.println(" " + getVehicle(i));           
         //System.out.println("\n\n");
         //return ((Vehicle)elements());*/
         /*Iterator it = vehicles.iterator();
              while (it.hasNext())
                   System.out.println(it.next());
         public void printall()
              System.out.println(reg_no);
              System.out.println(model_name);
              System.out.println(model_no);
              System.out.println(weight);
    }

    sohamdave wrote:
    what toString will contain in them.i didn't get you there.it is the whole data type-casted to String or only object type-casted to StringSimply return a String representation of the Vehicle object; frequently the String contains the member variable values, e.g.
    public String toString() {
       return model_name+" "+veh_type;
    }The List toString() method itself invokes your method when the List itself needs to be printed.
    kind regards,
    Jos

  • Output/Input Scale Factor

    I have a high resolution stage used for a scanning application.  I'm using a pci-7344 to control the stage.  The system is marginally stable with kp=1 and various values set for ki and kd.  I have found several posts with the same issue:
    http://forums.ni.com/t5/Motion-Control-and-Motor-Drives/tuning-servo-system/m-p/139507/highlight/tru...
    http://forums.ni.com/t5/Motion-Control-and-Motor-Drives/Is-there-any-way-to-drcease-the-open-loop-ga...
    http://forums.ni.com/t5/Motion-Control-and-Motor-Drives/MAX-Reducing-Encoder-Resolution/m-p/1030934/...
    http://forums.ni.com/t5/Motion-Control-and-Motor-Drives/7344-PID-proportional-gain-1-but-actuator-st...
    It is apparent that the gain needs to be set below one and the only current solutions (decrease encoder resolution or decreasing the output limits) are both unacceptable.  Encoders aren't free (and in my case extremely difficult to replace) and I want my stage to run as fast as possible.
    Many other modern controllers allow the input and/or the output of the PID loop to be scaled (even if it's only by factors of two for non floating point dsp's) for exactly this reason.  This allows one to arbitrarily place the optimal kp value within the allowable integer range (i.e. 1<kp<32768).  Is there a way to do this on ni controllers?  If not is there a propper place to request features?

    Unfortunately you can't scale the input or output of the PID loop. I am attaching two links below that discuss how to tune the servo motor and also where you can make product suggestions. I'm sorry I don't have better news for you, but please post your ideas to the idea exchange below so our developers can look at them. Thank you!
    A Simple Method for Servo Motor Tuning
    NI Idea Exchange
    Mychal F
    Applications Engineer
    National Instruments

  • What is the scope of Live Customer Support in the Software and IT Industry?

    The Software and IT Industry is growing at a pace of 9.0% per year, with employment at Software consultancy and service firms projected to grow making it the second best industry to start and grow a business. With this pace of growth in the ruthless world of online business, only companies which succeed in creating their own niche will survive and make it big.
    Surviving this kind of competition demands a change in business strategy to create a loyal customer base, i.e. a solid investment in repeat visitors. One tool that can bring about this change in business strategy is the use of Live Chat.
    A Live Chat Operator’s role is a Software and IT Company website can be from navigation help and customer service to expert consultancy and making direct sales. Behind all of these roles though, is the constant element of the human touch on a website. Chat with a Live Operator can create an experience for web visitors which will make them come back. This creation of repeat web visitors will create a loyal customer base. This industry particularly relies on customer loyalty, since in the computers and electronics category repeat visitors are nearly 16 times more likely to make a purchase than new visitors with conversion rates of 23.12 percent and 1.49 percent respectively.
    Apart from creating repeat visitors on Software Company’s website, Live Chat Operators can do the following:
    1.     Win loyalty by providing top level service on your online store
    2.     Provide real-time answers about models, year and price of the electronics or computers that visitors are looking for.
    3.     Show items; push pages and take visitors directly to the model/price range they are looking into.
    4.     Use three dimensional images to show products.
    5.     Generate leads.
    6.     Provide consultancy on items keeping in view customer needs and price range
    7.     Update visitors on Promotional Offers,
    8.     8. Improve Multitasking in Customer Service and Sales Staff.
    Live Chat is a medium which takes online customer service to an unparalleled level; the days of static web information and the email black hole are long gone.
    Source:
    http://www.liveadmins.com

    Hi Dkdinesh,
    Excelent links provide by M.R.AshwinPrabhu!
    In 2014, Microsoft will release BizTalk Server 2013 R2 (release date will be soon) and also will keep investing and improving Microsoft Azure BizTalk Services-
    Microsoft goal in terms of Release Cadence of BizTalk Server is to have one major release every alternate year (the last one was BizTalk Server 2013, so you may expect a new major release in 2015) and one minor release every alternate year (that will be
    designated R2, so the next on is BizTalk Server 2013 R2). The major release will have new features and themes and minor releases will have bug fixes, platform alignment and customer asks.
    Sandro Pereira
    DevScope | MVP & MCTS BizTalk Server 2010
    http://sandroaspbiztalkblog.wordpress.com/ |
    @sandro_asp
    Oporto BizTalk Innovation Day | 14th March 2013 – Oporto, Portugal
    Please mark as answered if this answers your question.

  • How to read data from a file

    I have a file that looks like this with out the *'s
    lastName firstName number
    lastName firstName number2
    lastName firstName number3
    lastname = (string) an actual last name like smith same for first name
    number = an actual number (int) like 90 or 120
    I need to read the number from this file and store it in an array. I have some code that I started, but im not sure what to do next. Please help!
    //int searchId;
         int fileData;
         vector <int> employeeIds;
         //cout<<"Enter Employee ID: ";
         //cin>>searchId;
         ifstream dataFile("Small-Database.txt");
         dataFile >> fileData;
         while(!dataFile.eof())
               //this is where i need help, how can i read in a number. i tried using the getLine() function but it did not help
              //employeeIds.push_back(fileData);
              //dataFile >> fileData;
         dataFile.close();Thank you for any help in advance

    The >> operator reads a value corresponding to the target type. For example, to read an integer value, read it into an int variable (or long or long long, depending on the integer range).
    The >> operator skips white space (blanks, tabs, newlines) and then reads characters corresponding to the target type: digits for an integer value, for example. It stops at the first character that cannot be in the representation of the type. If no characters are read, the stream goes into an error state, and further I/O requests are ignored until you clear the stream state.
    You can read each group of data like this:
    std::string first, last;
    int number;
    dataFile >> first >> last >> number;If the data doesn't have the right characteristics, the stream will go into an error state, which you can detect by testing the stream directly:
    if( dataFile ) ...Using EOF as the loop control is not a good idea, since if there is an error, the loop will never terminate. You can do something like this:
    while( dataFile ) {
        std::string first, last;
        int number;
        dataFile >> first >> last >> number;
        if( dataFile ) {
            // ... add first, last, number to the data structure
    } Reading past EOF puts the stream in an error state, so checking the stream state before saving the data and in the loop control will do the trick.
    You can use a char array instead of a string for the names, but then you have to add extra testing to be sure you don't overflow the array, and deal with the extra characters you don't read. Strings will expand as needed. The string is declared as a local variable in the loop, so it gets re-initialized each time through; you don't need to write code to reset it.
    My example loop is not robust in the face of errors. Stream I/O works fine when you know the input data is well-formed. It is not suited to input that can be wrong, such as data typed from the terminal, because it is not easy to validate the input and recover from errors.

  • Asus laptop will no longer connect wirelessly to HP printer

    My Asus laptop was connected to my HP PhotoSmart 7420 printer, wirelessly with no issues. In the last month, I upgraded my Comcast internet service to the fastest speed Comcast has available. In addition, I replaced my router ( Linksys Model: WRT1900AC) & range extender (NetGear Universal Dual Band Wi-Fi Range Extender, 4-port Wi-Fi Adapter). Every WiFi related item in my home works much better with the exception of the printer. On my laptop, I removed the HP printer and asked the laptop to search for it to re-install; the laptop indicates "no printers available"? Even my desktop PC sends error messages indicating that the "scan to computer" feature no longer works when, in fact, it does work?
    Help!

    Hi @TSimo,
    Welcome to the HP Forums!
    I wasn't able to find much on a Photosmart 7420, did you perhaps mean Photosmart 7520?
    If that is correct, this may just be a case of needing to reconnect the printer to the wireless network again due to the upgraded router and extender
    To do this, please restore the network defaults on the printer (press the wrench on the printer's touch screen, select Wireless, then select Restore Network Defaults, should be the last option) and once that completes go back to the same Wireless menu on the printer and run the Wireless Setup Wizard on the printer. This will update the connection on the printer itself.
    After this completes you will need to remove the driver and re-add it on the computer. How this is done depends on the operating system, so if you're not sure how to remove the driver and re-add it, please let me know which operating system you use and I will get you some instructions
    Hope to hear from you soon!
    Please click “Accept as Solution ” if you feel my post resolved your issue, as it will help others find the solution faster
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    **MissTeriLynn**
    I work on behalf of HP

  • Need help in this one please... java algorithm.

    i have an array of integers, how do i get the unique instances of the integers in that array and save it in another array.
    i.e.
    array of integers:
    parent = {8, 7, 6, 8, 7, 7, 7, 7};result:
    roots[0] = 8
    roots[1] = 7
    roots[2] = 6i already finished the part in countin the number of unique instances in the array.

    i have an array of integers, how do i get the unique
    instances of the integers in that array and save it
    in another array.The best solution probably is to us a HashSet as has been suggested but there's another way you may consider if the integer range is limited.
    Say the integers are from 0 to 999. Then you create a boolean array of size 1000. Initially all elements are false. Then you loop through the integer array and use the integers to set the corresponding elements in the boolean array to true. Finally you loop through the boolean array and check which integers were present in the integer array.
    The above is the most efficient solution in many cases. It can easily be modified to count the number of times each integer is present.

  • Fade Effect

    I have a code on my buttons, which makes a blank image
    currently on stage get replaced with a different one when a button
    is rolled over.
    The code I am using is this:
    on mouseenter me
    sprite(3).member="a"
    on mouseleave me
    sprite(3).member="blank"
    end
    Very simple lingo. Is there a way that when the new image
    comes to view, it fades in when the mouse rolls over the button,
    instead of just popping in, and fade out once the mouse leaves the
    button, so that I end up with a smooth transition.
    Thank you.

    Guys:
    Thanks for taking your time to help me with the issue.
    I actually got an answer from another member that solved my
    problem. The code that was posted here was making the button sprite
    do the fade effect.
    My friend did some tweaking to that code to achieve what I
    needed.
    Here is the code:
    property fadeSprite
    property totalSteps
    property eachStep
    property animateMe
    on getPropertyDescriptionList
    myPropList = [:]
    myPropList.addProp(#totalSteps,[#comment:"select the number
    of steps for the
    fade:",#format:#integer,#range:[#min:5,#max:20],#default:10])
    myPropList.addProp(#fadeSprite,[#comment:"enter the sprite
    to fade:",#format:#integer,#default:1])
    return myPropList
    end
    on beginSprite me
    sprite(fadeSprite).blend = 0
    animateMe = true
    eachStep = 100/totalSteps
    end
    on mouseEnter me
    animateMe = false
    end
    on mouseLeave me
    animateMe = true
    end
    on enterFrame me
    if animateMe then
    if sprite(fadeSprite).blend > 0 then
    sprite(fadeSprite).blend = sprite(fadeSprite).blend -
    eachStep
    end if
    else
    if sprite(fadeSprite).blend < 100 then
    sprite(fadeSprite).blend = sprite(fadeSprite).blend +
    eachStep
    end if
    end if
    end
    With this one, I am able to select which sprite is fading in
    and out. Again, thanks for your help.

Maybe you are looking for

  • Uneconomical to replace the logic board in 2009 Mac Air. Any comments please?

    I have a 2009 Mac Air which has been found to have a faultyskin sensor. I was advised that it would be uneconomical to replace the logic board. I would appreciate any comments.

  • Can't activate iphone after erasing it from Find my Iphone by error

    Hi, Earlier today I upgraded to IOs 7. Aftr that I erased the iphone from find my iphone (I have backup in the cloud). After turning on again, it requests: language, then country, then WiFi (no option for SIM code) and then it gives the message: "it

  • Album Artwork Nokia 5800

    Hi, I've just bought the Nokia 5800 Xpresmusic and I have a problem with transferring my album artwork along with my music. I used Bluetooth, and the music plays great - but the album artwork doesn't display despite being attached by iTunes. I was wo

  • Survey URL Missing MIG

    Dear Experts, We have a mail form with Survey URL, we tested it via TEST SEND functionality. However when we send the mail form in french we get MIG generated in the mail, but when we select dutch language while TEST SEND , there is no MIG and hence

  • Packaging a Java Application?

    Is there a quick and easy way to package a java program up into something (like an EXE file) and run, like a C program? Or does any user have to first compile and then run in the java Compiler?