Connect specified words in textframe with lines

Dear all,
I want to use the script below and change it to a script that connects specified words with lines. Now it connects all the words with lines. I'm not sure what to do, so I hope someone can help me.
Thanks in advance
#include ./lib/bene.jsx
//InDesign CS2 JavaScript
//Set to 4.0 scripting object model
app.scriptPreferences.version = 4.0;
var myScriptName = app.activeScript.name;
var myObjectList = new Array;
if (app.documents.length != 0){
     if (app.selection.length != 0){
         for(var myCounter = 0;myCounter < app.selection.length; myCounter++){
             switch (app.selection[myCounter].constructor.name){
                 //allow only textframes
                 case "TextFrame":
                     myObjectList.push(app.selection[myCounter]);
                     break;
         if (myObjectList.length != 0){
             //run the thing! call a function           
             myConnectWords(myObjectList);
         else{
             alert ("Please select TextFrame and try again.");
     else{
         alert ("Please select an object and try again.");
else{
     alert ("Please open a document, select an object, and try again.");
//functions
function myConnectWords(myObjectList){
     var myDocument = app.activeDocument;
     var myLayer, myCounter, myColor;
     //Measurement
     var myOldRulerOrigin = myDocument.viewPreferences.rulerOrigin;
     myDocument.viewPreferences.rulerOrigin = RulerOrigin.spreadOrigin;
     //Save the current measurement units.
     var myOldXUnits = myDocument.viewPreferences.horizontalMeasurementUnits;
     var myOldYUnits = myDocument.viewPreferences.verticalMeasurementUnits;
     //Set the measurement units to points.
     myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
     myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
     //Get references  the None swatch.       
     var myNoneSwatch = myDocument.swatches.item("None");   
     //Create a color (if it does not already exist).   
     myColor = myDocument.colors.item(myScriptName);
     try{
         myColorName = myColor.name;
     catch (myError){
         var myColorArray = new Array(100, 0, 0, 0);
         myColor = myDocument.colors.add({model:ColorModel.process,  space: ColorSpace.CMYK, colorValue:myColorArray,name: myScriptName});        
     //Create a layer to hold the generated lines (if it does not already exist).
     myLayer = myDocument.layers.item(myScriptName);
     try{
         myLayerName = myLayer.name;
     catch (myError){
         myLayer = myDocument.layers.add({name:myScriptName});
     //Process the objects (here text frames) in the selection.   
     for(myCounter = 0; myCounter < myObjectList.length; myCounter ++){
         //get textframe
         var myNewFrame = myObjectList[myCounter];       
         //get all lines in the frame
         var myLines = myNewFrame.lines;
         //connect each word with all words in the next line
         for(myLineCounter = 0; myLineCounter < myLines.length-1; myLineCounter ++){
             //get all words in the line + next line
             var myLine = myLines[myLineCounter].words;           
             var myNextLine = myLines[myLineCounter+1].words;           
             //myPathPoints.push([myLine.insertionPoints[-2].horizontalOffset,myTmpY]);
            //combine this + next line words
             for(i = 0; i < myLine.length; i++){   
                 //get word       
                 var myWord_i = myLine[i];
                 //array for points
                 var myPathPoints = new Array;
                 //add fist point X/Y               
                 myPathPoints[0]=[myWord_i.horizontalOffset,myWord_i.baseline]; 
                for(j = 0; j < myNextLine.length; j++){
                    //get word
                    var myWord_j = myNextLine[j];                                     
                    if (myWord_j.baseline != myWord_i.baseline  && myWord_j.horizontalOffset != myWord_i.horizontalOffset) {
                        //add secound point X/Y
                        myPathPoints[1]=[myWord_j.horizontalOffset,myWord_j.baseline];
                        //draw the line
                        myDrawPolygon(myPathPoints, 1, 100, myColor, myNoneSwatch, myLayer);          
    myDocument.viewPreferences.rulerOrigin = myOldRulerOrigin; 
    //Set the measurement units back to their original state. 
    myDocument.viewPreferences.horizontalMeasurementUnits = myOldXUnits; 
    myDocument.viewPreferences.verticalMeasurementUnits = myOldYUnits; 

Yup -- Fun little exercise, this was.
Select either an entire text frame, or some text directly, and this script connects all of the words with the character style "label". The lines are at the baseline center of each word.
if (app.documents.length == 0 || app.selection.length != 1 ||
!(app.selection[0] instanceof TextFrame || app.selection[0].hasOwnProperty("baseline")))
alert ("Please select a single text frame or some text first");
} else
charStyleName = "label";
app.findTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle = app.activeDocument.characterStyles.item(charStyleName);
list = app.selection[0].findText();
if (list.length == 0)
  alert ('No text found with char style "'+charStyleName+'"');
else if (list.length == 1)
  alert ('Only one text found with char style "'+charStyleName+'", no use in going on');
else
  lpath = [];
  while (list.length)
   lpath.push ( centerOfWord (list.shift()) );
  if (app.selection[0] instanceof TextFrame)
   pg = app.selection[0].parent;
  else
   pg = app.selection[0].parentTextFrames[0];
  while (!(pg instanceof Spread || pg instanceof MasterSpread || pg instanceof Page))
   if (pg instanceof Document || pg instanceof Application)
    break;
   pg = pg.parent;
  l = pg.graphicLines.add({strokeWeight:0.5, strokeColor:app.activeDocument.swatches.item("Black")});
  l.paths[0].entirePath = lpath;
function centerOfWord (word)
var l = word.insertionPoints[0].horizontalOffset;
var r = word.insertionPoints[-1].horizontalOffset;
return [ (l+r)/2, word.baseline ];

Similar Messages

  • Ipod touch has a white screen with lines on it and wont power off and wont connect to my computer

    My ipod has a white screen with line on it and wont turn off and wont connect to my computer . It wont reset or reboot with holding the on off button and home button either any help would be appreciated

    http://support.apple.com/kb/TS3281
    Basic troubleshooting steps  
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 
    Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101
     In Memory of Steve Jobs 

  • Hi there i have ipod touch 2nd gen and i am tryna restore it but i get error 21 with orginal fireware and 1601 with custom fireware and when it connected to itunes and i try to boot it up by restoring it white screen with lines thorugh it

    hi there i ahve ipod touch 2nd gen and i am tryna restore it but get error 21 with orginal fireware and 1601 with custom firewarw and when connected it to itunes and i try to boot it by resotring it white screen with lines through it

    Those errors are covered here:
    http://support.apple.com/kb/TS3694

  • Position of Textframe with a specified text

    Hello,
    i have a list of ordernumbers in a textfile. Each ordernumber is separated via a Carriage return. I also have an InDesign CS4 Doc with textframes containing the ordernumbers.
    I now need to get the coordinates and pagenumber of the textframe with the ordernumber.
    The result should be a file with
    ordernumber page x y
    Can anyone help me doing it?
    Thanks
    Peter

    app.findTextPreferences = NothingEnum.nothing;
    app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.bulletsAndNumberingListType = ListType.NUMBERED_LIST;
    var myFoundItems = app.documents.item(0).findText();
    for (i = 0; i < myFoundItems.length; i++) {
        var myParagraphs = myFoundItems[i].paragraphs;
        for (j = 0; j < myParagraphs.length; j++) {
            var myPar = myParagraphs[j];
            var myOrderNumber = myPar.bulletsAndNumberingResultText;
            var myTextFrame = myPar.parentTextFrames[0];
            var myTextFramesGB = myTextFrame.geometricBounds;
            var myPageNumber = myTextFrame.parent.name;
            $.writeln("Order Number = " + myOrderNumber + ", Page Number = " + myPageNumber + ", X = " +Math.round(myTextFramesGB[1]) + ", Y = " + Math.round(myTextFramesGB[0]));
    It's a very simple script that just shows you an approach that can be used for your task. I assume that text containing ordered lists in text frames that are not threaded, not inside groups, etc.
    See info written by the script into console.
    Kasyan

  • Sorting internal table with line types

    Hi,
    I have internal table juts for an example with four entries as below:
    A[]
    Line.....Line Types
    444001.....P
    New York...C 
    Evershine..B
    Mary.......N
    I want to sort the internal table with line types in order of lin types NBCP.
    How can i do this ?
    Please help.
    Note: Above example is just with four entries, there might be internal table with ten entries and ten defined sorting order for line types.

    Hi Tushar,
    Please note that we can't changes the mandatory sequence of the address format as defined in the country specif address format. We can change the sequence of others fields by line_priority.
    Try to change the address type :
    ADDRESS_TYPE - Address type (from 3.0C)
    There are three types of address:
    Address type '1': addresses of firms or organizations; the address structure which is used in most SAP applications as 'Address'.
    Address type '2': address of a person
    Address type '3': work address, usually the address of a contact person in a company
    Please use T/code "OY01"> Select Country> Example :AU"--> Display --> Select address key and press F1. You will find SAP 's Address format configuration .
    sap help:
    Formatting Routine Key for Printing Addresses
    For printing addresses, there are country-specific routines which in each case copy the correct postal formatting of the address.
    The three-character "Address Layout Key" for the recipient country controls which of the routines available for formatting addresses in the relevant country is used.
    These routines are programmed into the ADDRESS_INTO_PRINTFORM function module.
    They are based on different national and international guidelines and norms, including:
    ISO 11180,
    contracts of the World Postal Union (Seoul 1994),
    international address samples from the World Postal Union
    as well as the available rules of the individual countries.
    Below you will find an overview of the country-specific formats currently implemented.
    Customers can program their own formatting routines using a customer exit. The SZAD0001 SAP enhancement has been defined in the package SZAD for this (-> transaction CMOD).
    General formatting rules
    The following parameters are used depending on the transaction:
    whether the company address (street/house number) or the P.O. Box address is printed if both exist,
    how many lines are available for printing,
    which is the sender country.
    If there are not enough lines, then lines are left out according to a standard sequence.
    The address format depends on whether the sender country is the same as, or different from, the recipient country. The country is always specified from abroad, either as a text name, or as an identification code of up to three characters (license plate code or country key).
    Where the country name is written out in full, it is written in the language of the sender country. If a language is not specified for the sender country, or the sender country itself is not specified, the logon language is used instead.
    Exception: the language for the country code can be explicitly overwritten by a parameter in the print program (e.g. when the country code for customs transit papers is always to be specified in a particular language, such as English). if the "Print country name in recipient language" flag is set in the print program, the recipient language is used.
    Other language-dependent components such as the title and the word 'PO Box' are printed in the recipient language or the recipient country language. If this cannot be determined, the logon language is again used.
    For all formats except Great Britain (006), Japan (013), and South Korea (017), the core of the address is formatted as follows (without empty lines, except for the compulsory empty line:)
    title line (if applicable)
    name block (differs depending on the address type, see below)
    street address or PO Box
                            (compulsory empty line, if applicable)
    city line with postal code
    country code (if applicable)
    The city line and the country name are always printed in upper case for foreign addresses (only for the complete address, not for short forms).
    The name block generally consists of the following:
    "Normal" addresses (address type SPACE and address type 1):
    NAME1
    NAME2
    NAME3
    NAME4
    Personal addresses (address type 2):
    Title of person and name of person
    Business address with department and contact person (address type 3):
    NAME1
    NAME2
    NAME3
    NAME4
    department
    title of person and name of person
    In addresses entered using Business Address Services (central address management) (see Release notes Central Address Management for Release 4.0 and Central Address Management for Release 4.5 ), the street address can comprise several lines (see Print street address), otherwise street and house number are maintained in the Street field.
    Some countries do not have a compulsory empty line (see notes below). The city and district are printed in the city line, connected by a hyphen (exceptions: 004 USA, 006 Great Britain/Ireland, 013 Japan, 015 Germany, 017 South Korea, 019 Denmark), provided that the total length does not exceed 35 characters. If a different city is specified for the PO Box (PFORT), this is used in the PO Box address.
    In all formats which use a country code (currently 001 European standard format 002 Italy, 011 Switzerland and 014 Austria ), the license plate code for that country is used. If this is not maintained, the country key in table T005 is used.
    If the "Print country name in foreign addresses" flag is set for the sender country in table 005, the country code is not used; the country name is printed in the last line of the address.
    Formats 004 (USA), 005 (Canada) and 008 (Singapore) contain a line ('F') for the function of the contact person in the company (if address type = '3'). This line comes immediately after the line 'N' (Name (and title) of the natural person).
    In formats 002 (Italy), 004 (USA), 005 (Canada), 006 (Great Britain), 007 (Brazil) and Australia (009), the REGIO field (Region, State, Province, County) is formatted. For the USA, Canada, Brazil and Australia, the key from table T005S is used; for Great Britain the text name from table T005U.
    In all countries for which no "Address structure key" is maintained, a standard format is used which corresponds to format "010".
    Hope this may help you.
    Lanka

  • Can not connect outside of Lan to with rtsp PVC2300

    I have the following cameras set up at my office
    1 - PVC2300
    2 - WVC54GC
    3 - AXIS 225FD
    I have a BEFSR81 Router
    I have a computer on Windows XP running the surv software to record.  Everything with that is good.
    I also have 2 desktops.
    I have been playing around with the rtsp feed with the pvc2300, but have run into a few problems.
    1(a).  I can not connect outside of the LAN with RTSP with either the VLC player or quicktime.  It connects and asks for a password and then just hangs.
    The PVC 2300 local address is 192.168.1.102 with ports 554, 5000-5010, and 6970-6999 forwarded on the router.  What am I missing?
    1(b) I can successfully connect with my blackberry bold, although when I try to change the default port (554) to something else (I would like to RTSP my the AXIS camera as well,  so I will need a different port) it connects on my bold, but then says server is unresponsive. What am I missing here?
    2.  The voice with the PVC 2300  using http outside of the LAN (internet) lags quite baddly and is choppy.  This happens without fail when I have all 4 cameras running, which I understand is upload bandwidth problem.  But it also happens when I connect to just the PVC2300.  I do have a connection to all 4 cameras inside the LAN to the XP running the surv software, but that is it. Is the my router acting buggy?  I have unplugged the router for 5 sec, and it fixed it for a while, but it always comes back.  I have donwloaded the latest firmware for the router and PVC 2300 and that didnt seem ot fix it either.  Suggestions?
    3.  This is more of a question.  I know the mobile streaming of the PVC 2300 does not include voice.  Is there an app or way that I can just get it to my Blackberry.  Even if I didnt get the video, voice is sometimes more important to me.
    I hope Ive been clear enough in my description, Im very self taught (google is amazing), but I am in no way a techy.
    Thank you in advace for your help.
    Colin

    Glad to hear you are successfully using the SWVMS16. That program is really cool and useful. I just cant tell you how that model of Linksys Router can work for you here (that is not a model we support on this community as its not small business)
    Regarding RTSP access, are you also including the mobile.sdp in the URL?
    RTSP:///mobile.sdp   I noticed in the camera GUI with the newer firmware, you can specify an access code under mobile settings after checking the enable mobile streaming box.  That word may be what you have to include, so check that too...
    Try this locally first and then remotely is the easiest way to see if you got it right, then it just becomes a routing or firewall issue to figure out.
    But your forwarded ports look right and should be opened.
    Under advanced settings, you can define an alternate HTTP, HTTPS or RTSP port

  • Connecting to an oracle database with SQLPlus

    I'm trying to connect from one CentOS server with SQLPlus installed to another CentOS server with Oracle installed.
    I've installed
    oracle-instantclient-basic-11.1.0.1-1.i386.rpm
    and
    oracle-instantclient-sqlplus-11.1.0.1-1.i386.rpm
    on the first server.
    I'm able to connect to the oracle server via SQL Developer without difficulties.
    When I try to connect to it via the command line with SQLPlus, I'm running the following:
    sqlplus savantdb@//192.168.100.37:1521/orcl
    But all I'm getting back is something that reads like help documentation.
    I've exported the LD_LIBRARY_PATH to point at /usr/lib/oracle/11.1.0.1/client/lib/:/lib
    I've created a tnsnames.ora file in my home directory containing the following:
    orcl=
    (DESCRIPTION=
    (ADDRESS=
    (PROTOCOL=tcp)
    (HOST=drax)
    (PORT=1521)
    (CONNECT_DATA=
    (SERVICE_NAME=orcl)
    Then I tried moving to my home directory and running
    sqlplus savantdb@orcl
    This prompts for a password, then throws the following error:
    ERROR:
    ORA-12154: TNS:could not resolve the connect identifier specified
    Then asks for a username/password, after which it throws the following error:
    ERROR:
    ORA-12162: TNS:net service name is incorrectly specified
    What I want to do is allow my unit tests written in Selenium and PHPUnit to make shell_exec calls to execute sql files to recreate the database from scratch before putting the application through its paces. So I need to make it totally non-interactive.
    Can anyone give me a clue where I'm going wrong here?

    You are mixing up the various naming methods. Try to stick to one!
    Your first attempt sqlplus savantdb@//192.168.100.37:1521/orcl uses the so-called "easy connect" method.
    That's actually not a bad idea, as it is fairly short and does not require a "tnsnames.ora" file, which is a pain in the somewhere or else.
    sqlplus has a parsing problem if you don't enclose part of the string in double quotes. You cannot find that in the documentation, but in Metalink Note 274757.1.
    The syntax is like this:
    sqlplus savantdb@\"//192.168.100.37:1521/orcl\"
    Your second attempt tries to use the TNS (local) naming method, but for that you need to have an environment variable TNS_ADMIN pointing to the directory containing "tnsnames.ora". It does not matter if that directory is your current directory or not. You don't need that if you use the method described above.
    The last error message is because of the annoying behaviour of sqlplus to ask for username and password (for a local connection!) again if the first attempt failed.
    You can avoid that by giving sqlplus the -L flag.
    Yours,
    Laurenz Albe
    PS: If you want to "make it totally non-interactive" you should add a password, like
    sqlplus savantdb/password@//192.168.100.37:1521/orcl
    In that case, you don't need to add the \"

  • How to send string with line feed to Agilent 33250A via COM1

    Agilent 33250A is a function generator. In HPERTERMINAL, when "Send line ends with line feeds" is enabled, simple strings make it work well, such as: "APPLQU", "OUTPUT ON", etc...
    But I can't make it work with .vi file. COM setting is correct because 33250A shows "remote" icon immediatly after string sent. It will respon "error" to any mismatched setting (e.g. 9600 vs 115200). So, the connection is there but it just doesn't respond to commands.
    I don't know why. The termination character is enabled in .vi
    I apprecite your help to make the .vi to send string just like the HYPERTERMINAL with 'line feeds'.
    Thank you very much.
    Jian
    Attachments:
    Serial_Communication.vi ‏40 KB
    Write2COM1.vi ‏22 KB

    From what I can see it looks like you are NOT specifying what termination character you want to use when you call the serial port init.
    When not otherwise specified, the port will be configured to use the default termination character which is a "carrige return" HEX 0A.
    Try wiring a "Line Feed" constant to the init VI.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Customer/Vendor A/C with line item details and with opening and closing Bal

    Dear Sir / Madam,
    Is it possible to have a customer and / or vendor Sub-Ledger account-
    with line item details and with opening and closing balance detail
    for a particular period.?
    Regards
    Chirag Shah
    I thank for the given below thread which has solved the same problem for G/L Account
    Re: Report to get the ledger printout with opening balances

    Hello Srinujalleda,
    Thanks for your precious time.
    I tried the referred T-Code
    But this report is not showing Opening balance, closing balance detail.
    It only gives transactions during the specified posting period and total of it.
    Please guide me further in case if I need to give proper input at selection screen or elsewhere.
    Client Requires Report in a fashion
    Opening Balance as on Date
    + / -  Transactions during the period
    = Closing Balance as on date
    As that of appearing for G/L Account by S_ALR_87012311
    Thanks once again & Regards
    Chirag Shah

  • Getting Connected for the First Time with JDBC

    Hello everyone. I am trying to make my first database connection to a mysql database with Java. I am using jdk 1.5.0, MySQL 4.1.11 nt, and I think I have the freshly downloaded driver C:\jdk1.5.0\jre\lib\ext\mysql-connector-java-3.0.16-ga-bin.jar" installed in the right spot. When I try to run the following code...
    package dbfinder;
    import java.sql.*;
    import javax.sql.*;
    import com.sun.rowset.JdbcRowSetImpl;
    import javax.sql.rowset.JdbcRowSet;
    import java.sql.ResultSetMetaData;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2005</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class DatabaseConnector {
    public DatabaseConnector() {
    public static void main(String args[]){
    Connection connection;
    Statement statement;
    // ResultSet resultSet;
    // ResultSetMetaData metaData;
    String DATABASE_DRIVER = "com.mysql.jdbc.Driver";
    String DATABASE_URL = "jdbc:mysql://localhost/state_crime";
    String USER = "cis695d";
    String PASSWORD = "cis695d";
    JdbcRowSet rowSet = new JdbcRowSetImpl();
    try {
    Class.forName(DATABASE_DRIVER); // load database driver
    System.out.println("class loaded");
    rowSet.setUrl("DATABASE_URL");
    rowSet.setUsername(USER);
    rowSet.setPassword(PASSWORD);
    rowSet.setCommand("Select * FROM state_crime_rates");
    rowSet.execute();
    ResultSetMetaData metaData = rowSet.getMetaData();
    int numberOfColumns;
    numberOfColumns = metaData.getColumnCount();
    System.out.println(numberOfColumns);
    } catch(SQLException sqlException){
    sqlException.printStackTrace();
    System.exit(1);
    catch(ClassNotFoundException classNotFound){
    classNotFound.printStackTrace();
    System.exit(1);
    I get the following exception...
    java.sql.SQLException: No suitable driver
         at java.sql.DriverManager.getConnection(DriverManager.java:545)
         at java.sql.DriverManager.getConnection(DriverManager.java:171)
         at com.sun.rowset.JdbcRowSetImpl.connect(JdbcRowSetImpl.java:618)
         at com.sun.rowset.JdbcRowSetImpl.prepare(JdbcRowSetImpl.java:630)
         at com.sun.rowset.JdbcRowSetImpl.execute(JdbcRowSetImpl.java:526)
         at dbfinder.DatabaseConnector.main(DatabaseConnector.java:44)
    Does anyone have any ideas? Is it my code? Is there a different driver I should use? Any help would be greatly appreciated.

    Hello everyone. I am trying to make my first
    database connection to a mysql database with Java. I
    am using jdk 1.5.0, MySQL 4.1.11 nt, and I think I
    have the freshly downloaded driver
    C:\jdk1.5.0\jre\lib\ext\mysql-connector-java-3.0.16-ga
    -bin.jar" installed in the right spot. You shouldn't be putting that JAR in jre/lib/ext, even if you've found some docs to tell you to do it. Only language extensions (e.g., packages that begin w/javax) belong there.
    I get the following exception...
    java.sql.SQLException: No suitable driver
    Does anyone have any ideas? Is it my code? Is there
    a different driver I should use? Any help would be
    greatly appreciated.The driver is correct. The class loader found it, even though I think you should use the -classpath option to find the JAR.
    It's your code.
    What are you doing with all that RowSet stuff?
    This works. Study it:
    import java.sql.*;
    import java.util.*;
    * Command line app that allows a user to connect with a database and
    * execute any valid SQL against it
    public class DataConnection
        public static final String DEFAULT_DRIVER   = "sun.jdbc.odbc.JdbcOdbcDriver";
        public static final String DEFAULT_URL      = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\Edu\\Java\\Forum\\DataConnection.mdb";
        public static final String DEFAULT_USERNAME = "admin";
        public static final String DEFAULT_PASSWORD = "";
        public static final String DEFAULT_DRIVER   = "com.mysql.jdbc.Driver";
        public static final String DEFAULT_URL      = "jdbc:mysql://localhost:3306/hibernate";
        public static final String DEFAULT_USERNAME = "admin";
        public static final String DEFAULT_PASSWORD = "";
        /** Database connection */
        private Connection connection;
         * Driver for the DataConnection
         * @param command line arguments
         * <ol start='0'>
         * <li>SQL query string</li>
         * <li>JDBC driver class</li>
         * <li>database URL</li>
         * <li>username</li>
         * <li>password</li>
         * </ol>
        public static void main(String [] args)
            DataConnection db = null;
            try
                if (args.length > 0)
                    String sql      = args[0];
                    String driver   = ((args.length > 1) ? args[1] : DEFAULT_DRIVER);
                    String url      = ((args.length > 2) ? args[2] : DEFAULT_URL);
                    String username = ((args.length > 3) ? args[3] : DEFAULT_USERNAME);
                    String password = ((args.length > 4) ? args[4] : DEFAULT_PASSWORD);
                    System.out.println("sql     : " + sql);
                    System.out.println("driver  : " + driver);
                    System.out.println("url     : " + url);
                    System.out.println("username: " + username);
                    System.out.println("password: " + password);
                    db = new DataConnection(driver, url, username, password);
                    System.out.println("Connection established");
                    Object result = db.executeSQL(sql);
                    System.out.println(result);
                else
                    System.out.println("Usage: db.DataConnection <sql> <driver> <url> <username> <password>");
            catch (SQLException e)
                System.err.println("SQL error: " + e.getErrorCode());
                System.err.println("SQL state: " + e.getSQLState());
                e.printStackTrace(System.err);
            catch (Exception e)
                e.printStackTrace(System.err);
            finally
                if (db != null)
                    db.close();
                db = null;
         * Create a DataConnection
         * @throws SQLException if the database connection fails
         * @throws ClassNotFoundException if the driver class can't be loaded
        public DataConnection() throws SQLException,ClassNotFoundException
            this(DEFAULT_DRIVER, DEFAULT_URL, DEFAULT_USERNAME, DEFAULT_PASSWORD);
         * Create a DataConnection
         * @throws SQLException if the database connection fails
         * @throws ClassNotFoundException if the driver class can't be loaded
        public DataConnection(final String driver,
                              final String url,
                              final String username,
                              final String password)
            throws SQLException,ClassNotFoundException
            Class.forName(driver);
            this.connection = DriverManager.getConnection(url, username, password);
         * Get Driver properties
         * @param database URL
         * @return list of driver properties
         * @throws SQLException if the query fails
        public List getDriverProperties(final String url)
            throws SQLException
            List driverProperties   = new ArrayList();
            Driver driver           = DriverManager.getDriver(url);
            if (driver != null)
                DriverPropertyInfo[] info = driver.getPropertyInfo(url, null);
                if (info != null)
                    driverProperties    = Arrays.asList(info);
            return driverProperties;
         * Clean up the connection
        public void close()
            close(this.connection);
         * Execute ANY SQL statement
         * @param SQL statement to execute
         * @returns list of row values if a ResultSet is returned,
         * OR an altered row count object if not
         * @throws SQLException if the query fails
        public Object executeSQL(final String sql) throws SQLException
            Object returnValue;
            Statement statement = null;
            ResultSet rs = null;
            try
                statement = this.connection.createStatement();
                boolean hasResultSet    = statement.execute(sql);
                if (hasResultSet)
                    rs                      = statement.getResultSet();
                    ResultSetMetaData meta  = rs.getMetaData();
                    int numColumns          = meta.getColumnCount();
                    List rows               = new ArrayList();
                    while (rs.next())
                        Map thisRow = new LinkedHashMap();
                        for (int i = 1; i <= numColumns; ++i)
                            String columnName   = meta.getColumnName(i);
                            Object value        = rs.getObject(columnName);
                            thisRow.put(columnName, value);
                        rows.add(thisRow);
                    returnValue = rows;
            else
                int updateCount = statement.getUpdateCount();
                returnValue     = new Integer(updateCount);
            finally
                close(rs);
                close(statement);
            return returnValue;
         * Close a database connection
         * @param connection to close
        public static final void close(Connection connection)
            try
                if (connection != null)
                    connection.close();
                    connection = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a statement
         * @param statement to close
        public static final void close(Statement statement)
            try
                if (statement != null)
                    statement.close();
                    statement = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a result set
         * @param rs to close
        public static final void close(ResultSet rs)
            try
                if (rs != null)
                    rs.close();
                    rs = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a database connection and statement
         * @param connection to close
         * @param statement to close
        public static final void close(Connection connection, Statement statement)
            close(statement);
            close(connection);
         * Close a database connection, statement, and result set
         * @param connection to close
         * @param statement to close
         * @param rs to close
        public static final void close(Connection connection,
                                       Statement statement,
                                       ResultSet rs)
            close(rs);
            close(statement);
            close(connection);
    }%

  • Can't connect to external Oracle DB with JDBC connector

    Hello guys,
    I had failed to connect to connect external Oracle  via JDBC connector .
    Could you please help me to resolve the problem ?
    Backgroud:
    We need to connect the external Oracle DB with JDBC connector, because BI need to connect to the target Oracle. If the JDBC connector suceed, BI will create a UD which use the datasource
    we create in Visual admin to connect to the external Oracle DB.
    Environment:
    Our EP version is NW04S SP17 , OS is AIX .
    The target Oracle DB version is 10g(10.1.0.2.0, 64bi).
    Configuration procedure :
    1. Import Oracle driver "ojdbc14.jar" and create new driver which named "Oracle "  under
    JDBC Connector ->Run time ->Driver  in Visual Admin.
    2. Create datasource "Mydatasource" under JDBC Connector ->Run time ->Data Source,
    Name : Mydatasource
    Driver Name : Oracle
    JDBC version: 2.0(with XA support)
    JDBC compliant:
    Object Factory :oracle.jdbc.pool.OracleDataSourceFactory
    DataSource Type: ConnectionPoolDataSource
    *CPDS class name :oracle.jdbc.pool.OracleConnectionPoolDataSource
    Additional:
    Additional Properties:
    DatabaseName:LPAR8TEST
    DriverName:oracle.jdbc.OracleDriver
    Password: *****
    PortNumber:1521
    ServerName: 10.1.16.208
    URL :jdbc:oracel:[email protected]:1521:LPAR8TEST
    User:IMPL
    Connectoin Pool:
    Initial Connectons: 1                                         Expiration:  (check)
    Maximum Connections: 25                                  Connection Lifetime :600
    Maximum time wait of connection : 60                  Cleanup Thread : 200
    Default Connectoin Isolaton :Default
    SQL Engine:
    Open SQL
    3.Create Connector :
       Copy the standard connector :SDK_JDBC to SDK_JDBC_Oracle,
      Resource Adopter:
      Loader References:
      Add "libray:Oracle" .
    Managed Connection Factory:
    Configuration Property:
    DriverName:oracle.jdbc.OracleDriver
    Password: ****
    User:IMPL
    URL: jdbc:oracle:[email protected]:1521:LPAR8TEST
    All fo my configuration had been listed.
    And I had created JCO RFC : JT-BIDEV_PORTAL_BD1 , and created RFC connection with SM59 in BI.
    Please give me some suggesiton.
    Thanks.
    Louis

    When I try to start datasoure "Mydatasource" , it display error, error detail:
    java.rmi.RemoteException: com.sap.engine.services.dbpool.exceptions.BaseRemoteException: Error during start of application "sap.com/Mydatasource". [id = StartupError]
         at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.startApplication(DataSourceManagerImpl.java:608)
    Caused by: java.rmi.RemoteException: Error occurred while starting application in whole cluster and wait.; nested exception is:
         com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide exception: server ID 3128050:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot start DataSource "CGNPC".
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSource(ContainerImpl.java:1549)
    Caused by: com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
         at com.sap.engine.services.dbpool.spi.CPManagedConnectionFactoryImpl.createManagedConnection(CPManagedConnectionFactoryImpl.java:198)
    Caused by: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    Caused by: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide exception: server ID 3128050:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot start DataSource "Mydatasource".
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSource(ContainerImpl.java:1549)
    Caused by: com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
         at com.sap.engine.services.dbpool.spi.CPManagedConnectionFactoryImpl.createManagedConnection(CPManagedConnectionFactoryImpl.java:198)
    Caused by: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
              u2026.
    When I try to test JDBC with URL : http://jt-pldev:50000/TestJDBC_Web/TestJDBCPage.jsp,
    First I choose connection name "SDK_JDBC_Oracle" .
    If I click "Check Connectons", it display :
    500   Internal Server Error
    SAP J2EE Engine/7.00
      Application error occurred during request processing.
      Details:
      java.lang.NoClassDefFoundError: com.sap.ip.bi.sdk.dac.connector.odbo.impl.Connection (initialization failure)
    Exception id: [001A64A86F2C006B000004C40010302A000469C74E86A096]
    If I click "Slecton Connection", it display:
    500   Internal Server Error
    SAP J2EE Engine/7.00
      Application error occurred during request processing.
      Details:
      com.sap.engine.frame.core.load.SAPNoClassDefFoundError: javax.resource.Referenceable
    Exception id: [001A64A86F2C0063000004C00010302A000469C74FA2BB59]

  • IPod screen is white with lines

    HELP! HELP! anyone?
    Hi guys i have a problem that i have never experienced before, here goes...i have a 30GB 5th generation iPod, i was playing music when i deceided to sync so music, When i connected it to the PC the screen just went *white with lines across the screen* as though the display was damaged. The lines were showing different colours because the logo "DO NOT DISCONNECT" was attempting to show.
    I tried restarting & restoring my iPod but that didn't work, when i restarted it the screen was tring to display the "APPLE" Logo after it was booting up, the screen was dark as usual when u restart it but with lines across and when the main screen came up it was white with the lines. Now the next weird thing that happened was when i turned off the iPod and then turned it back on the screen was back to normal, when i turned it off and on again the problem returned, if i leave it off for about *1-2 minutes* and i turn it on its fine but when i turn it off & on the problem returns.
    Besides the problem with the lines on the screen the ipod is working ok, can anyone please assist with with the huge problem? i don't know what to do...HELP ME!

    Just experienced the same problem yesterday and left with two white lines across the screen and 1/3 from the top of the screen.

  • Can this be done? Airport extreme connected wireless in extend mode to connect a wireless Mac Pro with an ethernet cable from the extended airport extreme..

    Can this be done? Airport extreme connected wireless in extend mode to connect a wireless Mac Pro with an ethernet cable from the extended airport extreme.

    This will work.....IF....you also have an Apple AirPort router configured to provide your wireless network.
    In other words, you need to have two Apple AirPort routers to extend a wireless network.
    When the AirPort Extreme is configured to "extend" the wireless of the "main" AirPort, it will provide more wireless coverage and the Ethernet ports are enabled, so you could connect your Mac Pro to any of the Ethernet ports and use that as a network and Internet connection.

  • Creating PDF in Word 2007 creates horizontal line

    Hello,
    This is my first post in this forum. In general, I have not had problems creating PDFs from Word 2003, or from Word 2007 - from either .doc or .docx documents.
    Yesterday, with one document, when I created a PDF, a centered horizontal line kept appearing near the top of the first 2 pages. These 2 pages
    have no header content. This line is NOT in the Word document. The rest of the PDF appears normal - with its normal header content.
    I think the problem is within Word 2007 (what a surprise!) because I can eliminate the problem by printing a .ps file of the Word doc and then
    distilling it.  The only problems with that method are that (1) It's more time-consuming, and - more important -  (2) the bookmarks are not
    automatically created. So, to create bookmarks manually takes even more time, and I don't know how to create the hyperlinks from the TOC
    (or even if that's possible).
    Any idea what's going on?  I tried making PDFs of some other user
    guides (same doc template), and they are fine.
    Many thanks!

    Hi again Raechel,
    It's such fun dealing with Word and "Microsloth", isn't it?!  IMHO, they
    should have left Office alone at the 2003 (or 2002?) versions.... Even at
    2000, styles were easier to deal with!
    Especially after using Madcap Flare for a few years, going back to Word is
    especially torturous.  I go back and forth from one to the other,
    depending on what I'm working on - product-wise or document-wise.
    Your Word certainly may have gotten corrupted, but even if that's not the
    case -- Word is still buggy as hell (forgive the minor expletive)!!
    Glad you made your printing deadline!!
    Regards,
    Melanie
    Melanie Blank
    Product Documentation Specialist
    Rochester Software Associates (RSA)
    (585) 987-6972
    [email protected]
    From:
    Raechel02 <[email protected]>
    To:
    Melanie Blank <[email protected]>
    Date:
    06/15/2011 09:34 AM
    Subject:
    Creating PDF in Word 2007 creates horizontal line
    Melanie,
    I read your post, and decided to spend my evening figuring out what was
    going on.  You are right about it being related to the lines in the header
    and footers, but as my document had no headers and footers, I found that
    odd.  I tried to edit the styles without success.  Now isn't that odd,
    too?
    I had to delete the header and footer styles from my document in order
    to
    get rid of the lines.  I suspect my copy of Word became corrupted as I
    madly
    edited several documents, all with photos.  As my adult son pointed out,
    "well, they don't put their top programmers on Word, after all."  I
    checked
    my memory utilization, and it appears that Word isn't cleaning up after
    itself very well, so it loses track of some of its objects, and things get
    out of synch.
    Well, in the end I managed to re-produce my document, which is good,
    because
    it had to go to the printer last night before midnight, and it got there
    at
    11:40.
    Thanks for your help,
    Raechel

  • Does microsoft word 2010 work with spaces in osx 10.5.8?

    does microsoft word 2010 work with spaces in osx 10.5.8?

    In order to set up and install the new AirPort Extreme:
    Setup and Administration
    iPhone, iPad, or iPod touch with iOS 5 or later and AirPort Utility 1.3
    Mac with OS X Lion v10.7.5 or later and AirPort Utility 6.3
    would it work with my older osx 10.6.8?
    Yes, if you set up the new AirPort Extreme using the guidelines above. The 10.6.8 Mac will be able to connect to the AirPort Extreme, but it will not be able to make any configuration changes.
    Only the devices listed above can be used to set up and make any changes to the new AirPort.

Maybe you are looking for

  • IPod nano Freezes!!!!!!Please Help

    Every now and then my iPod nano (1st gen) used to freeze and nothing I could do could get it back to life.......so i would just wait an hour or so and it would come back to life. When the iPod was frozen, the screen would be on, the only thing it res

  • Printing Company Name and Contact Name on Labels

    Does anyone know how to print BOTH the company name and contact name on the label in address book? I have read the "fixes" but they won't work for me .. I have a 10,000 person mailing list ... so I can't hand fix each one. Will this problem with addr

  • Recreating a table with child table dependencies

    Hi. I have two tables P (Parent) and C (child), with foreign key dependencies. How can I recreate the P table without losing the child dependencies? Thanks in Advance.

  • Internet "SLOOOOOW DOWN"

    I have a new Imac with 10.5.5 (Lepord) and web pages take forever to load. The Mac is on a domain but NOT "joined" to the domain. The Mac gets it ip from a DCHP server that is also a DNS server. The correct order of DNS servers, from internet to exte

  • How to Change a Sales Order using BAPI

    Hi All How can we change the sales document using BAPI as the requirement is --> First we create a Sales order using a BAPI. --> If the sales order is changed then we get the changed order information alonge with the old order data in a CSV file. her