File processing...  first time.

I am taking my program step by step.. this is the first day i learned about tokenizing and file input..
public class nameSearchEngine {
     public static void main(String[]args) throws FileNotFoundException {     
          System.out.println("Type a name to search in database :");
          Scanner console = new Scanner(System.in);
          String searchName = console.next();
          searchName = searchName.toLowerCase();  // make sure any type of casing works.
          Scanner input = new Scanner(new File("namedatabase.txt"));     
       findPerson(input, searchName);
          // Finds persons name and shows it.
               public static void findPerson(Scanner input, String searchName) {
                    while (input.hasNextLine()) {
                         String line = input.nextLine();
                         Scanner lineScan = new Scanner(line);
                         String findName = lineScan.next();
                         if (findName == searchName) {
                              System.out.println(line);
}

My two bobs worth...
package forums;
import java.io.Console;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.FileNotFoundException;
class NoDataFoundException extends java.lang.Exception
  private static final long serialVersionUID = 1L;
  public NoDataFoundException() { super(); }
  public NoDataFoundException(String message) { super(message); }
  public NoDataFoundException(String message, Throwable cause) { super(message, cause); }
  public NoDataFoundException(Throwable cause) { super(cause); }
class UserCanceledException extends java.lang.Exception
  private static final long serialVersionUID = 1L;
  public UserCanceledException() { super(); }
  public UserCanceledException(String message) { super(message); }
  public UserCanceledException(String message, Throwable cause) { super(message, cause); }
  public UserCanceledException(Throwable cause) { super(cause); }
public class NameSeeker
  private static final Console console = System.console();
  private static BufferedReader reader;
  public static void main(String[]args) throws FileNotFoundException {
    String dbname = args.length>=1 ? args[0] : "NameSeeker.txt";
    try {
      System.out.println((new NameSeeker(dbname)).firstLineStartingWith(ask("Enter the name to find: ")));
    } catch (NoDataFoundException e) {
      System.err.println(e.getMessage());
    } catch (UserCanceledException eaten) {
      // do nothing, just cleanup and exit the program.
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if(reader!=null)try{reader.close();}catch(IOException e){e.printStackTrace();}
  public NameSeeker(String dbFilename) throws FileNotFoundException {
    reader = new BufferedReader(new FileReader(dbFilename));
  public String firstLineStartingWith(String target) throws NoDataFoundException, IOException  {
    target = target.toLowerCase(); // case insensitive comparison.
    String line = null;
    while ( (line=reader.readLine()) != null ) {
      if ( line.toLowerCase().startsWith(target) ) {
        return line;
    throw new NoDataFoundException("Not found: "+target);
  private static String ask(String prompt) throws UserCanceledException {
    System.out.print(prompt);
    String response = console.readLine();
    if(response==null) throw new UserCanceledException();
    response = response.trim();
    if(response.length()==0) throw new UserCanceledException();
    return response;
}Notes:
* ALLWAYS close your resources! In this case that's just the input-file-reader.
* Try to split your program up into steps... seperating input, processing, and output is a great place to start... in this case that just means three methods...
.... (a) input = read a name to find from the user
.... (b) processing = search the file for lines which start with the given name
.... (c) output = print out the line which starts
* If anything goes wrong print a diagnostic message; except
... (a) in the case the user doesn't enter anything to find, in which case we just exit silently.
... (b) in the case the name is not found print a simple "Not Found" message.
Cheers. Keith.
PS: If you hand in this code as your own your lecturer will smell a rat... but it is (IMHO) useful to see better ways of tackling simple problems which you already have had a go at yourself.

Similar Messages

  • Download .jnlp file when first time

    Hi Everybody,
    I am new bee for java web start.
    We are having swing application which we want to distribute through Java Web Start. Client can run application through provided web link. we also want to download .jnlp file to the client machine when user clicked the link first time.
    I go through different thread for the above problem in this forum, but though not getting clear idea as in our application, we need to generate dynamic .jnlp file. All solution posted for the above problem assuming that .jnlp file exists at some location, but in our case we have to generate it when user clicked it first time. Any body having some idea ?
    Our second problem is, can it possible that user will run the swing application only when he click the link provided on the web server ? In our case authentication of user is done in our web application and when user will click the provided link user id and other information will be pass to swing application as parameters through .jnlp file. If that application will available offline user can run it through last downloaded .jnlp file without clicking the link , which will be not allowded. Also we are concern about multi user environment, as we are thinking to dynamic generation of .jnlp file , it may possible that other user running the same application noted .jnlp file version difference and will download the .jnlp file of other user ?
    Can any body have any idea, how can we done the above scenario ?
    Thanks in advance,
    Dimpal

    If you upgrade to Java 1.4.2 it will present a dialog asking for desktop
    integration the first time you start the application.
    Maybe that's what you want?

  • Slight Color and Quality Shift when viewing RAW files for first time in Library Module.

    Hello,
    I have been shooting RAW for a while and have notice that after I import the images and then start to view them in the Library Module I will see a slight color and quality shift - almost looks like a white balance shift but not quite.   I was thinking that perhaps there was some automatic preset being applied but I don't have any presets at all.
    I am shooting with a Canon 1DX as well as 7D.  I have not checked to see if I get this situation with the 7D, but I know for sure that I get it with the 1DX.
    Today I was reviewing some images in Bridge and decided to open one of them in Camera RAW.   At that time I discovered that the camera's Image Style Settings were available, Faithful, Standard, Portrait, etc.  I noticed that the images did not have one of the camera styles applied to them but rather the Adobe Standard Style. At that point from within RAW I selected one of the camera's styles and bingo thats the kind of shift I am seeing when I first view an image in LR4 Library.
    So as far as I can tell the RAW images are getting the Adobe Standard style applied in LR.   I have no idea if this is a default behavior of if I have done something to cause it.  I'm also thinking that perhaps LR does not necessarily apply the Camera's Styles automatically even though the particular style has been set in the camera -- perhaps is not imported as part of the metadata during the import and thus defaults to the Adobe Standard.
    I guess what I need to know is a few things and I hope someone can educate this newbie! 
    1. Should I expect LR4 to apply the Style as set from the camera automatically or not at all?
    2. Can I prevent LR from applying the Adobe Standard Style and apply no style?
    3. Can I cause LR to apply the Style as set in the camera for the particular image to be appied automatically upon import?
    Thank you for any guidenace you can offer.  Of course if you need additional information or clarification please let me know.
    Scott

    That sort of describes it and may be exactly what is happening.  I have a shoot tonight and will pay closer attention to the process and behavior when I import.
    It is the full image that I see the shift on though.  Its not that the thumbnail and the full size image look different.  It the full size image looking one way and then shifting in front of my eyes.   
    What is frustrating is that I typically find that the image before the shift is better than what appears after the shift, so I find myself always chasing to get back to where it was and because its gone I'm chasing an invisible ideal, so to speak.   Ahhh...isnt that the life of a photographer though!
    It seems like its the last step in the render process -- if I could just figure out what it is and stop it I could finally figure out if I really care or not.  Its just so quick its tough to tell if indeed the first appearance is better.
    I'll feedback some more information when I get a better handle on this.
    Thanks for the reference.

  • Cannot override codebase to use local files for first time installation.

    I have an application that is installed via a JNLP link. The application is about 200MB and we use a web start so that each time the application starts it checks for updates in the configuration and downloads them if necessary.
    I have a requirement to provide an offline installation on CD as some of our users have very slow connection speeds and it's taking over an hour to download the binaries.
    I am trying to do the install using the command line javaws -import -codebase <linktolocaldir> <linktojnlp>
    I need to use the jnlp on the sever so that the configuration files are checked and downloaded each time it starts.
    However the local codebase is never used - the dialog always says that it is downloading from the server, I can only get it to install from the local drive if I change the path directly in the JNLP (which is no good as I need to keep this path pointing to the server)
    Is there any other way to override the codebase for the initial installation?
    Any help much appreciated.

    Here are the guides I've used to do mine:
    How to use the Java Web Start CD-Install feature ? http://download.oracle.com/javase/1.5.0/docs/guide/javaws/developersguide/cdinstall.03.06.html
    Distributing a Java Web Start Application via CD-ROM http://blogs.oracle.com/CoreJavaTechTips/entry/distributing_a_java_web_start
    Distributing a Java Web Start Application via CD-ROM (same as above) http://www.java.net/pub/a/today/2008/07/10/distributing-web-start-via-cd-rom.html

  • I downloded iphoto 11 9.2 and when opened it for the first time and the program started to update my iPhoto library the file got corrupted. That has happened in the two macs I have (both of them rather new and updated to last Lion version 10.7.2).

    I downloaded Iphoto 11 9.2 from the apps store (was on iphoto '09 before version 8.x) and when opened it for the first time it tried to update my photo librery and ended up corupting it to the extreme that I had to get a backup from time capsule and downgrade my iphoto version. I spent yesterday 6 hours at the genius bar in an apple store and they were not able to provide me with any other solution. In the emantime, I have to forget about about photo streaming... Any idea, is this a bug that somebody knows how tp fix?

    In fairness, this isn't an issue in iPhoto 11 but one in your Library. Some file or other in there is damaged and that's what causes the crash during the upgrade.
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  

  • Help: I want to auto schedule a load using file watcher but it runs only once for the first time and after that it is not running at all

    Hi All,
    I am trying  to execute the below code as provided from one of the blogs. i am able to run the job only once based on a file watcher object(i.e. for very first time) and after that the job is not running at all and if  i schedule the job to run automatically based on interval of 10 or more minutes it is executing properly). Please let me know or guide me if i have missed any step or configuration.that is needed.
    Version of Oracle 11.2.0.1.0
    OS : Windows 7 Prof
    Given all the necessary privileges
    BEGIN
      DBMS_SCHEDULER.CREATE_CREDENTIAL(
         credential_name => 'cred',
         username        => 'XXXX',
         password        => 'XXXX');
    END;
    CREATE TABLE ZZZZ (WHEN timestamp, file_name varchar2(100),
       file_size number, processed char(1));
    CREATE OR REPLACE PROCEDURE YYYY
      (payload IN sys.scheduler_filewatcher_result) AS
    BEGIN
      INSERT INTO ZZZZ VALUES
         (payload.file_timestamp,
          payload.directory_path || '/' || payload.actual_file_name,
          payload.file_size,
          'N');
    END;
    BEGIN
      DBMS_SCHEDULER.CREATE_PROGRAM(
        program_name        => 'prog1',
        program_type        => 'stored_procedure',
        program_action      => 'YYYY',
        number_of_arguments => 1,
        enabled             => FALSE);
      DBMS_SCHEDULER.DEFINE_METADATA_ARGUMENT(
        program_name        => 'prog1',
        metadata_attribute  => 'event_message',
        argument_position   => 1);
      DBMS_SCHEDULER.ENABLE('prog1');
    END;
    BEGIN
      DBMS_SCHEDULER.CREATE_FILE_WATCHER(
        file_watcher_name => 'file_watcher1',
        directory_path    => 'D:\AAAA',
        file_name         => '*.txt',
        credential_name   => 'cred',
        destination       => NULL,
        enabled           => FALSE);
    END;
    BEGIN
      DBMS_SCHEDULER.CREATE_JOB(
        job_name        => 'job1',
        program_name    => 'prog1',
        queue_spec      => 'file_watcher1',
        auto_drop       => FALSE,
        enabled         => FALSE);
      DBMS_SCHEDULER.SET_ATTRIBUTE('job1','PARALLEL_INSTANCES',TRUE);
    END;
    EXEC DBMS_SCHEDULER.ENABLE('file_watcher1,job1');
    Regards,
    kumar.

    Please post a copy and paste of a complete run of a test case, similar to what I have shown below.
    SCOTT@orcl12c> SELECT banner FROM v$version
      2  /
    BANNER
    Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
    PL/SQL Release 12.1.0.1.0 - Production
    CORE    12.1.0.1.0    Production
    TNS for 64-bit Windows: Version 12.1.0.1.0 - Production
    NLSRTL Version 12.1.0.1.0 - Production
    5 rows selected.
    SCOTT@orcl12c> CONN / AS SYSDBA
    Connected.
    SYS@orcl12c> -- set file watcher interval to one minute:
    SYS@orcl12c> BEGIN
      2    DBMS_SCHEDULER.SET_ATTRIBUTE
      3       ('file_watcher_schedule',
      4        'repeat_interval',
      5        'freq=minutely; interval=1');
      6  END;
      7  /
    PL/SQL procedure successfully completed.
    SYS@orcl12c> CONNECT scott/tiger
    Connected.
    SCOTT@orcl12c> BEGIN
      2    -- create credential using operating system user and password (fill in your own):
      3    DBMS_SCHEDULER.CREATE_CREDENTIAL
      4       (credential_name     => 'cred',
      5        username          => '...',
      6        password          => '...');
      7  END;
      8  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- create table to insert results into:
    SCOTT@orcl12c> CREATE TABLE ZZZZ
      2    (WHEN      timestamp,
      3      file_name varchar2(100),
      4      file_size number,
      5      processed char(1))
      6  /
    Table created.
    SCOTT@orcl12c> -- create procedure to insert results:
    SCOTT@orcl12c> CREATE OR REPLACE PROCEDURE YYYY
      2    (payload IN sys.scheduler_filewatcher_result)
      3  AS
      4  BEGIN
      5    INSERT INTO ZZZZ VALUES
      6        (payload.file_timestamp,
      7         payload.directory_path || '/' || payload.actual_file_name,
      8         payload.file_size,
      9         'N');
    10  END;
    11  /
    Procedure created.
    SCOTT@orcl12c> -- create program, define metadata, and enable:
    SCOTT@orcl12c> BEGIN
      2    DBMS_SCHEDULER.CREATE_PROGRAM
      3       (program_name          => 'prog1',
      4        program_type          => 'stored_procedure',
      5        program_action      => 'YYYY',
      6        number_of_arguments => 1,
      7        enabled          => FALSE);
      8    DBMS_SCHEDULER.DEFINE_METADATA_ARGUMENT(
      9       program_name         => 'prog1',
    10       metadata_attribute  => 'event_message',
    11       argument_position   => 1);
    12    DBMS_SCHEDULER.ENABLE ('prog1');
    13  END;
    14  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> BEGIN
      2    -- create file watcher:
      3    DBMS_SCHEDULER.CREATE_FILE_WATCHER
      4       (file_watcher_name   => 'file_watcher1',
      5        directory_path      => 'c:\my_oracle_files',
      6        file_name          => 'f*.txt',
      7        credential_name     => 'cred',
      8        destination          => NULL,
      9        enabled          => FALSE);
    10  END;
    11  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> BEGIN
      2    -- create job:
      3    DBMS_SCHEDULER.CREATE_JOB
      4       (job_name          => 'job1',
      5        program_name          => 'prog1',
      6        queue_spec          => 'file_watcher1',
      7        auto_drop          => FALSE,
      8        enabled          => FALSE);
      9    -- set attributes:
    10    DBMS_SCHEDULER.SET_ATTRIBUTE ('job1', 'PARALLEL_INSTANCES', TRUE);
    11  END;
    12  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- enable:
    SCOTT@orcl12c> EXEC DBMS_SCHEDULER.enable ('file_watcher1, job1');
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- write file (file must not exist previously):
    SCOTT@orcl12c> CREATE OR REPLACE DIRECTORY upncommon_dir AS 'c:\my_oracle_files'
      2  /
    Directory created.
    SCOTT@orcl12c> declare
      2    filtyp utl_file.file_type;
      3  begin
      4    filtyp := utl_file.fopen ('UPNCOMMON_DIR', 'file1.txt', 'W', NULL);
      5    utl_file.put_line (filtyp, 'File has arrived ' || SYSTIMESTAMP, TRUE);
      6    utl_file.fclose (filtyp);
      7  end;
      8  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- wait long enough (may take more than one minute) for job to run:
    SCOTT@orcl12c> EXEC DBMS_LOCK.SLEEP (100)
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- check for results:
    SCOTT@orcl12c> SELECT * FROM zzzz
      2  /
    WHEN
    FILE_NAME
    FILE_SIZE P
    22-OCT-13 10.12.28.309000 PM
    c:\my_oracle_files/file1.txt
            57 N
    1 row selected.
    SCOTT@orcl12c> declare
      2    filtyp utl_file.file_type;
      3  begin
      4    filtyp := utl_file.fopen ('UPNCOMMON_DIR', 'file2.txt', 'W', NULL);
      5    utl_file.put_line (filtyp, 'File has arrived ' || SYSTIMESTAMP, TRUE);
      6    utl_file.fclose (filtyp);
      7  end;
      8  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- wait long enough (may take more than one minute) for job to run:
    SCOTT@orcl12c> EXEC DBMS_LOCK.SLEEP (100)
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> -- check for results:
    SCOTT@orcl12c> SELECT * FROM zzzz
      2  /
    WHEN
    FILE_NAME
    FILE_SIZE P
    22-OCT-13 10.12.28.309000 PM
    c:\my_oracle_files/file1.txt
            57 N
    22-OCT-13 10.14.08.580000 PM
    c:\my_oracle_files/file2.txt
            57 N
    2 rows selected.

  • FTP Adapter fails first time when bpel process is invoked from concurrent

    Hi,
    We noticed that the invoke of the FTP adapter fails the first time when the bpel process is invoked from a concurrent program. The second time the concurrent is ran, it completes fine. However, when invoked from the console, it compeltes fine the first time itlsef.
    Any idea what could be worng. We are on SOA Suite 10.1.3.4
    Thanks
    -Prapoorna

    What you are doing with FTP adapter? Are you writing a file ? Any error details in logs when it is failing on first invocation ?

  • Hi I need help first time here converting a file

    Hi I need help first time here converting a file

    Thank you for your subscription to our service.  Please see below.
    How to convert your file to PDF file:
    Using Adobe Reader:
    Launch Adobe Reader X or Reader XI
    Select “Tools” and click “Sign In” link to sign in with your Adobe ID and password
    Select “Create PDF” then click “Select File” button
    Click “Convert” after select your file
    Click “Download Converted File” link to download the file to your computer after the process is completed.
    Using Web UI
    Log into https://createpdf.acrobat.com/signin.html with your Adobe ID and password
    Select “Convert to PDF”
    Click “Select Files” button then choose your file Click “Download” button in the progress bar after completion of the process to download the PDF file to your computer.
    Converted PDF files are stored at https://files.acrobat.com and you can log in with your Adobe ID and password.  You can share your files with others or download them to your computer.
    Please let me know if you have further questions.
    Hisami

  • Report which contain subreports is not rendered first time is processed.

    when I try to render report contains subreports from first time is not rendered but when i select regresh button the input screen is promb again and then i fill all input again and submit, as a result the report was rendered.
    why this happen? is this a know issue?

    after more testing that issue i discovered that when i try to render report of type "Table" then the report is rendered fom rthe first time i pass/set the input values of the report, but when i use reports of type "chart" the report is not rendered from first time and it need a refresh and then manually entering the values for the input.
    i am using the folloing version of JRC:
    com.businessobjects.sdks_.jrc_.11.8.0_11.8.5.v1197
    my code is a s follow:
    =========================
    <%@ page contentType="text/html; charset=utf-8" %><%@ page import="com.crystaldecisions.reports.sdk.ReportClientDocument"%>
    <%@ page import="com.crystaldecisions.report.web.viewer.*" %>
    <%@ page import="com.crystaldecisions.reports.sdk.DatabaseController" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.lib.ReportSDKException" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.lib.PropertyBag" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.data.*" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.lib.IStrings" %>
    <%@ page import="com.crystaldecisions.reports.sdk.ParameterFieldController" %>
    <%@ page import="com.crystaldecisions.reports.exportinterface.ExportFormatType" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSource" %>
    <%@ page import="java.io.ByteArrayInputStream" %>
    <%@ page import="java.io.FileOutputStream" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.document.PrinterDuplex" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.document.PrintReportOptions" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.document.PaperSource" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.document.PaperSize" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.*" %>
    <%@ page import="java.io.OutputStream" %>
    <%@ page import="org.t2k.bl.reports.ReportsViewerManager" %>
    <%@ taglib prefix="lms_reports" tagdir="/WEB-INF/tags/lms/reports" %>
    <%!
    Utility method that demonstrates how to write an input stream to the server's local file system.
        private void writeToBrowser(ByteArrayInputStream byteArrayInputStream, HttpServletResponse response, String mimetype, String exportFile, boolean attachment) throws Exception {
            //Create a byte[] the same size as the exported ByteArrayInputStream.
            byte[] buffer = new byte[byteArrayInputStream.available()];
            int bytesRead = 0;
            //Set response headers to indicate mime type and inline file.
            response.reset();
            if (attachment) {
                response.setHeader("Content-disposition", "attachment;filename=" + exportFile);
            } else {
                response.setHeader("Content-disposition", "inline;filename=" + exportFile);
            System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaa");
            response.setContentType(mimetype);
            System.out.println("aaaaa1111");
            OutputStream outs = response.getOutputStream();
             System.out.println("aaaaa2222");
            //Stream the byte array to the client.
            while ((bytesRead = byteArrayInputStream.read(buffer)) != -1) {
                outs.write(buffer, 0, bytesRead);
            System.out.println("bbbbb");
            //Flush and close the output stream.
            outs.flush();
    //        outs.close();
            System.out.println("ccccc");
        /* Include the file AlwaysRequiredSteps.jsp, which contains the code to:
           - Create an Enterprise SessionMgr object
           - Log on to the CMS
           - Create an IInfoStore object
           - Query for and select a report
           - Create an IReportAppFactory object
           - Use the IReportAppFactory object to create a ReportClientDocument object with the IInfoObject that is retrieved from the query
    Logs on to all existing datasource
    @param clientDoc The reportClientDocument representing the report being used
    @param username    The DB logon user name
    @param password    The DB logon password
    @throws com.crystaldecisions.sdk.occa.report.lib.ReportSDKException
        public static void logonDataSource
                (ReportClientDocument
                        clientDoc,
                 String username, String
                        password
                throws
                ReportSDKException {
            clientDoc.getDatabaseController().logon(username, password);
    Changes the DataSource for each Table
    @param clientDoc The reportClientDocument representing the report being used
    @param username  The DB logon user name
    @param password  The DB logon password
    @param connectionURL  The connection URL
    @param driverName    The driver Name
    @param jndiName        The JNDI name
    @throws ReportSDKException
        public static void changeDataSource
                (ReportClientDocument clientDoc,
                 String username, String password, String connectionURL,
                 String driverName, String jndiName
                throws
                ReportSDKException {
            changeDataSource(clientDoc, null, null, username, password, connectionURL, driverName, jndiName);
    Changes the DataSource for a specific Table
    @param clientDoc The reportClientDocument representing the report being used
    @param reportName    "" for main report, name of subreport for subreport, null for all reports
    @param tableName        name of table to change.  null for all tables.
    @param username  The DB logon user name
    @param password  The DB logon password
    @param connectionURL  The connection URL
    @param driverName    The driver Name
    @param jndiName        The JNDI name
    @throws ReportSDKException
        public static void changeDataSource
                (ReportClientDocument
                        clientDoc,
                 String
                         reportName, String
                        tableName,
                                     String
                                             username, String
                        password, String
                        connectionURL,
                                  String
                                          driverName, String
                        jndiName
                throws
                ReportSDKException {
            PropertyBag propertyBag = null;
            IConnectionInfo connectionInfo = null;
            ITable origTable = null;
            ITable newTable = null;
            // Declare variables to hold ConnectionInfo values.
            // Below is the list of values required to switch to use a JDBC/JNDI
            // connection
            String TRUSTED_CONNECTION = "false";
            String SERVER_TYPE = "JDBC (JNDI)";
            String USE_JDBC = "true";
            String DATABASE_DLL = "crdb_jdbc.dll";
            String JNDI_OPTIONAL_NAME = jndiName;
            String CONNECTION_URL = connectionURL;
            String DATABASE_CLASS_NAME = driverName;
            // The next few parameters are optional parameters which you may want to
            // uncomment
            // You may wish to adjust the arguments of the method to pass these
            // values in if necessary
            // String TABLE_NAME_QUALIFIER = "new_table_name";
            // String SERVER_NAME = "new_server_name";
            // String CONNECTION_STRING = "new_connection_string";
            // String DATABASE_NAME = "new_database_name";
            // String URI = "new_URI";
            // Declare variables to hold database User Name and Password values
            String DB_USER_NAME = username;
            String DB_PASSWORD = password;
            // Obtain collection of tables from this database controller
            if (reportName == null || reportName.equals("")) {
                Tables tables = clientDoc.getDatabaseController().getDatabase().getTables();
                for (int i = 0; i < tables.size(); i++) {
                    origTable = tables.getTable(i);
                    if (tableName == null || origTable.getName().equals(tableName)) {
                        newTable = (ITable) origTable.clone(true);
                        // We set the Fully qualified name to the Table Alias to keep the
                        // method generic
                        // This workflow may not work in all scenarios and should likely be
                        // customized to work
                        // in the developer's specific situation. The end result of this
                        // statement will be to strip
                        // the existing table of it's db specific identifiers. For example
                        // Xtreme.dbo.Customer becomes just Customer
    //                    System.out.println(newTable.getQualifiedName() + "  -  " + origTable.getQualifiedName());
                        newTable.setQualifiedName(origTable.getAlias());
    //                    newTable.setAlias(origTable.getAlias());
                        // Change properties that are different from the original datasource
                        // For example, if the table name has changed you will be required
                        // to change it during this routine
                        // table.setQualifiedName(TABLE_NAME_QUALIFIER);
                        // Change connection information properties
                        connectionInfo = newTable.getConnectionInfo();
                        // Set new table connection property attributes
                        propertyBag = new PropertyBag();
                        // Overwrite any existing properties with updated values
                        propertyBag.put("Trusted_Connection", TRUSTED_CONNECTION);
                        propertyBag.put("Server Type", SERVER_TYPE);
                        propertyBag.put("Use ODBC", USE_JDBC);
                        propertyBag.put("Database DLL", DATABASE_DLL);
                        propertyBag.put("JNDIOptionalName", JNDI_OPTIONAL_NAME);
                        propertyBag.put("Connection URL", CONNECTION_URL);
                        propertyBag.put("Database Class Name", DATABASE_CLASS_NAME);
                        // propertyBag.put("Server Name", SERVER_NAME); //Optional property
                        // propertyBag.put("Connection String", CONNECTION_STRING); //Optional property
                        // propertyBag.put("Database Name", DATABASE_NAME); //Optional property
                        // propertyBag.put("URI", URI); //Optional property
                        connectionInfo.setAttributes(propertyBag);
                        // Set database username and password
                        // NOTE: Even if the username and password properties do not change
                        // when switching databases, the
                        // database password is not saved in the report and must be set at
                        // runtime if the database is secured.
                        connectionInfo.setUserName(DB_USER_NAME);
                        connectionInfo.setPassword(DB_PASSWORD);
                        // Update the table information
                        clientDoc.getDatabaseController().setTableLocation(origTable, newTable);
            // Next loop through all the subreports and pass in the same
            // information. You may consider
            // creating a separate method which accepts
            if (reportName == null || !(reportName.equals(""))) {
                IStrings subNames = clientDoc.getSubreportController().getSubreportNames();
                for (int subNum = 0; subNum < subNames.size(); subNum++) {
                    Tables tables = clientDoc.getSubreportController().getSubreport(subNames.getString(subNum)).getDatabaseController().getDatabase().getTables();
                    for (int i = 0; i < tables.size(); i++) {
                        origTable = tables.getTable(i);
                        if (tableName == null || origTable.getName().equals(tableName)) {
                            newTable = (ITable) origTable.clone(true);
                            // We set the Fully qualified name to the Table Alias to keep
                            // the method generic
                            // This workflow may not work in all scenarios and should likely
                            // be customized to work
                            // in the developer's specific situation. The end result of this
                            // statement will be to strip
                            // the existing table of it's db specific identifiers. For
                            // example Xtreme.dbo.Customer becomes just Customer
    //                        System.out.println(origTable.getQualifiedName());
                            newTable.setQualifiedName(origTable.getQualifiedName());
                            newTable.setAlias(origTable.getAlias());
                            // Change properties that are different from the original
                            // datasource
                            // table.setQualifiedName(TABLE_NAME_QUALIFIER);
                            // Change connection information properties
                            connectionInfo = newTable.getConnectionInfo();
                            // Set new table connection property attributes
                            propertyBag = new PropertyBag();
                            // Overwrite any existing properties with updated values
                            propertyBag.put("Trusted_Connection", TRUSTED_CONNECTION);
                            propertyBag.put("Server Type", SERVER_TYPE);
                            propertyBag.put("Use JDBC", USE_JDBC);
                            propertyBag.put("Database DLL", DATABASE_DLL);
                            propertyBag.put("JNDIOptionalName", JNDI_OPTIONAL_NAME);
                            propertyBag.put("Connection URL", CONNECTION_URL);
                            propertyBag.put("Database Class Name", DATABASE_CLASS_NAME);
                            // propertyBag.put("Server Name", SERVER_NAME); //Optional property
                            // propertyBag.put("Connection String", CONNECTION_STRING); //Optional property
                            // propertyBag.put("Database Name", DATABASE_NAME); //Optional property
                            // propertyBag.put("URI", URI); //Optional property
                            connectionInfo.setAttributes(propertyBag);
                            // Set database username and password
                            // NOTE: Even if the username and password properties do not
                            // change when switching databases, the
                            // database password is not saved in the report and must be
                            // set at runtime if the database is secured.
                            connectionInfo.setUserName(DB_USER_NAME);
                            connectionInfo.setPassword(DB_PASSWORD);
                            // Update the table information
                            clientDoc.getSubreportController().getSubreport(subNames.getString(subNum)).getDatabaseController().setTableLocation(origTable, newTable);
    %>
        try {
            // Create the ReportClientDocument object.
            ReportClientDocument clientDoc = new ReportClientDocument();
            clientDoc.open("Class Progress by AI.rpt", 0);
            //start sheeet code            -  work
            changeDataSource(clientDoc, "root", "eatmyshorts",
                    "jdbc:mysql://localhost:3306/lms",
                    "com.mysql.jdbc.Driver", "LMS_MySQL5.1");
            ParameterFieldController paramController = clientDoc.getDataDefController().getParameterFieldController();
            paramController.setCurrentValue("", "Type", "en_US");
            paramController.setCurrentValue("", "SchoolName", "general");
            paramController.setCurrentValue("", "StudyClassName", "classss");
            paramController.setCurrentValue("", "SegmentId", 6);
            paramController.setCurrentValue("", "LAID", 30);
            paramController.setCurrentValue("", "AIID", 205);
            paramController.setCurrentValue("", "LOID", 1);
            IReportSource reportSource = clientDoc.getReportSource();
            // Create a Viewer object
            CrystalReportViewer viewer = new CrystalReportViewer();
            // Set the report source for the  viewer to the ReportClientDocument's report source
            viewer.setReportSource(reportSource);
            // Set the name for the viewer
            viewer.setName("Crystal_Report_Viewer");
            viewer.setPrintMode(CrPrintMode.PDF);
            viewer.setEnableParameterPrompt(true);
            viewer.setEnableDrillDown(true);
            viewer.setOwnPage(false);
            viewer.setOwnForm(true);
            viewer.setDisplayToolbar(false);
            viewer.setDisplayGroupTree(false);
            viewer.setHasPageBottomToolbar(false);
            // Process the http request to view the report
            viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), out);
            // Dispose of the viewer object
            viewer.dispose();
            // Release the memory used by the report
            clientDoc.close();
        } catch (ReportSDKExceptionBase e) {
            e.printStackTrace();
    %>

  • Firefox is taking a long time to open the first time I click on it and also a dialouge box comes up stating firefox is already running, but is not responding, you must close existing firefox process? What is going on?

    After I start my computer in the morning, I go to my email, then I click on firefox, with google as my homepage, it takes a long time for firefox to show up on the computer. It says it is connecting, then when I close firefox, and go to reopen it again, a dialog box opens up that says firefox is already running and I must close existing firefox process first. I have not run into this problem before.

    * The first time you start up any application after turning on your computer is called a cold start, which is why Firefox takes a while to load right away. (I've noticed that future versions of Firefox start up faster on a cold start then Firefox 5.0.1.) Also, a lower amount of RAM could be slowing its start-up down since Firefox is kind of memory hungry.
    * As for the second part of your question, press ctrl,Alt, and the delete keys on your keyboard. The Windows Task Manager should start. Go to the processes tab and look for 'firefox.exe'. Right click on the firefox.exe and click 'End Process'. Hit Yes and wait for a minute.
    * Then opening Firefox again.
    Hopefully this helped somewhat!

  • For the first time, I'm trying to use adobe premiere elements10 that came with my pc Windows 8. I created a single project, saved it but cannot open it. My pc shows the file I created but I get an error message that says this type file is not supported or

    For the first time, I'm trying to use adobe premiere elements 10 that came with my pc Windows 8. I created a single project, saved it but cannot open it. My pc shows the file I created but I get an error message that says this type file is not supported or the codex is not installed. As a test, I created another very small project and get the same error message, when I try to open it. Pls give me a simple answer, a refund or a phone

    mike frischenmeyer
    What computer operating system is your Premiere Elements 10 running on? And, what video card/graphics card does that computer use?
    Is this the first time you are using Premiere Elements 10 or have you worked with it before successfully? There is no easy solution until we
    know the details and troubleshoot to determined what caused the problem.
    1. Can you open a new project?
    2. After you saved/closed the problem project, did you move, delete, or rename any of the files/folder that were related to the source media
    for that project?
    3. Please review the Adobe document on troubleshooting damaged projects.
    Troubleshoot damaged projects | Adobe Premiere Elements
    4. What are the steps that you are using to reopen this saved closed project.
    a. File Menu/Open Project/Name of Project
    b. Other
    Please review and consider and then we can decide what next based on your further details and results..
    Thank you.
    ATR

  • In iMovie when I try to share a project to a file on an external hard drive it will work the first time but subsequently it says it is sharing but gives no time and file name and in fact just sits there not sharing the file.

    I have iMovie 10.0.4.  I want to transfer some old DV tape videos to MPEG 4 files to be stored on a 4 TB external drive. I successfully imported the video to iMovie, created a project by moving all captured files into a project and the first time I shared the project to a file  it worked as expected.  Every subsequent try to transfer another video would fail to transfer.  When I clicked save it gives the warning that it is too big for iCloud, iso I click create on this computer.  The progress circle comes up with no indication of progress.  The show activity drop down just says sharing to "file" no file name as in the first one and indicates no time remaining.  In fact it just sits there apparently doing nothing.  I'v tried it a half dozen times, deleted everything and started over.  It transfers the first project to file and then nothing on additional tries.  What do I have wrong, am I missing something?

    In iTunes 11 uncheck the preferences setting in in the iTunes Preferences panel "Advanced > Copy Files to iTunes Media folder when adding to Library"

  • HT201250 I had files stored on a hard drive that were not on my Mac. I used the hard drive for my first Time Machine back up, but it was not enough hard drive space to finish. Now those stored files are gone. Is there any way I can recover them?

    I had files stored on a hard drive that were not on my Mac. I used the hard drive for my first Time Machine back up, but it was not enough hard drive space to finish. Now those stored files are gone. Is there any way I can recover them?  No, they were not part of previous Time Machine backups, and I have checked both the hard drive the documents were lost on and the new one that I now use for backups. Any suggestions would be helpful, as the lost files are old pictures that are gone forever. :[ Thanks!

    1. Yes, if both drives are formatted as Mac OS Extended (Journaled).
    2. Reformat the drives if needed, open the Time Machine pane of System Preferences, and remove the drive with the pictures from the list of items set to be excluded.
    (110331)

  • HT201250 i am using for first time the time machine and an external hard drive because I want to erase my macbook and start from zero files. do i keep my files in the portable hard disk when I connect it again with the macbook or the time machine will era

    i am using for first time the time machine and an external hard drive because I want to erase my macbook and start from zero files. Am i keeping my files in the portable hard disk when I will connect it again with the macbook or the time machine will erase all?
    I would like to know if after I erase all my data, empy hard drive inside the macbook, the time machine will erase all my files that I have saved in my "WD "My passport" external hard drive

    Welcome to Apple Support Communities
    Time Machine has to erase the external disk in order to make backups. Before setting Time Machine up, copy the files of your external disk to the hard disk of the Mac in order not to lose them, and then, set up Time Machine. The first backup will start automatically.
    If you want more information about Time Machine, read the Pondini's site > http://pondini.org

  • Ive just upgraded my late 2009 macbook, and things are not working properly. First of all, when I started the computer first time after installing Mountain Lion, some message advised me that some files were impossible to install.

    Ive just upgraded my late 2009 macbook, and things are not working properly. First of all, when I started the computer first time after installing Mountain Lion, some message advised me that some files were impossible to install. Once I wrote my password, and for now on, everytime I start the session, another window advise me that "Java SE 6" is missing, due that, the computer can't run some "CS5Service Manager". If I try to install it, the download ends with an error. If finally, you skip the istallation, you arrive to the dock, but the menu bar at the top of the screen doesn't show up.
    In addition, my trackpad doesn't works either. I can move the arrow but i can't click anywhere, probably because the option of clicking by touching is disabeled and I can't performance a regular click.
    I'll be very glad if someone know what the heck is happening with my computer. Anyway, I'm going to the genius bar next Saturday. Thx!

    We're sorry.
    We can't find the article you're looking for.
    Please return to the Apple Support homepage.
    Sigh.

  • Processing one file at a time in Biztalk

    We are changing the way we're processing files in that where we used to receive hundreds of small files throughout the day, we are now going to have these files batched into larger files that get dropped to our incoming Biztalk directory. I'm concerned about
    having the server pick up multiple large files at one time. Is there a way to tell a Biztalk application to only process one file at a time, and not to pick up the next file until the previous one has finished? Note, I do not have a way to build this into
    the Orchestration, as this is a Biztalk application that is actually installed by our Trizetto(QNXT) product. It uses Biztalk for XML serialization. 
    Thanks.

    I wouldn't worry about the size of the messages unless they are approaching 1GB. BizTalk can process roughly 400 msgs/sec. Also if you're worried about processing multiple large files try load balancing. With BizTalk it is quite "easy" to load
    balance. In a nut shell you have to have the dll of the application installed on all the servers you want to be apart of load balancing and BizTalk takes care of the rest. Your large files would more than likely split up and processed on different servers.
    http://msdn.microsoft.com/en-us/library/aa578057(v=bts.80).aspx
    The link above is for high availability but could also be used to get a better understanding of load balancing. Also if you use de-batching to split up the 3000-4000 records that would help with processing them. If an orchestration receives a file with 4000
    records in them that instance alone processes the whole file. Whereas if you split up the messages each message gets it's own instance of the orchestration which leads to better performance. The only drawback is that it takes more resources so your environment
    needs to be fairly large. Also if one server is busy another server with the same dll can take the de-batched messages and process them.
    Here is a link to my blog post about de-batching. It is very basic but gives a good base for de-batching.
    http://camartin.azurewebsites.net/post/BizTalk-Debatching

Maybe you are looking for

  • For All Those Who Miss The Old Layout After Upgrad...

    So yeah, I feel your pain but I've found a kind of workaround that will give you some of the missing layout features you miss from the previous versions of Skype, including the compact view and opening chats in new windows. To do so, follow these ste

  • 10.2.0.4 upgrade - dbua FINISH button does not process

    I am using dbua to upgrade database from 9.2.0.6 to 10.2.0.4 I have a problem at the last screen in the DBUA. ("Database Summary Screen"). +[skScheduler timer] [16:50:47:173] [CompManager.setUpForOperation:5623] isDierctory dir=/data/MORADEV2/moradev

  • I get start page but when I type in the search or another web address it doesn't do anything.

    I tried to reinstall, clear cache, extension, plug ins. But nothing works. Here's what I got "application": { "name": "Firefox", "version": "23.0", "userAgent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0", "supportURL":

  • OMBPlus example to bind package function to premapping_process operator

    Does anyone have a script snippet showing how to bind a function within a package to a premapping_process operator ? I got this far before the script ref let me down : OMBALTER MAPPING 'MY_MAP' \ ADD PREMAPPING_PROCESS OPERATOR 'FACT_TRANS_PMO' \ BOU

  • AddChild Button

    This is probably something very simple but I can't find anything on it.  So I would appreciate any insight you may have. It's a very simple program that is dynamically creating buttons at runtime based on XML data which will eventually get served by