Youngster with a desire to code in java on Pocket PC

Can anybody tell me if and how I can use Java on my Pocket PC? I downloaded CLDC 1.1 and transferred all the files to the device. This is what a professor of mine advised that I should try, however I'm not sure if I'm going in the right direction. I am relatively new to Java and would like any information on my request. Thanks!

Check this:
http://www.insignia.com/
Hey, how about the duke bucks?

Similar Messages

  • Login codes using java database (validates with Microsoft Access File)

    hi all pro-programmer, can you show me the code to login with the username and password using java database. When the user enters the username and password in the login page then it will go to the requested page. may i know how to do it?

    no one will give you complete code.
    i'll lay out the pieces for you, though:
    (1) start with a User object. give it username and password attributes.
    (2) write a UserDAO interface with CRUD operations for a User object.
    (3) write a UserDAOImpl for your Microsoft Access database
    (4) write an AuthenticationService interface
    (5) write an implementation of the AuthenicationService that works with the UserDAO to authorize a User.
    Use a servlet to accept request from your login page and pass it off to the service. Voila.
    PS - Here's skeleton to start with. UI, servlet, and controller are your responsibility:
    package model;
    public class User implements Serializable
        private String username;
        private String password;
        public User(String u, String p)
            this.username = u;
            this.password = p;
        public String getUsername() { return username; }
        public String getPassword() { return password; }
    public interface UserDAO
        public User findByUsername(String username);
        public void saveOrUpdate(User user);
        public void delete(User user);
    public class UserDAOImpl implements UserDAO
        private Connection connection;
        public UserDAOImpl(Connection connection)
            this.connection = connection;
        public User findByUsername(String username)
            String password = "";
            // logic for querying the database for a User
            return new User(username, password);
        public void saveOrUpdate(User user)
            // save or update a User
        public void delete(User user)
            // delete a User
    public interface AuthenticationService
        public boolean isAuthorized(String username);
    public class AuthenticationServiceImpl implements AuthenticationService
        private UserDAO userDAO;
        public AuthenticationServiceImpl()
            // Create a database connection here and the UserDAO, too.
        public boolean isAuthorized(String username)
            boolean isAuthorized = false;
            // Add logic to do the database query and decide if the username is authorized
            return isAuthorized;       
    }

  • How do I rewrite current code for java 1.3

    I'm using the code below that is written for java 1.4. I have been told that the company can not push JRE 1.4 to the company, and that I need to write my code for java 1.3. I'm using org.w3c.dom for my create xml, etc.
    Is there a java 1.3 option to the 1.4? Any help would be very appreciated.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.List;
    import java.io.*;
    import java.util.*;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    import org.w3c.dom.*;
    public class Sametime extends JFrame implements ActionListener {
        private int indentation = -1;
        JPanel panel = new JPanel();
        JTextArea jta = new JTextArea(
        //Instructions for user
        "For a successful buddy list migration do the following:\n"
        + "1. Save your current Sametime Buddy List to your PC.\n   "
        + "The default location should be: C:/Program Files/Lotus/Sametime Client.\n"
        + "  A. Open the Sametime Client.\n"
        + "  B. Click on People\n"
        + "  C. Click on Save List.\n"
        + "  D. Save as your first.last.dat\n"
        + "     Ex. john.doe.dat\n"
        + "NOTE: If you have AOL contacts in your Sametime buddy list they will not be migrated.\n");
        JButton browse = new JButton("Continue");
        JButton exit = new JButton("Exit");
        public Sametime() {
            super("Sametime Buddy List Migration");
            setSize(610, 245);
            Container c = this.getContentPane();
            c.add(panel);
            browse.addActionListener(this);
            exit.addActionListener(this);
            panel.add(jta);
            panel.add(browse);
            panel.add(exit);
            jta.setEditable(false);
            setLookAndFeel();
            setVisible(true);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        } //end Sametime
        public class DATFilter extends javax.swing.filechooser.FileFilter {
            public boolean accept(File f) {
                //if it is a directory -- we want to show it so return true.
                if (f.isDirectory())
                    return true;
                String extension = getExtension(f);//get the extension of the file
                //check to see if the extension is equal to "dat"
                if ((extension.equals("dat")))
                    return true;
                //default -- fall through. False is return on all
                //occasions except:
                //a) the file is a directory
                //b) the file's extension is what we are looking for.
                return false;
            }//end accept
            public String getDescription() {
                return "dat files";
            }//end getDescription
             * Method to get the extension of the file, in lowercase
            private String getExtension(File f) {
                String s = f.getName();
                int i = s.lastIndexOf('.');
                if (i > 0 &&  i < s.length() - 1)
                    return s.substring(i+1).toLowerCase();
                return "";
            }//end getExtension
        }//end class DATFilter
        public void actionPerformed(ActionEvent e) {
            //Default Location for JFileChooser search
            String error = "The file selected is not a .dat file!\n"
            + "Please select your recently saved .dat file and try again.";
            JFileChooser fc = new JFileChooser("/Program Files/Lotus/Sametime Client");
            fc.setFileFilter(new DATFilter());
            fc.setFileSelectionMode( JFileChooser.FILES_ONLY);
            String user = System.getProperty("user.name");// finds who the current user is
            if (e.getSource() == browse) {
                int returnVal = fc.showSaveDialog(Sametime.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    //if (fc.getSelectedFile().getName().equals(".dat")){
                    if (fc.getSelectedFile().getName().endsWith(".dat")){ // checks to see if selected file is .dat
                    }else{
                        JOptionPane.showMessageDialog(null, error, "Wrong File", JOptionPane.ERROR_MESSAGE);
                        return;
                    }//end else
                    try {
                        String[] contactArray = parseDatFile(fc.getSelectedFile());
                        Document document = createXMLDocument(contactArray);
                        saveToXMLFile(
                        document,
                        new File(
                        "C:/Documents and Settings/" + user +"/My Documents/OLCS/",// looks for directory for list
                        "contacts-list_migration.ctt"));
                    } catch (Exception exc) {
                        File f = new File("C:/Documents and Settings/" + user +"/My Documents/OLCS/");// setting directory for list if not there
                        boolean yes = true;
                        yes = f.mkdir();// creating directory
                        try {
                            String[] contactArray = parseDatFile(fc.getSelectedFile());
                            Document document = createXMLDocument(contactArray);
                            saveToXMLFile(
                            document,
                            new File(
                            "C:/Documents and Settings/" + user +"/My Documents/OLCS/",// used only if the directory didn't exist
                            "contacts-list_migration.ctt"));
                            //exc.printStackTrace();// not sure if this is needed?
                        } catch (Exception exc1) {
                            exc1.printStackTrace();
                        }//end inner catch
                    }// end catch
                }// end if
                if(returnVal==JFileChooser.CANCEL_OPTION){
                    String Warning = "You did not migrate your Sametime buddy list at this time.";
                    JOptionPane.showMessageDialog(null, Warning, "Migration Canceled", JOptionPane.WARNING_MESSAGE);
                    return;
                }else{
                    String thankyou = "Thank You for Migrating your Sametime buddy list to OLCS"
                    + "\nYour new OLCS buddy list has been saved to:"
                    + "\nC:/Documents and Settings/" + user +"/My Documents/OLCS"
                    + "\n as: Contact-List_migration.ctt"
                    + "\n\n To be able to use Contact-List_migration.ctt for Windows Messenger:"
                    + "\n1. Log into Windows Messenger."
                    + "\n2. Click on File"
                    + "\n3. Click on 'Import Contacts from a Saved File...'"
                    + "\n4. Open OLCS in My Documents"
                    + "\n5. Click on 'Contact-list_migration.ctt'"
                    + "\n6. Click Open to import the list."
                    + "\n   A window will pop up confirming that you want to add all of the contacts"
                    + "\n   Click 'yes'"
                    + "\n   Your buddy list is ready to be used.";
                    JOptionPane.showMessageDialog(null, thankyou, "Migration Completed", JOptionPane.INFORMATION_MESSAGE);//Change this when defualt directory is known.
                }//end if else statement
            } //end if
            System.exit( 0 );
            if (e.getSource() == exit) {
                System.exit( 0 );
            } //end if
        } //end actionPerformed
        String[] parseDatFile(File datFile)
        throws Exception    {
            List list = new ArrayList();
            BufferedReader br = new BufferedReader(new FileReader(datFile));
            String line;
            while ((line = br.readLine()) != null) {
                line = line.trim();
                if (line.indexOf("U") != 0)
                    continue;
                int p = line.indexOf("::");
                if (p == -1)
                    continue;
                line = line.substring(p + 2).trim();
                if (line.indexOf("AOL") == 0)
                    continue;
                p = line.indexOf(",");
                if (p != -1)
                    line = line.substring(0, p);
                line = line.trim() + "@mci.com";
                if (list.indexOf(line) == -1)
                    list.add(line);
            }//end while
            br.close();
            String[] contactArray = new String[list.size()];
            list.toArray(contactArray);
            return contactArray;
        }// end String
        // setting up the XML file
        Document createXMLDocument(String[] contactArray) throws Exception {
            DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = dBF.newDocumentBuilder();
            DOMImplementation domImpl = builder.getDOMImplementation();
            Document document = domImpl.createDocument(null, "messenger", null);
            Element root = document.getDocumentElement();
            Element svcElm = document.createElement("service");
            Element clElm = document.createElement("contactlist");
            svcElm.setAttribute("name", "Microsoft RTC Instant Messaging");
            svcElm.appendChild(clElm);
            root.appendChild(svcElm);
            for (int i = 0; i < contactArray.length; i++) {
                Element conElm = document.createElement("contact");
                Text conTxt = document.createTextNode(contactArray);
    conElm.appendChild(conTxt);
    clElm.appendChild(conElm);
    }//end for
    return document;
    }// end Document
    void saveToXMLFile(Document document, File xmlFile) throws Exception {
    OutputStream os =
    new BufferedOutputStream(new FileOutputStream(xmlFile));
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");//puts information on seperate lines
    transformer.setOutputProperty(OutputKeys.METHOD, "xml");
    transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");//gives the XML file indentation
    transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
    DOMSource source = new DOMSource(document);
    StreamResult result = new StreamResult(os);
    transformer.transform(source, result);
    os.close();
    }//end saveToXMLFile
    public static void main(String[] args) {
    Sametime st = new Sametime();
    ImageIcon picIcon = new ImageIcon(st.getClass().getResource("/images/mci.gif"));//Change when default is known!
    st.setIconImage(picIcon.getImage());
    } //end main
    private void setLookAndFeel() {
    try {
    UIManager.setLookAndFeel(
    UIManager.getSystemLookAndFeelClassName());
    SwingUtilities.updateComponentTreeUI(this);
    } catch (Exception e) {
    System.err.println("Could not use Look and Feel: " + e);
    } //end catch
    } //end void setLookAndFeel
    } //end public class Sametime

    Are there features of Java 1.4 that you specifically took advantage and are there any particular lines you are having problems with or did you just freak and post it here?
    Basically compile it under Java 1.3 and see what complains. I've done several projects that compile under 1.2, 1.3, and 1.4.

  • Please help me transform this C++ code to java code....

    guys...please help me transform this C++ code to java code....please try to explain the code..thanks
    [program]
    #include <stdio.h>
    #define ALIVE 1
    #define DEAD 0
    #define SZ 33
    int stschk (int ,int );
    main()
    int s[SZ][SZ], i, j;
    for (i=0; i<sz; i++ ) s[0] = DEAD;
    for (j=0; j<sz; j++ ) s[0][j] = DEAD;
    s[0][1] = ALIVE;
    for (i=0; i<sz-1; i++) {
    for ( j=1;j<sz;j++ ) {
    s[i][j] = stschk(s[i][j-1],s[i+1][j];
    if(s[i][j-1]==ALIVE) printf("*");
    else printf(" ");
    printf("\n");
    int stschk(int s1,int s2)
    if(((s1==DEAD)&&(s2==ALIVE))||
    ((s1==ALIVE)&&(s2==DEAD))) return ALIVE;
    else return DEAD;

    Being picky, that's not C++, that's C. Standard headers in C++ dont' have .h after them, loop variables are scoped with the for, you use constants rather than #defines, etc..
    C and C++ both don't initialise arrays by default; you'd have to write an initialiser to get it to zero out the array:
        int s[sz][sz] = {};gcc will insert a call to memset to zero the array.
    If the author was assuming that the array was zeroed out, there would be no point zeroing the first row and column.
    The code reads values which haven't been initialised. If you mark such values explicitly undefined, and change the program to report an error when undefined, then you get several cases where the program makes such report.
    So either it' s a primitive random number generator (some random number generators use uninitialised memory as a source of randomness), or it's buggy, or it's processing undefined data and throwing away the result. Either way, it cannot be directly be ported to Java if the undefined values (which are limited to a small area of the ouput) are significant.

  • Issue with "firstRecord" Business Component method of JAVA Data bean API.

    Hi,
    Following is my use-case scenario:
    I have to add or associate child MVG business component (CUT_Address)
    with the parent business component (Account) using JAVA Data bean API.
    My requirement is: first to check whether child business component(i.e. CUT_address) exists. If it exists then associate it with parent business component (Account)
    otherwise create new CUT_address and associate it with account.
    Code (using JAVA Data bean APIs) Goes as follows:
    SiebelBusObject sBusObj = connBean.getBusObject("Account");
    parentBusComp = sBusObj.getBusComp("Account");
    SiebelBusComp parentBusComp;
    SiebelBusComp childBusComp;
    // retrieve required account.. Please assume Account1 exists
    parentBusComp.activateField("Name");
    parentBusComp.clearToQuery();
    parentBusComp.setSearchSpec("Name", "Account1");
    sBusComp.executeQuery2(true, true);
    sBusComp.firstRecord();
    Counter = 0;
    while (counter < Number_Of_Child_Records_To_Insert)
    childBusComp = parentBusComp.getMVGBusComp("City");
    associatedChildBusComp = childBusComp.getAssocBusComp();
    childBusComp.activateField("City");
    childBusComp.clearToQuery();
    childBusComp.setSearchSpec("City", Vector_of_city[counter]);
    sBusComp.executeQuery2(true, true);
    if( sBusComp.firstRecord() )
    // Child already exist and do processing accordingly
    else
    // Child does not exist and do processing accordingly
    childBusComp.release();
    childBusComp = null;
    associatedChildBusComp.release();
    associatedChildBusComp=null;
    Now the issue with this code is: For the first iteration, SbusComp.firstRecord returns 0 if records does not exist. However from the second iteration, SbusComp.firstRecord returns 1 even if there is no record matching the search specification.
    Any input towards the issue is highly appreciable.
    Thanks,
    Rohit.

    Setting the view mode to "AllView" helped.
    Thanks for the lead!
    In the end, I also had to invoke the business component method SetAdminMode with "true" as the argument so that I could also modify the records from my script.

  • Hi i am getting Innternal Error in jdeveloper IDE in side preferences- code editer- java

    hi i am getting Innternal Error in jdeveloper IDE in side preferences->code editer->java
    if u know something about this error psease share here
    java.lang.NullPointerException
      at oracle.jdevimpl.java.editing.JavaOptionsPanel.loadSettingsFrom(JavaOptionsPanel.java:186)
      at oracle.jdevimpl.java.editing.JavaOptionsPanel.onEntry(JavaOptionsPanel.java:67)
      at oracle.ide.panels.MDDPanel.enterTraversableImpl(MDDPanel.java:1220)
      at oracle.ide.panels.MDDPanel.enterTraversable(MDDPanel.java:1201)
      at oracle.ide.panels.MDDPanel.access$1200(MDDPanel.java:128)
      at oracle.ide.panels.MDDPanel$Tsl.updateSelectedNavigable(MDDPanel.java:1657)
      at oracle.ide.panels.MDDPanel$Tsl.updateSelection(MDDPanel.java:1525)
      at oracle.ide.panels.MDDPanel$Tsl.actionPerformed(MDDPanel.java:1519)
      at javax.swing.Timer.fireActionPerformed(Timer.java:291)
      at javax.swing.Timer$DoPostEvent.run(Timer.java:221)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:642)
      at java.awt.EventQueue.access$000(EventQueue.java:85)
      at java.awt.EventQueue$1.run(EventQueue.java:603)
      at java.awt.EventQueue$1.run(EventQueue.java:601)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:612)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
      at java.awt.Dialog$1.run(Dialog.java:1046)
      at java.awt.Dialog$3.run(Dialog.java:1098)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.awt.Dialog.show(Dialog.java:1096)
      at java.awt.Component.show(Component.java:1585)
      at java.awt.Component.setVisible(Component.java:1537)
      at java.awt.Window.setVisible(Window.java:842)
      at java.awt.Dialog.setVisible(Dialog.java:986)
      at oracle.bali.ewt.dialog.JEWTDialog.runDialog(JEWTDialog.java:395)
      at oracle.bali.ewt.dialog.JEWTDialog.runDialog(JEWTDialog.java:356)
      at oracle.ide.dialogs.WizardLauncher.runDialog(WizardLauncher.java:55)
      at oracle.ide.panels.TDialogLauncher.showDialog(TDialogLauncher.java:225)
      at oracle.ide.config.IdeSettings.showDialog(IdeSettings.java:808)
      at oracle.ide.config.IdeSettings.showDialog(IdeSettings.java:601)
      at oracle.ide.ceditor.CodeEditorController.handleEvent(CodeEditorController.java:956)
      at oracle.ide.controller.IdeAction.performAction(IdeAction.java:529)
      at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:897)
      at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:501)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
      at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
      at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
      at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
      at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
      at java.awt.Component.processMouseEvent(Component.java:6289)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
      at java.awt.Component.processEvent(Component.java:6054)
      at java.awt.Container.processEvent(Container.java:2041)
      at java.awt.Component.dispatchEventImpl(Component.java:4652)
      at java.awt.Container.dispatchEventImpl(Container.java:2099)
      at java.awt.Component.dispatchEvent(Component.java:4482)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
      at java.awt.Container.dispatchEventImpl(Container.java:2085)
      at java.awt.Window.dispatchEventImpl(Window.java:2478)
      at java.awt.Component.dispatchEvent(Component.java:4482)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
      at java.awt.EventQueue.access$000(EventQueue.java:85)
      at java.awt.EventQueue$1.run(EventQueue.java:603)
      at java.awt.EventQueue$1.run(EventQueue.java:601)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
      at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
      at java.awt.EventQueue$2.run(EventQueue.java:617)
      at java.awt.EventQueue$2.run(EventQueue.java:615)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

    Hi,
    make sure the IDE is installed with the proper JDK version
    Frank

  • Urgent:Issue with HashMap while creating session in Java Embedding Activity

    Hi,
    I am unable to createsession() with the values from HashMap. following is the code in JEA
    IAgileSession m_session=null;
              IAdmin admin = null;
              IAgileClass cls = null;
              IAutoNumber[] numSources;
              String nextAutoNumber = null;
    try {
                   HashMap params = new HashMap();
                   params.put(AgileSessionFactory.USERNAME, "*********");
                   params.put(AgileSessionFactory.PASSWORD, "*******");
    int s= params.size();
    String y= (String)params.get(AgileSessionFactory.USERNAME);
    String z= (String)params.get(AgileSessionFactory.PASSWORD);
    addAuditTrailEntry("UserName " +y);  
    addAuditTrailEntry("Password " +z);  
    addAuditTrailEntry("Size is " +s);   
                   AgileSessionFactory instance = AgileSessionFactory.getInstance("******************************");
    addAuditTrailEntry("After instance object" +instance);
    m_session = instance.createSession(params);
    addAuditTrailEntry("" +m_session);
    addAuditTrailEntry("After instance object_Session");
                   admin = m_session.getAdminInstance();
                   cls = admin.getAgileClass( "ProblemReport" );
                   IServiceRequest psr = (IServiceRequest)m_session.createObject( "ProblemReport", "PR-9989909");     
              } catch (Exception e) {
                   e.printStackTrace();
              } finally {
                   m_session.close();
    In the above code it is working perfectly up to AgilSessionFactory instance, but after that when I am printing m_session ( i.e. addAuditTrailEntry("" +m_session);) it is returning null values instead of some session ID. I am also able to print AgilesessionFactoy instance ID correctly inside JEA, but only problem is with m_session. I tried with the same code in java client and it is working perfectly. Please some one help me in this issue.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi,
    I am unable to createsession() with the values from HashMap. following is the code in JEA
    IAgileSession m_session=null;
              IAdmin admin = null;
              IAgileClass cls = null;
              IAutoNumber[] numSources;
              String nextAutoNumber = null;
    try {
                   HashMap params = new HashMap();
                   params.put(AgileSessionFactory.USERNAME, "*********");
                   params.put(AgileSessionFactory.PASSWORD, "*******");
    int s= params.size();
    String y= (String)params.get(AgileSessionFactory.USERNAME);
    String z= (String)params.get(AgileSessionFactory.PASSWORD);
    addAuditTrailEntry("UserName " +y);  
    addAuditTrailEntry("Password " +z);  
    addAuditTrailEntry("Size is " +s);   
                   AgileSessionFactory instance = AgileSessionFactory.getInstance("******************************");
    addAuditTrailEntry("After instance object" +instance);
    m_session = instance.createSession(params);
    addAuditTrailEntry("" +m_session);
    addAuditTrailEntry("After instance object_Session");
                   admin = m_session.getAdminInstance();
                   cls = admin.getAgileClass( "ProblemReport" );
                   IServiceRequest psr = (IServiceRequest)m_session.createObject( "ProblemReport", "PR-9989909");     
              } catch (Exception e) {
                   e.printStackTrace();
              } finally {
                   m_session.close();
    In the above code it is working perfectly up to AgilSessionFactory instance, but after that when I am printing m_session ( i.e. addAuditTrailEntry("" +m_session);) it is returning null values instead of some session ID. I am also able to print AgilesessionFactoy instance ID correctly inside JEA, but only problem is with m_session. I tried with the same code in java client and it is working perfectly. Please some one help me in this issue.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Help with executing queries in code

    First here is the code for the servlet so far, basically, what it does, is connect to a database which is already populated with pageContent from websites. The user goes to a html page which contains a text field for typing in words to search for, selecting any of the words, all, or exact, selecting the number of results to return, once they click submit, they would receive a page showing the number of results or they would receive a page saying no results found if that were the case. I'm not sure how to setup the correct queries based on the logic they use suh as any, all, or exact and how to find out how many rows were returned by the search. I really appreciate the help, thanks alot Here is the code:
    import java.io.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    public class WelcomeServlet extends HttpServlet {
          public void init()
            try
                Class.forName("com.mysql.jdbc.Driver");
            }catch(ClassNotFoundException cnfe)
              System.out.println("No Driver");
             try
            Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test",
            "root", "");
           }catch(SQLException sqe)
    protected void doGet( HttpServletRequest request,
          HttpServletResponse response )
             throws ServletException, IOException
          String keywords = request.getParameter( "keywords" );
          String logic = request.getParameter("logic");
          String number = request.getParameter("number");
          response.setContentType( "text/html" );
          PrintWriter out = response.getWriter();
          out.println("<html><head><title>Search Engine</title></head>");
          out.println("<body>");
          out.println("</body></html>");
          public void search(String keywords, String logic, String number)
            Statement stmt = null;
            ResultSet rs = null;
            int num = Integer.parseInt(number);
            String[] tokenList = new String[20];
            int i = 0;
            int max = 0;
            StringTokenizer st = new StringTokenizer(keywords);
            while(st.hasMoreTokens())
              tokenList[i++] = st.nextToken();
              max = i;
            if(logic.equalsIgnoreCase("any"))
            else
                if(logic.equalsIgnoreCase("all"))
                else
                    if(logic.equalsIgnoreCase("exact"))
          }

    I know this is a VERY old topic i'm replying to, but i'm new and couldn't figure out how to contact you directly, and i felt that this wassn't important enough to create a new topic..
    okay duffymo.... would you consider this a search for Lucene or SQL.
    database contains breif description of company's services (max 200 characters), price...name...etc.
    Users can search the database by a form field; the servlet searches the name of hte company as well as the description of the company, and returns all results (10 results per page).
    I think i kinda answered my own question... i think SQL is adequate, but your comment as well as others would be welcome.

  • Viewing code in Java classes

    Hello all,
    I'm new to this forum, so first I'll say Hello.
    I'm a CS student taking my first Java class, and I'm trying to figure out how to view code for certain Java classes and methods; in particular, I want to view the actual code for the g.drawString, g.drawRect, g.setColor, ect... methods. Where do we go to view the actual code for these methods. I find it very frustratingto learn how to use these methods, and yet not to be able to see the actual code that executes them.

    Hello all,
    I'm new to this forum, so first I'll say Hello.
    I'm a CS student taking my first Java class, and I'm
    trying to figure out how to view code for certain
    Java classes and methods; in particular, I want to
    view the actual code for the g.drawString,
    g.drawRect, g.setColor, ect... methods. Where do we
    go to view the actual code for these methods. I find
    it very frustratingto learn how to use these methods,
    and yet not to be able to see the actual code that
    executes them.First thing you should know is that not all code is open-source. You are rarely going to get the source code with libraries and other such items.
    Second, you can always read the JavaDocs provided on this site.
    http://java.sun.com/reference/api/
    API documentation is much more informative (often times) than reading the source code itself.
    Third, the JDK ships with the source code. You can also get copies of the source code from java.net by enrolling in one of the programs and agreeing to the terms and conditions provided therein.

  • How to incorporate the C/C++ code in Java?

    Guys,
    Does any one here knows about in incorporating the C/C++ code in java?
    Or know about to call the C/C++ code in java?
    Guys, please impart your knowledge to me...
    Thanks,
    Mercy

    JNI is built right into the JVM - in fact some of the most fundamental of the library classes use it to get access to the operating system.
    You package your C and C++ into a DLL (windows) or shared library (unix) to which you connect with a System.loadLibrary() call.
    To create the hooks, you declare special methods native. Then you run the classes with native methods through the javah comand to generated C headers declaring the methods to which the java connecfs.

  • K Nearest Neighbor Algorithm Code in Java

    I am looking for a code in Java for K nearest neighbor algorithm (considering clusters if possible which is able to detect outlier clusters).
    Thanks!
    Edited by: win13 on Oct 1, 2007 11:54 AM
    Edited by: win13 on Oct 1, 2007 12:00 PM

    interface MS{ // metric space
      double dist(MS p); // distance between this point and argument
    MS[] kNN(MS data, MS target, int k){
      MS[] res = new MS[k]; double[] d = new double[k];
      int n = 0; // number of element in the res
      // check inputs for validity
      if(data.length == 0 || k<=0) return res; // bail on bad input
      double dd = target.dist(data[0]); // load first one into list
      res[n] = data[0]; d[n++] = dd;
      // go through all other data points
      for(int i = 1; i<data.length; i++){
        if( n<k || d[k-1] > (dd = target.dist(data))){ //add one
    if(n<k){res[n] = data[i]; d[n++] = dd;}
    int j = n-1;
    while(j>0 && dd < data[j-1]){ // slide big data up
    res[j] = res[j-1]; d[j] = d[j-1]; j--;
    res[j] = data[i]; d[j] = dd;
    return res;
    As I said, I don't feel that this code is that difficult. I would be more concerned as to whether the data admits the particular definition of outlier that you have selected.
    It is a mistake to assume that one particular definition of a cluster or an outlier will work in all cases. For example using the definition you supply, if you have one single mega cluster of a thousand elements located within a foot of one another here on earth and you have about 10 other "clusters', each with but a single element, each a single light year apart but all somewhere out near the andromeda galaxy, you will conclude that cluster centers are on the average about one light year apart but that there is one bad outlier, that one way over there on earth.
    But, hey it's your data. Go nuts.
    Just for the record, I don't typically test code that I type into the forum so what I have supplied may not even compile and certainly should not be assumed to be correct. You will need to read it, and treat it as an outline for the code that you will need to write.
    Enjoy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Can you code in Java in Xcode

    Im taking a java class in school and we are using Jcreator. I know that there is no Mac download for Jcreator. I was wondering if it is possible to code in java in Xcode?

    No probably not, Xcode is an IDE specifically for Cocoa (Objective C), the programming language of Apple. Scripting languages like Python, Ruby and Java are text files and don't need to be compiled, so Xcode does not treat them like they are inside an IDE. Since I write mostly Python, I have to run my webapp from Apache in a browser, or as a text file from Terminal because there is no "Run" button in Python. But you also do not "build" Python like you do in Cocoa, you just run it as a script, the same with Java. So I think you will find that Xcode is lacking the extreme convenience of a dedicated Java IDE.
    On the upside, Xcode is free, renders very readably in OSX and runs very smoothly. In the case of Python, I have tried a few IDEs however because they run inside the JVM emulator they rendered poorly and conrols were all jerky. So I stuck with Xcode and am satisfied. There are probably more options for Java but I don't know. There are no Cocoa IDEs for Python, if there was I would probably use it.
    If I had to advise a new user I would recommend you find an IDE written in Cocoa, if such a thing even exists for Mac. Or you may not even need one. Running your application from the command line is easy, flexible and professional. You write your code as a text file and run it in Terminal (or Apache) and you get the output as text (or a webpage). If you are taking a class this may be the best approach, since you may want to abandon Java afterwards for a cleaner programming language.

  • Bar Code in Java ?

    I had developed a site and this site needs to suport bar code.
    Somebody knows how do i do Bar Code in Java ?
    Sorry about my english.

    I'm trying to print labels with bar codes myself.
    The solution will depend on the bar code printer you're using. The one I've got, Intermec, ONLY understands its own proprietary print protocol, IPL. So my Java app has to generate IPL in a byte stream and send that to the print queue.
    I'm still working on it, so I can't claim 100% success, but I'm using javax.print API to get the byte stream to the queue. I KNOW that works. It's just getting the IPL right that's still a problem.
    I had to get a UI tool to help me develop labels graphically and then have it spit out the IPL for me.
    This might be representative of the path you'll have to follow. - MOD

  • Help on upgrading this code to Java 5

    Hi guys,
    I was trying to upgrading the following code to comply with Java 5 using generics, but I failed. Hope somebody here can help me out of this.
    This is the original code:
    import java.util.*;
    public class TestJava5{
        public static void main(String [] args){
            TestJava5 t = new TestJava5();
            Collection strs = t.getAll(String.class);
            for(Iterator i = strs.iterator(); i.hasNext();){
                System.out.println(i.next());
        private Collection getAll(Class c){
            Collection rs = new ArrayList ();
            if(String.class.equals(c)){
                rs.add("str1");
                rs.add("str2");
            }else if(StringBuffer.class.equals(c)){
                rs.add(new StringBuffer("buffer1"));
                rs.add(new StringBuffer("buffer2"));
            return rs;
    }and this is the code I tried to use generics, but obviously, I cannot add a String or StringBuffer into a Collection<T>.
    import java.util.*;
    public class TestJava5{
        public static void main(String [] args){
            TestJava5 t = new TestJava5();
            Collection<String> strs = t.getAll(String.class);
            for(String str:strs){
                System.out.println(str);
        private <T> Collection<T> getAll(Class<T> c){
            Collection<T> rs = new ArrayList<T>();
            if(String.class.equals(c)){
                rs.add("str1");
                rs.add("str2");
            }else if(URI.class.equals(c)){
                rs.add(new StringBuffer("buffer1"));
                rs.add(new StringBuffer("buffer2"));
            return rs;
    }

    Actually, now I've looked at it, it's even worse than that!
    You create a collection with type T, but this type is not fixed at compile type (by definition, obviously). So when you come to add something to the collection (either a String or a StringBuffer), the compiler cannot guarantee that your collection is of the correct type.
    This code is really on a hiding to nothing, I would suggest. But... the following should relieve your immediate compilation problems. However, it is likely to cause further problems when trying to use the returned collection:
      private <T> Collection<?> getAll2(Class<T> c) {
        if (String.class.equals(c)) {
          Collection<String> rs = new ArrayList<String>();
          rs.add("str1");
          rs.add("str2");
          return rs;
        } else if (URI.class.equals(c)) {
          Collection<StringBuffer> rs = new ArrayList<StringBuffer>();
          rs.add(new StringBuffer("buffer1"));
          rs.add(new StringBuffer("buffer2"));
          return rs;
        } else {
          return null;  // or something else like new ArrayList<Object>()
      }

  • C++ Source Code to Java

    Does any1 know of any software or anything of the sort to convert
    exsisting C++ source code to java source code??
    Ur help will be appreciated .
    Thanks..

    While their may be such software as YAT suggests, remember that this may not result in good code. For example, a struct could be converted into a class with all its members public.
    You might want to do this by hand if want "good" code.

Maybe you are looking for

  • Multiple drop shippers question

    Are there any solutions out there for a situation where you have multiple dropshippers in your store, and once you get to the shopping cart you need to have each item display their own unique shipping options, specific to the dropshipper ? Pretty wel

  • CRM single sign on (SSO) to R/3 system via ITS 6.20

    Hi all I try to configue CRM2007 single sign on (SSO) to R/3 system via ITS 6.20. my configuraion process 1. on CRM2007 -profile : login/accept_sso2_ticket = 1               login/create_sso2_ticket = 2 - t-code : strustsso2 --> export system PSE 2.

  • Services in Library

    I wanted to install a new "service" (wordservice from Devon Technologies) and its readme says to put it in the "services folder in the Library." But there ain't no such folder! Its extension is .service, not .app, and putting it in the application fo

  • I am currently running System Version:Mac OS X 10.6.8 (10K549) on a Macbookpro2,2.  Is there any way I can upgrade to Yosemite?

    I am currently running System Version:Mac OS X 10.6.8 (10K549) on a Macbookpro2,2 Is there any way I can upgrade to Yosemite?  The App Store download says that they are unable to upgrade my system.

  • Line item number

    with regard to FI(customer line item)  where can i find line item number