Get objects out of Arraylist

Hi I have this code, below, The set methods in the class Website work just fine to get the data into the arraylist, but i just can't figure out the get methods to get the objects back out to compare. Could someone please help. i'm almost finished with this thing!!
Iterator itr1 = Websites1.iterator();
Iterator itr2 = Websites2.iterator();
outer: while (itr1.hasNext()) {
while (itr2.hasNext()) {
//Object site1 = new Object ();
//Object site2 = new Object ();
Object site1 = (Website)itr1.next();
content1 = site1.getCon();
date1 = site1.getMod();
Object site2 = (Website)itr2.next();
content2 = site2.getCon();
date2 = site2.getMod();
if (date1 != date2 ) {
if (content1 != content2)
alert.play();
//do other stuff//
else;
else;
continue outer;
class Website {
public String WebsiteName, WebsiteContent, Content;
public Date LastModified, Modified;
public Website() {
WebsiteName = "";
WebsiteContent = "";
LastModified = null;
public Website (String Name, String Content, Date Modified) {
WebsiteName = Name;
WebsiteContent = Content;
LastModified = Modified;
public void setName(String Name) {
WebsiteName = Name;
public void setContent(String Content) {
WebsiteContent = Content;
public void setModified(Date Modified) {
LastModified = Modified;
public String getCon() {
Content = WebsiteContent;
public Date getMod() {
Modified = LastModified;

I think that worked (duh i should have noticed it earlier), but now i'm getting a real weird error when i try to compile on my custom get methods
missing return statement
public String getCon() {//(points to this)
and the same thing on the public Date getMod() method
any ideas?
I'm lost now i've never seen that before

Similar Messages

  • Getting an Object out of ArrayList

    Hello, I have a question about getting an Object out of an ArrayList. I have an object that's made up of four fields: name, average, total and position. Now, I need to read in values from a formatted text file, and stick those values into an array (the values correspond to the Object values), but since there's a variable number of items in the text file, I figured I could just use an ArrayList to store the objects, and when it's finished looping through the file, just copy the ArrayList items into my object. I have it working fine, except I can't seem to get the data in the ArrayList copied over to the array.
    I guess my question is simple: how can I copy over the ArrayList of objects into my object?
    Thanks very much for any help! :)

    Thanks a lot, I got it! After spending two hours on this problem, two lines of code fixed it for me. :P
    @Petes1234: Well basically because the data that's being read can have a variable length, I wanted to use an ArrayList to hold it temporarily. After it's done reading I have the size, so I guess that I wanted to extract the object data into a regular array so that it can be formatted and displayed to the user.
    Message was edited by:
    mistah-java

  • Getting items out of arrayList

    Hi everyone
    I have the following scenario:
    Have two java class files which gets used to extract data from database and a jsp which display data.
    I get the data out of the database, but my problem is displaying it correctly using the jsp which uses JSTL.
    The ContactsData.class file extracts the data out of the database and puts it in the Contacts.class class which then gets written to an arraylist which stores the Contacts.class and then returns the ArrayList to the requester.
    Here is the code, can someone please help me to manipulate the arraylist to display the right info.
    Contacts.class which holds the contacts.
    package contacts;
    import java.io.Serializable;
    import java.util.*;
    public class Contacts implements Serializable
         //String varialbes to store the details about the contact
         private String contactName,company, workNumber, cellNumber, faxNumber, email,country;
         //contacts constructor
         public Contacts()
         //method to set the company
         public void setCompany(String company)
              this.company = company;
         //method to set the Contact name
         public void setContactName(String contactName)
              this.contactName = contactName;
         //method to set the work teletphone number
         public void setWorkNumber(String workNumber)
              this.workNumber = workNumber;
         //method to set the cellphone number
         public void setCellNumber(String cellNumber)
              this.cellNumber = cellNumber;
         //method to set the fax number
         public void setFaxNumber(String faxNumber)
              this.faxNumber = faxNumber;
         //method to set the email
         public void setEmail(String email)
              this.email = email;
         //method to set the country
         public void setCountry(String country)
              this.country = country;
         //method to get the company
         public String getCompany()
              return company;
         //method to get the contact name
         public String getContactName()
              return contactName;
         //method to get the work telephone number
         public String getWorkNumber()
              return workNumber;
         //method to get the cellphone number
         public String getCellNumber()
              return cellNumber;
         //method to get the fax number
         public String getFaxNumber()
              return faxNumber;
         //method to get the email
         public String getEmail()
              return email;
         //method to get the country
         public String getCountry()
              return country;
    }piece of the contactsData.class class which retrieves the data out of the database and stores it in Contacts.class class and then store the Contacts class in the arrayList which gets returned to the requester.
         public ArrayList getContactList()
              //arrayList to hold the contacts
              contactList = new ArrayList<Contacts>();
              try
                   ResultSet rs = stmt.executeQuery("SELECT * FROM Contacts");     //selecting from the database
                   while(rs.next())
                        //creating contacts object
                        contact = new Contacts();
                        //adding details to the Contacts object
                        contact.setContactName(rs.getString(1));
                        contact.setCompany(rs.getString(2));
                        contact.setWorkNumber(rs.getString(3));
                        contact.setCellNumber(rs.getString(4));
                        contact.setFaxNumber(rs.getString(5));
                        contact.setEmail(rs.getString(6));
                        contact.setCountry(rs.getString(7));
                        //adding Contacts object to the Arraylist
                        contactList.add(contact);
              catch(SQLException se)
                   System.out.println("Could not retrieve contacts");
              return contactList;     //returning the arraylist
         }The jsp that need to display the contacts within the arraylist, which I don't get right.
    <?xml version="1.0"?>
    <%@ page import="contacts.Contacts"%>
    <%@ page import="java.util.*"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <jsp:useBean id = "contactsData" scope = "page" class ="contacts.ContactsData"/>
    <html>
         <head>
              <title>Contact List</title>
              <meta http-equiv="cache-control" content="max-age=0, must-revalidate, no-cache, no-store, private">
              <meta http-equiv="expires" content="-1">
              <meta http-equiv="pragma" content="no-cache">
              <script language=JavaScript>
              <!--
                   function clicked(clickedValue)
                        if(clickedValue == "add")
                             window.location = "AddContact.jsp";
              -->
              </script>
         </head>
              <body>
              <h1>Contacts</h1>
              <form>
                   <table cellpadding="5">
                   <c:forEach var="contacts" items="${contactsData.contactList}"> //getting the list from the ContactData class
                        <tr>
                        <td><input type="radio" name="deleteContact" value="${contacts.company}"></td> //want to display the company name from the contacts
                        </tr>
                   </c:forEach>
                   </table>
                        <br>
                        <input type="button" value="Add" onClick="clicked('add')"/>
                        <input type="submit" value="Delete" onClick="clicked('del')"/>
              </form>
         </body>
    </html>

    HI, we need to specify the scope we used,In my Ex its request
    so my forEach tag ..
    <c:forEach var="stud" items="${requestScope.studli}">
    <c:out value="${stud.SID}"></c:out>
    <c:out value="${stud.SNAME}"></c:out>
    </c:forEach>

  • Get Object[] length in ArrayList

    How do I get the size of the Object[] in ArrayList?
    Not ArrayList.size() which returns how many Elements
    are in the List.

    You could use reflection if you really wanted to know
    how much memory you have "wasted".
    KajHere's a stupid class to do just that.
    Thanks.
    import java.util.*;
    import java.lang.reflect.*;
    public class Test{
    public static void main(String[] args){
         new Test();
    public Test(){
         List list = new ArrayList(1);
         double capacity = 0;
         double size = 0;
         Random rand = new Random();
         int iter = rand.nextInt(100);
         System.out.println("Iter: " + iter);
         for(int i = 0; i < iter; i++){
         int rn = rand.nextInt(10);
         Integer integer = new Integer(rn);
         list.add(integer);
         size = list.size();
         System.out.println("List Size: " + size);
         try{
         Class al = list.getClass();
         // Get Declared Fields
         System.out.println("\nGet Declared Fields");
         Field[] fields1 = al.getDeclaredFields();
         for(int i = 0; i < fields1.length; i++){
         System.out.println("Field: " + fields1.getName());
         // Get Fields
         System.out.println("\nGet Fields");
         Field[] fields2 = al.getFields();
         for(int i = 0; i < fields2.length; i++){
         System.out.println("Field: " + fields2[i].getName());
         // Get Field
         System.out.println("\nGet Field");
         //Field field = al.getField("elementData");
         Field field = fields1[1];
         field.setAccessible(true);
         System.out.println("Field (elementData): " + field.getName());
         Object obj = field.get(list);
         Object[] elementData = (Object[])obj;
         capacity = elementData.length;
         } catch(Exception e){
         e.printStackTrace();
    System.out.println("List Capacity: " + capacity);
         int percentOver = (int)(((capacity - size) / capacity) * 100);
    System.out.println("Percent Over: " + percentOver);

  • Pulling Objects out of a Vector

    Hi, all:
    I am trying to pull Objects out of this vector, and the given method only wants to let me get integers. How do I go about getting Objects out of a vector like this one? The problem comes in with the last line, where the "get" method complains that it wants an integer. The API says the same; I just can't find a method that lets me pull an Object out of a vector instead of an integer. Any ideas?
              neighborList = new Vector();
              soldierNeighbors = new Vector();
              neighborList = world.getMooreNeighbors(x, y, false);
              for (int i = 0; i < neighborList.size(); i++){
              Soldier soldier = neighborList.get (soldier);

    Soldier soldier = neighborList.get (soldier);You'll want to use "i" as your index, not "soldier", since you presumably want to get the soldier reference at element 'i'. Note that since you're not using generics, the get() method returns an Object reference. You'll need to cast it to Soldier. Example:
    Soldier soldier = (Soldier) neighborList.get(i);Read more here: http://java.sun.com/docs/books/tutorial/collections/
    ~

  • How to get long out of an ArrayList?

    I have
    long num = 1234;
    ArrayList alist = new ArrayList();
    alist.add("name");
    alist.add(num);
    How do I get num out from the alist?
    I tried long num1 = alist.get(1);
    but it doesn't work.

    798642 wrote:
    Well, I am used to using mixed list from C#.Language doesn't matter. It's bad design when doing OO.
    Anyway, I am just want lump some data in a list.Why? If that data goes together to mean something, like a name and a birthdate, then you should define a class that has those values as member variables. That's half of what objects are for, after all.
    So that groups of data can be retrieved easily. Like maybe info1 of object A is in index 0. info2 of object A is in index 1, info3 of object A is in index 2.Yeah, bad idea. Define a class.
    But there seem to be a problem with converting the object type back to their original types in Java.Since you still haven't told us any details about what that problem is, there's not much we can do. You also don't seem to have followed my suggestion from my previous post, or, if you did, you didn't show that code and didn't state clearly and precisely what "doesn't work" about it.

  • Why can't get the object "out" in this way?

    We use "PrintWriter out=response.getWriter()"to get a "out" object in Servlet and output text to webbrowser with it.But I think the PrintWriter is a class and Why can't I get the object "out" use this way:"PrintWriter out=new PrintWriter()"?I think the later is easier to understand.Anyone can help me?

    I check the Servlet API.The PrintWriter has a constructor with a abstract object Writer as it's parameter.I couldn't create the Writer object so I can't create the out object.Why it's constructor is protected by java?

  • How to create and object from an arrayList

    Hi I want to create an object from an arrayList.
    here is my code...
    BillingQueryParam billingQueryParam = new BillingQueryParam();
    /*This BillingQueryParam and billingItemManagerActionForm has getter and setter method for following attributes.
    private int billingItemId;
    private String[] paramName;
    private String[] defaultParamValue;
    List billingQueryParamList = new ArrayList();               
    for(int i = 0; i < billingItemManagerActionForm.getParamName().length; i++) {
         billingQueryParam.setParamName(billingItemManagerActionForm.getParamName());
    for(int i = 0; i < billingItemManagerActionForm.getDefaultParamValue().length; i++) {
      billingQueryParam.setDefaultParamValue(billingItemManagerActionForm.getDefaultParamValue());
         billingQueryParam.setBillingItemId(billingItem.getBillingItemId());
         billingQueryParamList.add(billingQueryParam);
    System.out.println("****** ArrayList Size-->"+billingQueryParamList.size());
    for (Iterator iter = billingQueryParamList.iterator();iter.hasNext();) {
         billingQueryParam = (BillingQueryParam)iter.next();
          System.out.println("****** BillingItemId-->"+billingQueryParam.getBillingItemId());
          System.out.println("****** Param Name-->"+billingQueryParam.getParamName()); //printing an array of paramName
          System.out.println("****** Default param value-->"+billingQueryParam.getDefaultParamValue());
    }Here after iterating this list I want to create an object of billingQueryParam which contains a single value of itemId, paramName,paramTypeId and defaultParamName and I want to persist this object in database.
    Please help...!!!
    Thanks

    Now this is too much.. Do i need to tell this thing to u as well. How did u come to this forum?
    Can't u see link to Java programming forum at the top.

  • Removing a object from an arraylist

    hi,
    i am putting an object into an arraylist like:
    <code>
    Hashtable userList = new Hashtable();
    userList = this.loadUsers();
    boolean found = false;
    //look for the user in the list
    for(int i = 0; i< userList.size(); i++)
    User user = new User();
    user = (User)userList.get(""+i);
    if (user.userName.equalsIgnoreCase(userName) && user.password.equalsIgnoreCase(password))
    try
    found = true;
    clientList.add(user);
    System.out.println(userName);
    catch (Exception e)
    e.printStackTrace();
    <\code>
    and removing it like this:
    <code>
    Hashtable userList = new Hashtable();
    userList = this.loadUsers();
    boolean found = false;
    //look for the user in the list
    for(int i = 0; i< userList.size(); i++)
    User user = new User();
    user = (User)userList.get(""+i);
    System.out.println(user);
    if (user.userName.equalsIgnoreCase(userName))
    try
    found = true;
    //add the logged in user to the Arraylist
    int arraylist = clientList.size();
    System.out.println(user);
    System.out.println("client removed = "+clientList.remove(user));
    System.out.println(userName);
    catch (Exception e)
    e.printStackTrace();
    <\code>
    however the object reference is not the same when i take it out so it wont remove... why?
    Assignment.ChatImp$User@11121f6
    Assignment.ChatImp$User@f7f540

    This code is brain dead.
    Looks like your User class has public data members. True?
    Why are you using a Hashtable when you appear to want a List?
    You probably don't override equals and hashcode for your object.
    Try this:
    package user;
    import java.io.Serializable;
    import java.util.List;
    import java.util.ArrayList;
    * Created by IntelliJ IDEA.
    * User: Michael
    * Date: Dec 2, 2006
    * Time: 9:59:11 AM
    * To change this template use File | Settings | File Templates.
    public class User implements Serializable
        private String username;
        private String password;
        public static void main(String[] args)
            if (args.length > 0)
                List<User> users = new ArrayList<User>(args.length);
                User userToRemove = new User(args[0], args[0]);
                for (int i = 0; i < args.length; ++i)
                    User u = new User(args, args[i]);
    users.add(u);
    System.out.println("before: " + users);
    System.out.println("users " + (users.contains(userToRemove) ? "" : "does not ") + "contain " + userToRemove);
    users.remove(userToRemove);
    System.out.println("after : " + users);
    System.out.println("users " + (users.contains(userToRemove) ? "" : "does not ") + "contain " + userToRemove);
    private User()
    this("", "");
    public User(String username, String password)
    if ((username == null) || "".equals(username.trim()))
    throw new IllegalArgumentException("username cannot be blank or null");
    if ((password == null) || "".equals(password.trim()))
    throw new IllegalArgumentException("password cannot be blank or null");
    this.username = username;
    this.password = password;
    public String getUsername()
    return username;
    public String getPassword()
    return password;
    public boolean equals(Object o)
    if (this == o)
    return true;
    if (o == null || getClass() != o.getClass())
    return false;
    User user = (User) o;
    if (password != null ? !password.equals(user.password) : user.password != null)
    return false;
    if (username != null ? !username.equals(user.username) : user.username != null)
    return false;
    return true;
    public int hashCode()
    int result;
    result = (username != null ? username.hashCode() : 0);
    result = 31 * result + (password != null ? password.hashCode() : 0);
    return result;
    public String toString()
    return new StringBuilder().append("User{").append("username='").append(username).append('\'').append(", password='").append(password).append('\'').append('}').toString();

  • Arraylist issue: pass all the arrayList `s object to other arrayList ...

    hi all...i hope somebody could show me some direction on my problem...i want to pass a arraylist `s cd information to an other arraylist
    and save the new arraylist `s object to a file...i try to solve for a long ..pls help...
    import java.text.*;
    import java.util.*;
    import java.io.*;
    public class Demo{
         readOperation theRo = new readOperation();
         errorCheckingOperation theEco = new errorCheckingOperation();
         ArrayList<MusicCd>  MusicCdList;
         private void heading()
              System.out.println("\tTesting read data from console, save to file, reopen that file\t");
         private void readDataFromConsole()
         //private void insertCd()
            MusicCdList = new ArrayList<MusicCd>( ); 
            MusicCd theCd;
            int muiseCdsYearOfRelease;
            int validMuiseCdsYearOfRelease;
            String muiseCdsTitle;
              while(true)
                    String continueInsertCd = "Y";
                   do
                        muiseCdsTitle = theRo.readString("Please enter your CD`s title : ");
                        muiseCdsYearOfRelease = theRo.readInt("Please enter your CD`s year of release : ");
                        validMuiseCdsYearOfRelease = theEco.errorCheckingInteger(muiseCdsYearOfRelease, 1000, 9999);
                        MusicCdList.add(new MusicCd(muiseCdsTitle, validMuiseCdsYearOfRelease));//i try add the cd`s information to the arrayList
                        MusicCdList.trimToSize();
                        //saveToFile(MusicCdList);
                        continueInsertCd = theRo.readString("Do you have another Cd ? (Y/N) : ");
                   }while(continueInsertCd.equals("Y") || continueInsertCd.equals("y") );
                   if(continueInsertCd.equals("N") || continueInsertCd.equals("n"));
                                                    //MusicCdList.add(new MusicCd(muiseCdsTitle, muiseCdsYearOfRelease));                              
                        break;
                      //System.out.println("You `ve an invalid input " + continueInsertCd + " Please enter (Y/N) only!!");
         //i want to pass those information that i just add to the arrayList to file
         //I am going to pass the arraylist that contains my cd`s information to new arraylist "saveitems and save it to a file...
         //i stuck on this problem
         //how do i pass all the arrayList `s object to another arraylist ..pls help
         //it is better show me some example how to solve thx a lot
         private void saveToFile(ArrayList<MusicCd> tempItems)
              ArrayList<MusicCd> saveItems;
              saveItems = new ArrayList<MusicCd>();
              try
                   File f = new File("cdData.txt");
                   FileOutputStream fos = new FileOutputStream(f);
                   ObjectOutputStream oos = new ObjectOutputStream(fos);
                   saveItems.add(ArrayList<MusicCd> tempItems);
                   //items.add("Second item.");
                   //items.add("Third item.");
                   //items.add("Blah Blah.");
                   oos.writeObject(items);
                   oos.close();
              catch (IOException ioe)
                   ioe.printStackTrace();
              try
                   File g = new File("test.fil");
                   FileInputStream fis = new FileInputStream(g);
                   ObjectInputStream ois = new ObjectInputStream(fis);
                   ArrayList<String> stuff = (ArrayList<String>)ois.readObject();
                   for( String s : stuff ) System.out.println(s);
                   ois.close();
              catch (Exception ioe)
                   ioe.printStackTrace();
         public static void main(String[] args)
              Demo one = new Demo();
              one.readDataFromConsole();
              //one.saveToFile();
              //the followring code for better understang
    import java.io.Serializable;
    public class MusicCd implements Serializable
         private String musicCdsTitle;
            private int yearOfRelease;
         public MusicCd()
              musicCdsTitle = "";
              yearOfRelease = 1000;
         public MusicCd(String newMusicCdsTitle, int newYearOfRelease)
              musicCdsTitle = newMusicCdsTitle;
              yearOfRelease = newYearOfRelease;
         public String getTitle()
              return musicCdsTitle;
         public int getYearOfRelease()
              return yearOfRelease;
         public void setTitle(String newMusicCdsTitle)
              musicCdsTitle = newMusicCdsTitle;
         public void setYearOfRelease(int newYearOfRelease)
              yearOfRelease = newYearOfRelease;
         public boolean equalsName(MusicCd otherCd)
              if(otherCd == null)
                   return false;
              else
                   return (musicCdsTitle.equals(otherCd.musicCdsTitle));
         public String toString()
              return("Music Cd`s Title: " + musicCdsTitle + "\t"
                     + "Year of release: " + yearOfRelease + "\t");
         public ArrayList<MusicCd> getMusicCd(ArrayList<MusicCd> tempList)
              return new ArrayList<MusicCd>(ArrayList<MusicCd> tempList);
    import java.util.Scanner;
    import java.util.InputMismatchException;
    import java.util.NoSuchElementException;
    public class errorCheckingOperation
         public int errorCheckingInteger(int checkThing, int lowerBound, int upperBound)
               int aInt = checkThing;
               try
                    while((checkThing < lowerBound ) || (checkThing > upperBound) )
                         throw new Exception("Invaild value....Please enter the value between  " +  lowerBound + " & " +  upperBound );
               catch (Exception e)
                 String message = e.getMessage();
                 System.out.println(message);
               return aInt;
           public int errorCheckingSelectionValue(String userInstruction)
                int validSelectionValue = 0;
                try
                     int selectionValue;
                     Scanner scan = new Scanner(System.in);
                     System.out.print(userInstruction);
                     selectionValue = scan.nextInt();
                     validSelectionValue = errorCheckingInteger(selectionValue , 1, 5);
               catch (NoSuchElementException e)
                   //if no line was found
                   System.out.println("\nNoSuchElementException error occurred (no line was found) " + e);
              catch (IllegalStateException e)
                   // if this scanner is closed
                   System.out.println("\nIllegalStateException error occurred (scanner is closed)" + e);
              return validSelectionValue;
    import java.util.*;
    public class readOperation{
         public String readString(String userInstruction)
              String aString = null;
              try
                         Scanner scan = new Scanner(System.in);
                   System.out.print(userInstruction);
                   aString = scan.nextLine();
              catch (NoSuchElementException e)
                   //if no line was found
                   System.out.println("\nNoSuchElementException error occurred (no line was found) " + e);
              catch (IllegalStateException e)
                   // if this scanner is closed
                   System.out.println("\nIllegalStateException error occurred (scanner is closed)" + e);
              return aString;
         public char readTheFirstChar(String userInstruction)
              char aChar = ' ';
              String strSelection = null;
              try
                   //char charSelection;
                         Scanner scan = new Scanner(System.in);
                   System.out.print(userInstruction);
                   strSelection = scan.next();
                   aChar =  strSelection.charAt(0);
              catch (NoSuchElementException e)
                   //if no line was found
                   System.out.println("\nNoSuchElementException error occurred (no line was found) " + e);
              catch (IllegalStateException e)
                   // if this scanner is closed
                   System.out.println("\nIllegalStateException error occurred (scanner is closed)" + e);
              return aChar;
         public int readInt(String userInstruction) {
              int aInt = 0;
              try {
                   Scanner scan = new Scanner(System.in);
                   System.out.print(userInstruction);
                   aInt = scan.nextInt();
              } catch (InputMismatchException e) {
                   System.out.println("\nInputMismatchException error occurred (the next token does not match the Integer regular expression, or is out of range) " + e);
              } catch (NoSuchElementException e) {
                   System.out.println("\nNoSuchElementException error occurred (input is exhausted)" + e);
              } catch (IllegalStateException e) {
                   System.out.println("\nIllegalStateException error occurred (scanner is closed)" + e);
              return aInt;
    }

    sorry for my not-clear descprtion...thc for your help....i got a problem on store some data to a file ....u can see my from demo..
    Step1: i try to prompt the user to enter his/her cd `s information
    and i pass those cd `s information to an object "MuiscCd" ..and i am going to add this "MuiscCd" to the arrayList " MusicCdList ". i am fine here..
    Step2: and i want to save the object that `s in my arrayList " MusicCdList " to a file....i got stuck here..<_> ..(confused).
    Step3:
    i will reopen the file and print it out..(here i am alright )

  • User temp tables not getting cleaned out from tempdb?

    Im seeing what looks like temp tables that are hanging around in tempdb and not getting cleaned out.
    This is SQL 2008 
    SELECT * FROM tempdb.sys.objects so WHERE name LIKE('#%') AND DATEDIFF(hour,so.create_date,GETDATE()) > 12
    Im seeing about 50 or so objects that get returned and they are user_table and some of them have create dates of several days in the past.  Now I know users do not run processes that take that long, so why are these objects still hanging around?
    TempDB gets reset after a server restart, but other than that, how long are these things going to hang around?

    A local temporary table scope exists only for the duration of a user session or the procedure that created the temporary table. When the user logs off or the procedure that created the table completes, the local temporary table is lost. 
    You can check the below blog for more information
    http://sqlblog.com/blogs/paul_white/archive/2010/08/14/viewing-another-session-s-temporary-table.aspx
    --Prashanth

  • Getting info out of an excel file like a database

    Hi,
    The problem i have is that i have to get info out of an excel file like a database. So i have to be able to perform a kind of query, but to an excel file. Is this possible?
    lay-out excel file:
    number | request | chemical composition
    | | C | Mn | Si | ....
    125654 | |0.20%|0.10%|0.05%|.....
    i should have to be able to search on the number and read the differend % (C, Mn, Si). This % are used in a formula to calculate a value that is used for DAQ
    I can do this action with an acces DB, but not with excel. The problem is that they used excel for some years now (where i work) and changing the excel file to a DB would be a very long w
    ork.
    If someone could help i'd appreciate it
    thx

    I tried it like you said, but i get the error: -2147217865
    exception occured.
    [Microsoft][ODBC Excel Driver] The microsoft jet database engine could not find the object 'Sheet1'. Make sure the object exists...
    So he doesn't seem to recognize a datasheet as a table (if i may compare it like this) when i choose the microsoft Excel driver with the workbook as described in your answer.
    Any ideas?
    i putted some attachements, maybe they make it easier to understand
    Attachments:
    test_excel_query.vi ‏37 KB
    test_query_excel.xls ‏90 KB

  • Map.get(K) and Map.get(Object)

    When I first saw the new 2.0 generics compiler, I was very pleased to see that the signature of Map.get() has changed (since 1.3) from:
        interface Map<K,V> { V get(Object obj); }to:
        interface Map<K,V> { V get(K key); }because it means buggy code like this:
        Map<File,Integer> fileSizeMap = new HashMap<File,Integer>();
        Integer sizeOfFile = fileSizeMap.get("/tmp/foo");
        if (sizeOfFile == null) {
            System.err.println("File not found in map");
        }(where I have mistakenly called Map.get() with a String rather than a File) will now get a compiler error rather than a fault raised several months after the application has gone live.
    So, as I say, I am very pleased with the new signature for Map.get(), although I would also like to see the following methods changed:
        boolean containsKey(Object)   -> boolean containsKey(K)
        boolean containsValue(Object) -> boolean containsValue(V)
        V remove(Object object)       -> V remove(K)However, I just read on http://cag.lcs.mit.edu/~cananian/Projects/GJ/Bugs/v20/map.html that Neal Gafter says that putting Map.get(K) into 2.0 was a mistake, and that it will be put back to Map.get(Object) in the next version.
    I do hope I haven't missed something obvious, but keeping these methods with Object parameters seems to me to be a backwards step from the excellent type safety benefits provided by Generics.
    Does anyone else agree with me that having get(K) would be beneficial in allowing the compiler to identify bugs that would otherwise only be discovered much later?
    Or, could someone explain to me why having get(Object) is preferable, and whether this reason is more important than the type safety issue I identified in my example code above?
    Many thanks in advance
    Geoff

    Gafter wrote:
    The reason the argument type is Object and not K is that existing code depends on the fact
    that passing the "wrong" key type is allowed, causes no error, and simply results in the
    key not being found in the map.But "existing code" does not use Generics, and therefore as with all other non-generic code, the authors of that code can choose to either leave it as it is (in which case their Maps will become Map<Object,Object> and Map.get() will then take an Object), or to upgrade it to Generics, and take advantage of the helpful compiler messages that may highlight some design flaws in the original code.
    In Jakarta Commons Collections (this is "existing code"), there's a class MultiHashMap which extends HashMap. When you call MultiHashMap.put(someKey, someValue) it appends someValue to an ArrayList that gets stored as the value in the HashMap. However when you call MultiHashMap.get(someKey), it returns a Collection of values, rather than just a single value.
    If they try to upgrade MultiHashMap to Generics, they are going to come up with a problem: they would be needing something like this:
        public class MultiHashMap<K,V> extends HashMap<K,V> {
            public V put(K key, V value) { ... }
            public Collection<V> get(K key) { ... }
        }which of course is not allowed, since Map<K,V>.get() returns V, not Collection<V>.
    Now, I don't hear anyone saying: This "existing code" relies on Map.get() returning an Object, so in Generics we're going to make Map.get() return Object rather than V.
    No, instead we (correctly) say: That MultiHashMap code was wrong to abuse the flexibility provided by the use of Object as the return value of Map.get(), and if it wishes to use Generics, it will either need to become MultiHashMap<K,Object>, or if it insists on being MultiHashMap<K,V>, it will not be allowed to extend HashMap.
    I really don't see the problem in using Generics (and a typesafe Java Collections API) as a means of highlighting problems in existing code. As I said before, existing code will continue to work as before, because List will become List<Object> and Map will become Map<Object,Object>.
    This is no worse than "accidentally" trying to get() with a key of the right
    type but the wrong value. Since none of these methods place the key into the
    map, it is entirely typesafe to use Object as the method's parameter.Suppose for a moment that when String.endsWith() was first written, it took an Object parameter instead of a String. If I were to say to you: This method needs to change its parameter from Object to String, would you tell me that that there's no need to make the change, because a String can only ever end in a String, and so it is entirely typesafe to use Object as the method's parameter?
    Geoff

  • Backslashes getting stripped out of my regex

    I am trying to automate some find/replace routines in dreamweaver using javascript.
    dreamweaver.setUpFindReplace({ 
            searchString: '<table width="\d+', 
            replaceString: '<table width="100%"', 
            searchWhat: "document", 
            searchSource: true, 
            useRegularExpressions: true 
        dreamweaver.replaceAll();
    This query gets passed as: <table width="d+
    Problem: when the query string is passed to the setUpFindReplace object, the backslashes get stripped out. Backslashes are key to regular expressions. How do I get them passed from JavaScript to Dreamweaver?
    I am using CS6
    Ben

    I am still looking for a smart person to answer, but in case anyone else is having same problem I found a work-around.
    I think Java uses the backslash as an escape character and so it is not passing it to Dreamweaver. The only thing I found that works is to set a variable with the regex text, and escaping all the backslashes, then passing the variable to Dreamweaver.
    var myFind = '<table width="\\d+"'
    dreamweaver.setUpFindReplace({
            searchString: myFind
            replaceString: '<table width="100%"',
            searchWhat: "document",
            searchSource: true,
            useRegularExpressions: true
        dreamweaver.replaceAll();
    Note: double backslash \\d+ and single quotes ' " " ' used because query string contains double quotes.
    I tried escaping the double quotes in the search string \" but this did not work for the same reason.
    Ben (not a Java developer)

  • [SOLVED]txlive-localmgr: Can't get object for collection langukenglish

    Hi,
    I just had issues today with tllocalmgr not working at all. Every command hangs with:
    [jwhendy]$ tllocalmgr
    Initializing ...
    Can't get object for collection-langukenglish at /usr/bin/tllocalmgr line 103
    Line 103 in /usr/bin/tllocalmgr is:
    my %tlpackages = $tlpdb->archpackages;
    And $tlpdb seems to refer to this line:
    my $tlpdb = new TeXLive::Arch (root => $ROOT) || die "cannot read $ROOT/tlpkg/texlive.tlpdb"
    I tried removing ~/.texlive/texmf-var/arch/tlpkg/texlive.tlpdb to see what it would do and it just regenerated one and produced the same issue.
    The only google results for collection-langukenglish refer to /usr/share/texmf[-config]/tex/generic/config/language.dat. I checked that file out and commented out all languages except english seeing if that would help. No luck.
    Any other thoughts? I'm truly puzzled. I just installed some texlive packages from CTAN within the last week... two at the most. Is this on my end or perhaps with some momentary glitch in CTAN, like being out of sync somehow?
    John
    Last edited by jwhendy (2010-09-10 02:26:19)

    Hmmm. Wonder if it really was the mirror. After a few 'yaourt -R texlive-localmanager' and 'yaourt -S texlive-localmanager' iterations... the problem is gone!
    John

Maybe you are looking for

  • Interactive report in sap-abap

    hi experts, i want to know how we display the end-of-page in second secondary list? in interactive reporting.   regards   cnu.

  • Nokia 5800 v21.0.25 Auto-Rotate issue (firmware re...

    Hi, After updating OTA to the lastest firmware Auto-Rotate display stopped working. When i first installed the new FW I had issue with the home screen. It kept blinking like every 1 sec between homescreen and appication screen. This is when I noticed

  • Word stopped working in all identities

    have new macbook pro and installed microsoft word. made 4 separate identities for different family members. Worked fine for a month, and today, can only access word from 1 identity. any idea what happened and what to do to fix it?

  • How to crop 16x9 to 4x3  ?

    I have some footage which is 16x9. I need to crop to 4x3. Please tell me how. Thank You. ALen E. Reed

  • 2.53 GHz Mini versus older 2.16 GHz Intel iMac

    So here's the deal. My Intel Core Duo iMac 2.16 GHz with 3 MB memory has a fried logic board and hard drive. I am on a tight budget and have been looking at the 2.53 GHz Mini with 4 MB memory to replace the iMac. I am a graphic designer and mostly us