Monday, December 2, 2013

EXTJS substring errors on loading widgets.... fast debug in Chrome

So I'm wasting a lot of time with ExtJS refactoring on typos on widgets or paths that are misspelled. See the typical errors at the end of this post... and yeah yeah
  1. 1) I should be more careful,
  2. 2) should buy a tool,
  3. 3) buy new glasses...
but honestly I would rather see a meaningful error on the Javascript so where do we put the break point (Chrome)

So in line ext-all-debug.js:5416 set a conditional breakpoint on that line for '!className'.

Uncaught TypeError: Cannot call method 'substring' of undefined ext-all-debug.js:5043
Ext.ClassManager.parseNamespace ext-all-debug.js:5043
Ext.ClassManager.get ext-all-debug.js:5151
Ext.ClassManager.instantiate ext-all-debug.js:5434
Ext.ClassManager.instantiateByAlias ext-all-debug.js:5416
Ext.apply.widget ext-all-debug.js:5701
Ext.define.create ext-all-debug.js:21751
Ext.define.lookupComponent ext-all-debug.js:37477
Ext.define.prepareItems ext-all-debug.js:37447
Ext.define.add ext-all-debug.js:37502
Ext.define.initItems ext-all-debug.js:37279
Base.implement.callParent ext-all-debug.js:4250
Ext.define.initItems ext-all-debug.js:50980
Ext.define.initComponent ext-all-debug.js:37262
Base.implement.callParent ext-all-debug.js:4250
Ext.define.initComponent ext-all-debug.js:50959
Base.implement.callParent ext-all-debug.js:4250
Ext.define.initComponent ext-all-debug.js:53582
Base.implement.callParent ext-all-debug.js:4250
Ext.define.initComponent ext-all-debug.js:126581
Ext.define.constructor ext-all-debug.js:29304
Base.implement.callParent ext-all-debug.js:4250
Ext.define.constructor ext-all-debug.js:33278
constructor ext-all-debug.js:4883
Ext.apply.widget ext-all-debug.js:5703
Ext.define.create ext-all-debug.js:21751
Ext.define.lookupComponent ext-all-debug.js:37477
Ext.define.prepareItems ext-all-debug.js:37447
Ext.define.add ext-all-debug.js:37502
Ext.define.initItems ext-all-debug.js:37279
Ext.define.initComponent ext-all-debug.js:37262
Base.implement.callParent ext-all-debug.js:4250
Ext.define.initComponent ext-all-debug.js:68865
Ext.define.constructor ext-all-debug.js:29304
Base.implement.callParent ext-all-debug.js:4250
Ext.define.constructor ext-all-debug.js:33278
constructor ext-all-debug.js:4883

Monday, November 25, 2013

KeyRemap4MacBook implement XWindows auto select with Mouse Gestures.

I love the Xwindows feature that you can auto copy selected text from a cursor selection. So this is the scenario, when I select a piece of text I would like it to be stored in the buffer/clipboard with control-C after I lift my mouse button. I don't need the paste function however could easily be implemented as well.
With KeyRemap4MacBook your can rearrange your input events. Here the snippet I use for the TERMINAL application to do just so:
  <item>
   <name>Autoselect Copy</name>
   <identifier>private.autoselect_copy</identifier>
   <only>TERMINAL</only>
   <autogen>
    __PointingButtonToKey__
    PointingButton::LEFT, ModifierFlag::NONE,
    KeyCode::VK_MODIFIER_EXTRA1,

    Option::KEYTOKEY_BEFORE_KEYDOWN,
    KeyCode::VK_MOUSEKEY_LOCK_BUTTON_LEFT,
    KeyCode::VK_LOCK_EXTRA2_FORCE_ON,
    <!-- VK_LOCK_EXTRA2 is necessary for Middle Button to Command+Tab (Switch 
     Applications) -->

    Option::KEYTOKEY_AFTER_KEYUP,
    KeyCode::VK_MOUSEKEY_LOCK_BUTTON_ALL_FORCE_OFF,
    KeyCode::C, ModifierFlag::COMMAND_L,
    KeyCode::VK_LOCK_EXTRA2_FORCE_OFF
   </autogen>
  </item>

After this I can paste the text... in this example my stickies.

Sunday, November 24, 2013

Extracting images from PDF and removing whitespace.

Two tools you need
  1. ImageMagick (convert) - http://www.imagemagick.org/script/binary-releases.php
  2. pdfimages - http://en.wikipedia.org/wiki/Pdfimages
Here the order:
  570  pdfimages ../../20120101.pdf 20120101
  571  convert *.ppm -fuzz 7% -trim ../20120101-%d.jpg

Tuesday, November 19, 2013

WLSTException: Error occured while performing save : Cannot call Edit functions when you are not in the Edit tree

I'm getting the following message for my weblogic script .... what to do next?
Create mbean Properties with name user
INFO: Saving domain
Problem invoking WLST - Traceback (innermost last):
File "/installables/met10.3/met/wdm/1_02/bin/configure_domain_9.py", line 81, in ?
File "", line 405, in save
File "", line 1744, in raiseWLSTException
WLSTException: Error occured while performing save : Cannot call Edit functions when you are not in the Edit tree.
Try wrapping your work in a session like this....
edit()
startEdit(-1,-1,'false')
..
...
..
save()
activate()

Thursday, October 24, 2013

Getting Wordpress Content without Theme and Raw Data only

I have this knowledge base stashed away in blog format on a wordpress site. I would like to use the contents in a support page external to this site using EXTJS. How do I get the Wordpress Content without Theme but just the content. You would think its easy however .... so here the end result. Plop this in the root directory of the wordpress installation (where the wp-config.php resides).
<?php
# load the wp system
require ('wp-config.php');
# create the original request from the client
$url = 'http://'.$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
# extract the post id
$page_id = url_to_postid($url);
echo '';
# fetch post and echo it to the outputstream.
$page_data = get_post($page_id);
echo $page_data->post_content;
?>
NOTE: make sure this new file content.php has permissions 744 chmodded otherwise it won't execute So now you can do the following:
  • For formatted output: http://mywordpress.org/?p=2049
  • For unformatted output: http://mywordpress.org/content.php?p=2049

Wednesday, July 24, 2013

Querying Oracle OID LDAP for the real serivce name and TNS details for JDBC

I have a wonderful cloud instance and a database, however on different segments and somehow dear firewall does not allow me to connect...
jdbc:oracle:thin:@ldap://oidprd.gss.mycompany.com:389/fxgdev65,cn=OracleContext,dc=mycompany,dc=com
At the boot of the weblogic server it sends a warning that the targeted jdbc pool cannot create a connection...
     
How to get the TNS name? Ever heard of curl.... thats the way to go (of course you would need openldap libraries loaded... which on my Mac OSX is the case)
$ curl -0 ldap://oidprd.gss.mycompany.com:389/cn=fxgdev65,cn=OracleContext,dc=mycompany,dc=com
DN: cn=fxgdev65,cn=OracleContext,dc=mycompany,dc=com
 objectclass: orclNetService
 objectclass: top

 orclnetdescstring: (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=fxgdev65.mycompany.com)(PORT=1527)))(CONNECT_DATA=(SERVICE_NAME=FXGDEV65.MYCOMPANY.COM)(SRVR=DEDICATED)))

 cn: fxgdev65
NOTE: you cannot just use the URI definition of the JDBC url, you need to add the cn= before the service you want to lookup So there you go ... now lets put that after the 'at' sign...
jdbc:oracle:thin://(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=fxgdev65.mycom.com)(PORT=1527)))(CONNECT_DATA=(SERVICE_NAME=FXGDEV65.MYCOMPANY.COM)(SRVR=DEDICATED)))

Saturday, July 13, 2013

WebLogic Password Encryption / Recovery

Put this in the startup in the JAVA_OPTIONS
-Dweblogic.system.RemoveBootIdentity=true -Dweblogic.management.username=weblogic -Dweblogic.management.password=weblogic -Dweblogic.system.StoreBootIdentity=false
$ java -cp /opt/weblogic/wl10.3.2/wlserver_10.3/server/lib/weblogic.jar -Dweblogic.RootDirectory=/opt/my/domain/here -Dweblogic.management.allowPasswordEcho=true weblogic.security.Encrypt Password: MY_PASSWORD

Wednesday, July 3, 2013

Wiring a combo box populating two fields by means of events.

We have a 'citycombo' with store attached that has a record with the name and the state where the city resides. For example: name : 'Springfield', state : 'MA'. The selection of Springfield, MA from the city combo will populate the state field (which is freeform). How to wire the events. Flow; catch the select event, lookup the state field by means of its id 'stateId' and set the value of the field found....
   }, {
     'xtype' : 'citycombo',
     'name' : 'city',
     'fieldLabel' : 'city',
     listeners : {
      "select" : function(k, rs) {
       console.log("%o %o", k, rs);
       if (rs.length) {
        me.getComponent('iState').setValue(rs[0].get('state'));
       }
      }

     },

   }, {
     'xtype' : 'textfield',
     'id' : 'iState',
     'name' : 'state',
     'fieldLabel' : 'state',

   },

Monday, July 1, 2013

Grid - Form and Filtering in ExtJS4 and record release.

Components we have ... [1] one grid - with table of query results [2] one form - for details when row is selected in the grid [3] one check - box The check box 'Incl' will apply a filter based on the checked value. If you selected a record and show it in the form there will be an error occuring on the handler when using the filtering on the store like this.
   }, {
     xtype : 'checkbox',
     boxLabel : 'Incl. Archive',
     handler :  function(_old, _new) {
       var filter = {};
       var _store_ = Ext.getStore('GridStore');
       // release any loaded record bound to form.
       if (!_new) {
        filter = { property : 'my_field', value : { '!=' : 'ARC'}};
        _store_.filter(filter);
       }
       else {
        _store_.clearFilter();
       }
     }
TypeError: record is undefined
createRelayer()ext-all-debug.js (line 11282)
fire()ext-all-debug.js (line 9677)
continueFireEvent(eventName="selectionchange", args=[Object { events={...}, views=[1], modes={...}, more...}, []], bubbles=undefined)ext-all-debug.js (line 11035)
fireEventArgs(eventName="selectionchange", args=[Object { events={...}, views=[1], modes={...}, more...}, []])ext-all-debug.js (line 11013)
fireEvent(eventName="selectionchange")ext-all-debug.js (line 10999)
maybeFireSelectionChange(fireEvent=true)ext-all-debug.js (line 92334)
doDeselect(records=[Object { raw={...}, modified={...}, data={...}, more...}], suppressEvent=undefined)ext-all-debug.js (line 92269)
deselect(records=Object { raw={...}, modified={...}, data={...}, more...}, suppressEvent=undefined)ext-all-debug.js (line 92155)
handler(_old=Object { xtype="checkbox", boxLabel="Incl. Archive", initialConfig={...}, more...}, 
The reason is that the form will "hold" the record that was selected in the grid. To solve this we need to deselect the record, but that's not all. We also need to prevent the 'selectionchange' event from occurring, hence suspending the events on the selection model would also need to be applied. The new handler code for the checkbox is:
     handler :  function(_old, _new) {
       var filter = {};
       var _store_ = Ext.getStore('TerritoryAddressStore');
       // release any loaded record bound to form.
       grid.getSelectionModel().suspendEvents();
       grid.getSelectionModel().deselect(form.getRecord());
       if (!_new) {
        filter = { property : 'my_field', value : { '!=' : 'ARC'}};
        _store_.filter(filter);
       }
       else {
        _store_.clearFilter();
       }
       grid.getSelectionModel().resumeEvents();
      
     }

Wednesday, June 26, 2013

Catalyst Schema generation for Oracle and specifying the dbi url notation

Getting connected to Oracle with Catalyst and generating the model and schema classes. What if you have a funky setup? Here the notation for host, port and sid locations on a public check (ie connect one user, schema is owned by another)
$ script/pmi_create.pl model PMI DBIC::Schema Schema::DBI create=static db_schema=GOG_SCHEMA 'dbi:Oracle:sid=DDB00334;host=ddb00334.google.com;port=1526' 'GOG_APP' 'MAG_APP'
At times explicitly defining the schema does not work. An alternate solution would be to define '%' as the schema (meaning any):
$  script/pmi_create.pl model PMI DBIC::Schema Schema::PMI create=static db_schema=% debug=true 'dbi:Oracle:sid=DDB00334;host=ddb00334.google.com;port=1526' 'GOG_APP' 'MAG_APP'

Sunday, May 12, 2013

Regex Recursive Syntax

Find all occurances of hostname in a file. Root Expression:
([\w\.-0-9]+company.com)(?:"|/|<)
Example:
find . -name '*.xml' -exec perl -ne '@x=m!([\w\.-0-9]+company.com)(?:"|/|<)!xsmgi;print join("\n",@x), "\n" if @x;' {} \; | sort | uniq

Friday, April 19, 2013

find and the -printf argument formats in relation with xargs -n

Directives
%k size in 1K , %b in 512-byte blocks , %s in bytes. 
%d depth in the directory tree; 0 i.e. the file is a command line argument. 
%h Leading directories of file's name (all but the last element). 
%f name with any leading directories removed (only the last element). 
%p name. 
%P File's name with the name of the command line argument under which it was found removed. 
%H Command line argument under which file was found. 
%F Type of the filesystem the file is on; this value can be used for -fstype. 
%g group name, or numeric group ID if the group has no name. 
%G numeric group ID. 
%i inode number 
%l Object of symbolic link (empty string if not a symbolic link). 
%m permission bits (in octal). 
%n Number of hard links to file. 
%u owner, or numeric user ID if the user has no name. %U numeric user ID. 
A % character followed by any other character is discarded (the other character is output).

Wednesday, April 10, 2013

Ant Mojo Debuging: turning on ant-tasks logging from a maven-plugin or command line.

Here you have a legacy ant build.xml that you would like to integrate as an Ant Mojo (which is not the same as the antrun-plugin). How can we switch on the debugging from maven on the ant side... following the tutorial we create a hello ant execution... and this results in the hello.build.xml and hello.mojos.xml. Next we skip to the "Built It! Run It!" section and change the following to our projects pom.xml that is using the hello plugin.
$ mvn org.myproject.plugins:hello-plugin:hello
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Hello Plugin 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- hello-plugin:1.0-SNAPSHOT:hello (default-cli) @ hello-plugin ---

hello:
     [echo] Hello, World
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.410s
[INFO] Finished at: Wed Apr 10 09:53:12 EDT 2013
[INFO] Final Memory: 3M/554M
[INFO] ------------------------------------------------------------------------
Now change the call and add -DantMessageLevel=[info|debug|trace].
$ mvn org.myproject.plugins:hello-plugin:hello -DantMessageLevel=debug
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Hello Plugin 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- hello-plugin:1.0-SNAPSHOT:hello (default-cli) @ hello-plugin ---
Project base dir set to: /Users/tmp
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile /var/folders/kh/njhg0wmx1d74cf08gds7jclc0000gp/T/plexus-ant-component5007171426381409971.build.xml with URI = file:///var/folders/kh/njhg0wmx1d74cf08gds7jclc0000gp/T/plexus-ant-component5007171426381409971.build.xml
Setting ro project property: ant.file.null -> /var/folders/kh/njhg0wmx1d74cf08gds7jclc0000gp/T/plexus-ant-component5007171426381409971.build.xml
Project base dir set to: /Users/akaan/tmp
 +Target: 
 +Target: hello
Adding reference: project
Adding reference: session
Adding reference: mojoExecution
Setting ro project property: messageLevel -> debug
Setting ro project property: basedir -> /Users/tmp
Build sequence for target(s) `hello' is [hello]
Complete build sequence is [hello, ]

hello:
     [echo] Hello, World
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.413s
[INFO] Finished at: Wed Apr 10 09:55:09 EDT 2013
[INFO] Final Memory: 3M/554M
[INFO] ------------------------------------------------------------------------
Or if you need to pass the configuration item in the plugin definition itself use messageLevel.
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.myproject.tests</groupId>
  <artifactId>hello-plugin-tests</artifactId>
  <version>1.0</version>
  
  <name>Test Project</name>
  
  <build>
    <plugins>
      <plugin>
        <groupId>org.myproject.plugins</groupId>
        <artifactId>hello-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
        
        <configuration>
          <name>John</name>


          <messageLevel>debug</messageLevel> 


        </configuration>
        
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>one</goal>
              <goal>two</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

Thursday, March 28, 2013

onliner - JAXBElement XJC Bindings and XMLRootElement creation for any schema

Some schema's do not get generated with the XMLRootElements which can get you into trouble marshalling Java 2 XML. See the error below
Caused by: javax.xml.bind.MarshalException
 - with linked exception:
[com.sun.istack.internal.SAXException2: unable to marshal type "com.tibco.xmlns.applicationmanagement.ApplicationType" as an element because it is missing an @XmlRootElement annotation]
 at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:317)
 at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:243)
 at org.springframework.oxm.jaxb.Jaxb2Marshaller.marshal(Jaxb2Marshaller.java:626)
 ... 25 more
Caused by: com.sun.istack.internal.SAXException2: unable to marshal type "com.tibco.xmlns.applicationmanagement.ApplicationType" as an element because it is missing an @XmlRootElement annotation
 at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:216)
 at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:286)
 at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:462)
 at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:314)
 ... 27 more
[ERROR] 
With the XJC bindings we can fix this however can be tedious going thru all the elements.... Boring.... so lets make a oneliner.... Here a one liner that will solve that and will generate the annotation section for your xcj.bindings or jaxb.bindings... Generating the XMLRootElement on bindings (requirements for perl will be XML::Simple see cpan)
perl -MXML::Simple -e 'BEGIN { use Data::Dumper; } $x=XMLin("./src/main/schema/5.5/ApplicationManagement.xsd");foreach (keys %{$x->{"complexType"}}) { printf "<jaxb:bindings node=\"xs:complexType[\@name=%c%s%c]\">
<annox:annotate><annox:annotate annox:class=\"javax.xml.bind.annotation.XmlRootElement\" name=\"%s\"/></annox:annotate></jaxb:bindings>\n",0x27,$_,0x27,$_ if $_; };'
Generates the output on the console:
<jaxb:bindings node="xs:complexType[=ActionType]"><annox:annotate><annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="ActionType"/></annox:annotate></jaxb:bindings>
<jaxb:bindings node="xs:complexType[=ServiceType]"><annox:annotate><annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="ServiceType"/></annox:annotate></jaxb:bindings>
<jaxb:bindings node="xs:complexType[=ServiceInstanceType]"><annox:annotate><annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="ServiceInstanceType"/></annox:annotate></jaxb:bindings>
<jaxb:bindings node="xs:complexType[=anyObject]"><annox:annotate><annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="anyObject"/></annox:annotate></jaxb:bindings>
<jaxb:bindings node="xs:complexType[=ApplicationType]"><annox:annotate><annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="ApplicationType"/></annox:annotate></jaxb:bindings>
<jaxb:bindings node="xs:complexType[=NVPairType]"><annox:annotate><annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="NVPairType"/></annox:annotate></jaxb:bindings>
<jaxb:bindings node="xs:complexType[=RepoInstanceType]"><annox:annotate><annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="RepoInstanceType"/></annox:annotate></jaxb:bindings>
<jaxb:bindings node="xs:complexType[=RemoteRepoInstanceType]"><annox:annotate><annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="RemoteRepoInstanceType"/></annox:annotate></jaxb:bindings>
<jaxb:bindings node="xs:complexType[=EventType]"><annox:annotate><annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="EventType"/></annox:annotate></jaxb:bindings>
<jaxb:bindings node="xs:complexType[=BWServiceType]"><annox:annotate><annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="BWServiceType"/></annox:annotate></jaxb:bindings>
Signings-MacBook-Pro:tibco-appmanage-schema $ 
THe end result as a XJC bindings file... which can be included in your XJC generation, in my case the maven plugin:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:annox="http://annox.dev.java.net"
  xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
  version="2.1">
  <jaxb:bindings schemaLocation="ApplicationManagement.xsd"
    node="/xs:schema">
    <jaxb:globalBindings generateIsSetMethod="true"
      collectionType="java.util.ArrayList">
    </jaxb:globalBindings>
    <jaxb:bindings node="xs:complexType[@name=ActionType]">
      <annox:annotate>
        <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement"
          name="ActionType" />
      </annox:annotate>
    </jaxb:bindings>
    <jaxb:bindings node="xs:complexType[@name=ServiceType]">
      <annox:annotate>
        <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement"
          name="ServiceType" />
      </annox:annotate>
    </jaxb:bindings>
    <jaxb:bindings node="xs:complexType[@name=ServiceInstanceType]">
      <annox:annotate>
        <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement"
          name="ServiceInstanceType" />
      </annox:annotate>
    </jaxb:bindings>
    <jaxb:bindings node="xs:complexType[@name=anyObject]">
      <annox:annotate>
        <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement"
          name="anyObject" />
      </annox:annotate>
    </jaxb:bindings>
    <jaxb:bindings node="xs:complexType[@name=ApplicationType]">
      <annox:annotate>
        <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement"
          name="ApplicationType" />
      </annox:annotate>
    </jaxb:bindings>
    <jaxb:bindings node="xs:complexType[@name=NVPairType]">
      <annox:annotate>
        <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement"
          name="NVPairType" />
      </annox:annotate>
    </jaxb:bindings>
    <jaxb:bindings node="xs:complexType[@name=RepoInstanceType]">
      <annox:annotate>
        <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement"
          name="RepoInstanceType" />
      </annox:annotate>
    </jaxb:bindings>
    <jaxb:bindings node="xs:complexType[@name=RemoteRepoInstanceType]">
      <annox:annotate>
        <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement"
          name="RemoteRepoInstanceType" />
      </annox:annotate>
    </jaxb:bindings>
    <jaxb:bindings node="xs:complexType[@name=EventType]">
      <annox:annotate>
        <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement"
          name="EventType" />
      </annox:annotate>
    </jaxb:bindings>
    <jaxb:bindings node="xs:complexType[@name=BWServiceType]">
      <annox:annotate>
        <annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement"
          name="BWServiceType" />
      </annox:annotate>
    </jaxb:bindings>
  </jaxb:bindings>
</jaxb:bindings>
And the declaration of the maven plugin....
      <plugin>
        <groupId>org.jvnet.jaxb2.maven2</groupId>
        <artifactId>maven-jaxb2-plugin</artifactId>
        <version>0.8.3</version>
        <executions>
          <execution>
            <id>generate-domain1</id>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <strict>true</strict>
          <schemaDirectory>src/main/schema/${schema.version}</schemaDirectory>
          <schemaIncludes>
            <value>scm-tibco-project.xsd</value>
          </schemaIncludes>
          <bindingIncludes>
            <include>xjc.bindings</include>
          </bindingIncludes>
          <verbose>true</verbose>
          <extension>true</extension>
          <args>
            <arg>-Xannotate</arg>
            <arg>-Xequals</arg>
            <arg>-XtoString</arg>
            <arg>-XhashCode</arg>
          </args>
          <generateDirectory>${project.build.directory}/generated-sources/xjc
          </generateDirectory>
          <plugins>
            <plugin>
              <groupId>org.jvnet.jaxb2_commons</groupId>
              <artifactId>jaxb2-basics</artifactId>
              <version>0.6.0</version>
            </plugin>
            <plugin>
              <groupId>org.jvnet.jaxb2_commons</groupId>
              <artifactId>jaxb2-basics-annotate</artifactId>
              <version>0.6.0</version>
            </plugin>
          </plugins>
        </configuration>
      </plugin>

Saturday, March 23, 2013

Running perl system and cpan as non-root user...

The easiest method I have found so far is to say
wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
or for non wgetters..
curl -L http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
Then:
eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`
echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.profile
On Linux Systems
echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.bash_profile
This assumes your profile is named .profile, you may need to change that to be .bash_profile, .bashrc, etc. After that you can install modules by saying
cpanm Module::Name
and simply use them the same way you would if the were installed in the root directories. In some cases the install does not work... then you can split things up (for the http_proxy it seems it explicitly needs 'http:' or 'https:'). The second item would add the ignore expired certificate on the wget command.
export http_proxy=http://my.proxy.org:3128
export https_proxy=http://my.proxy.org:3128
export PERL5LIB=~/perl5/lib/perl5/
wget --no-check-certificate -O cpan.pl http://cpanmin.us
perl cpan.pl -l ~/perl5 App::cpanminus local::lib
At times this even fails and use --force
perl cpan.pl --force -l ~/perl5 App::cpanminus local::lib

Monday, March 18, 2013

Cropping Margins Existing Template PDF with PDFTK

The key of the re-centering or re-margining is the /Mediabox reference... we have to pan the original template in PDF... ON THE UNCOMPRESSED PDF... The media box [0,0,612,792]
  • Move the box up: [0 -70 612 722]
  • Move the box down: [0 70 612 862]
  • Move the box left: [70 0 682 792]
  • Move the box right: [-70 0 542 792]
 1273  pdftk S89E.pdf output S89E.unc.pdf uncompress
 1274  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[-70 0 542 812\]/g'< S89E.unc.pdf > S89.resized.pdf
Examples
 1301  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[0 70 612 862\]/g'< S89E.unc.pdf > S89.resized.pdf
 1304  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[0 -70 612 722\]/g'< S89E.unc.pdf > S89.resized.pdf
 1305  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[70 0 682 792\]/g'< S89E.unc.pdf > S89.resized.pdf
 1306  sed 's/MediaBox \[0 0 612 792\]/MediaBox \[-70 0 542 792\]/g'< S89E.unc.pdf > S89.resized.pdf

Wednesday, March 13, 2013

mampstack-5.3.22-0 and OCI8 Oracle on OSX 10.7.5

Installed mampstack-5.3.22-0 from bitnami.org, all defaults.... (NOTE: I tried MAMP/MAMP-PRO first and this product was not agile enough to install the OCI8 module, so stay away, unless you like to puzzle your way thru the installation)

Installed Oracle's instantclient for MacOSX x86_64 editions on oracles download site (login required)

  • instantclient-sdk-macos.x64-11.2.0.3.0.zip
  • instantclient-sqlplus-macos.x64-11.2.0.3.0.zip
  • instantclient-basic-macos.x64-11.2.0.3.0.zip
  • instantclient-tools-macos.x64-11.2.0.3.0.zip

Installation InstantClient Oracle on x86_64

Unpack all downloaded package (located in my case under ~/Downloads)
$ mkdir -p /System/Library/Oracle/
$ cd /System/Library/Oracle/
$ unzip ~/Downloads/instantclient*.zip .
Next linking all of the libraries to the general area.
$ cd /usr/lib
$ ls  /System/Library/Oracle/instantclient_11_2/*.dylib | xargs -I% -t ln -s % .
ln -s /System/Library/Oracle/instantclient_11_2/libnnz11.dylib .
ln -s /System/Library/Oracle/instantclient_11_2/libociei.dylib .
ln -s /System/Library/Oracle/instantclient_11_2/libocijdbc11.dylib .
ln -s /System/Library/Oracle/instantclient_11_2/libsqlplus.dylib .
ln -s /System/Library/Oracle/instantclient_11_2/libsqlplusic.dylib .
The result symlinked the libraries
$ ls -lrt
total 40
lrwxr-xr-x  1 akaan  wheel  60 Mar 13 13:15 libsqlplusic.dylib -> /System/Library/Oracle/instantclient_11_2/libsqlplusic.dylib
lrwxr-xr-x  1 akaan  wheel  58 Mar 13 13:15 libsqlplus.dylib -> /System/Library/Oracle/instantclient_11_2/libsqlplus.dylib
lrwxr-xr-x  1 akaan  wheel  60 Mar 13 13:15 libocijdbc11.dylib -> /System/Library/Oracle/instantclient_11_2/libocijdbc11.dylib
lrwxr-xr-x  1 akaan  wheel  56 Mar 13 13:15 libociei.dylib -> /System/Library/Oracle/instantclient_11_2/libociei.dylib
lrwxr-xr-x  1 akaan  wheel  56 Mar 13 13:15 libnnz11.dylib -> /System/Library/Oracle/instantclient_11_2/libnnz11.dylib
Follow the same process for other items
$ cd /usr/lib
$ sudo ls  /System/Library/Oracle/instantclient_11_2/*.dylib.* | xargs -I% -t ln -s % .
Next linking the include header files.
$ cd /usr/include
$ sudo ls  /System/Library/Oracle/instantclient_11_2/sdk/include/*.h | xargs -I% -t ln -s % .
Next linking sqlplus
$ cd /usr/bin
$ sudo ln -s /System/Library/Oracle/instantclient_11_2/sqlplus .
And last relink the versioned cntl file
$ cd /usr/lib
$ sudo ln -s libclntsh.dylib.11.1 libclntsh.dylib

Installation oci8 module on mampstack-5.3.22-0

Next tying in the oci8 module for PHP connectivity... First validate that sqlplus works otherwise you waste time with a broken instant client installation.
MacBook-Pro:~ johnsmith$ sqlplus
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 13 14:15:59 2013
Copyright (c) 1982, 2012, Oracle.  All rights reserved.
Enter user-name: 
Next move to the mampstack installation directory under the php area and install the oci8 package, when prompted for the installation of the instantclient use instantclient,/usr/lib
MacBook-Pro:bin johnsmith$ cd /Applications/mampstack-5.3.22-0
MacBook-Pro:mampstack-5.3.22-0 johnsmith$ cd ./php/bin
MacBook-Pro:bin johnsmith$ ./pecl install oci8
downloading oci8-1.4.9.tgz ...
Starting to download oci8-1.4.9.tgz (169,255 bytes)
.....................................done: 169,255 bytes
10 source files, building
WARNING: php_bin /Applications/mampstack-5.3.22-0/php/bin/php appears to have a suffix /bin/php, but config variable php_suffix does not match
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Can't load '/Applications/mampstack-5.3.22-0/perl/lib/5.8.8/darwin-2level/auto/Data/Dumper/Dumper.bundle' for module Data::Dumper: dlopen(/Applications/mampstack-5.3.22-0/perl/lib/5.8.8/darwin-2level/auto/Data/Dumper/Dumper.bundle, 1): Symbol not found: _PL_compiling
  Referenced from: /Applications/mampstack-5.3.22-0/perl/lib/5.8.8/darwin-2level/auto/Data/Dumper/Dumper.bundle
  Expected in: dynamic lookup
 at /Applications/mampstack-5.3.22-0/perl/lib/5.8.8/darwin-2level/Data/Dumper.pm line 36
Compilation failed in require at /usr/bin/../share/autoconf/Autom4te/C4che.pm line 35.
BEGIN failed--compilation aborted at /usr/bin/../share/autoconf/Autom4te/C4che.pm line 35.
Compilation failed in require at /usr/bin/autom4te line 43.
BEGIN failed--compilation aborted at /usr/bin/autom4te line 43.
ERROR: `phpize' failed
MacBook-Pro:bin johnsmith$ 

OCI8 - MAMPstack-5.3.22-0 - Perl Issues

To resolve this error and end up using the default perl version (in 10.7.5 installation that I have its 5.12.x)
MacBook-Pro:bin$ perl -v
This is perl 5, version 12, subversion 3 (v5.12.3) built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)
Copyright 1987-2010, Larry Wall
Comment out the PERL5LIB definition in /Applications/mampstack-5.3.22-0/scripts/setenv.sh like this:
.....
##### PERL ENV #####
#PERL5LIB="/Applications/mampstack-5.3.22-0/perl/lib/5.8.8:/Applications/mampstack-5.3.22-0/perl/lib/site_perl/5.8.8:/Applications/mampstack-5.3.22-0/perl/lib/5.8.8/darwin-2level:/Applications/mampstack-5.3.22-0/perl/lib/site_perl/5.8.8/darwin-2level"
#export PERL5LIB
LC_ALL=en_US
export LC_ALL
.....
Close your terminal and startup a new one (flushing the environment); and retry the new settings....
MacBook-Pro:bin johnsmith$ cd /Applications/mampstack-5.3.22-0
MacBook-Pro:mampstack-5.3.22-0 johnsmith$ cd ./php/bin
MacBook-Pro:bin johnsmith$ ./pecl install oci8
downloading oci8-1.4.9.tgz ...
Starting to download oci8-1.4.9.tgz (169,255 bytes)
.....................................done: 169,255 bytes
10 source files, building
WARNING: php_bin /Applications/mampstack-5.3.22-0/php/bin/php appears to have a suffix /bin/php, but config variable php_suffix does not match
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] : instantclient,/usr/lib
building in /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9
running: /private/tmp/pear/temp/oci8/configure --with-oci8=instantclient,/usr/lib
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i386-apple-darwin11.4.2
checking host system type... i386-apple-darwin11.4.2
checking target system type... i386-apple-darwin11.4.2
checking for PHP prefix... /Applications/mampstack-5.3.22-0/php
checking for PHP includes... -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib
checking for PHP extension directory... /Applications/mampstack-5.3.22-0/php/lib/php/extensions
checking for PHP installed headers prefix... /Applications/mampstack-5.3.22-0/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for Oracle Database OCI8 support... yes, shared
checking PHP version... 5.3.22, ok
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for long int... yes
checking size of long int... 8
checking checking if we're on a 64-bit platform... yes
checking Oracle Instant Client directory... /usr/lib
checking Oracle Instant Client SDK header directory... /usr/include
checking Oracle Instant Client library version compatibility... 11.1
checking for ld used by cc... /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld
checking if the linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) is GNU ld... no
checking for /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm output from cc object... rm: conftest.dSYM: is a directory
ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin11.4.2 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/temp/oci8/oci8.c -o oci8.lo
mkdir .libs
 cc -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/oci8/oci8.c  -fno-common -DPIC -o .libs/oci8.o
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/temp/oci8/oci8_lob.c -o oci8_lob.lo
 cc -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/oci8/oci8_lob.c  -fno-common -DPIC -o .libs/oci8_lob.o
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/temp/oci8/oci8_statement.c -o oci8_statement.lo
 cc -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/oci8/oci8_statement.c  -fno-common -DPIC -o .libs/oci8_statement.o
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/temp/oci8/oci8_collection.c -o oci8_collection.lo
 cc -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/oci8/oci8_collection.c  -fno-common -DPIC -o .libs/oci8_collection.o
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/temp/oci8/oci8_interface.c -o oci8_interface.lo
 cc -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/oci8/oci8_interface.c  -fno-common -DPIC -o .libs/oci8_interface.o
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=link cc -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -o oci8.la -export-dynamic -avoid-version -prefer-pic -module -rpath /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/modules  oci8.lo oci8_lob.lo oci8_statement.lo oci8_collection.lo oci8_interface.lo -lclntsh
cc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/oci8.so -bundle  .libs/oci8.o .libs/oci8_lob.o .libs/oci8_statement.o .libs/oci8_collection.o .libs/oci8_interface.o  -lclntsh
dsymutil .libs/oci8.so || :
creating oci8.la
(cd .libs && rm -f oci8.la && ln -s ../oci8.la oci8.la)
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=install cp ./oci8.la /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/modules
cp ./.libs/oci8.so /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/modules/oci8.so
cp ./.libs/oci8.lai /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/modules/oci8.la
----------------------------------------------------------------------
Libraries have been installed in:
   /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
     during execution

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9" install
Installing shared extensions:     /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0/php/lib/php/extensions/
running: find "/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9" | xargs ls -dils
20501804   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9
20502308   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications
20502309   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0
20502310   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0/php
20502311   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0/php/lib
20502312   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0/php/lib/php
20502313   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0/php/lib/php/extensions
20502314 384 -rwxr-xr-x  1 johnsmith  wheel  194492 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0/php/lib/php/extensions/oci8.so

Build process completed successfully
Installing '/Applications/mampstack-5.3.22-0/php/lib/php/extensions/oci8.so'
install ok: channel://pecl.php.net/oci8-1.4.9
configuration option "php_ini" is not set to php.ini location
You should add "extension=oci8.so" to php.ini
MacBook-Pro:bin johnsmith$ 

Altering PHP.ini

If you see messages like this one in your /Applications/mampstack-5.3.22-0/apache2/logs/error_log, it means that your oci8 shared object cannot be loaded by the Apache instance;
[Wed Mar 13 14:02:52 2013] [warn] RSA server certificate CommonName (CN) `signings-macbook-pro.local' does NOT match server name!?
PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/mampstack-5.3.22-0/php/lib/php/extensions/oci8' - dlopen(/Applications/mampstack-5.3.22-0/php/lib/php/extensions/oci8, 9): image not found in Unknown on line 0
Do the following
MacBook-Pro:etc johnsmith$ cd /Applications/mampstack-5.3.22-0/php/etc
MacBook-Pro:etc johnsmith$ vi php.ini 
add oci8 extension
.....
; Local Variables:
; tab-width: 4
; End:
;extension=oauth.so
;extension=memcache.so
;extension=uploadprogress.so
extension=apc.so
extension=oci8.so
.....
MacBook-Pro:etc johnsmith$ chmod 755 /Applications/mampstack-5.3.22-0/php/lib/php/extensions/oci8.so
Make sure that the extension is defined at the proper section otherwise it will not load correctly with the same image not found message in the error log (/Applications/mampstack-5.3.22-0/apache2/logs/error_log).

My First Oracle Test OCI8-PHP-MAMP

First the connect string; if you have trouble with the connect string try the tnsping utility (unfortunately not part of the instantclient).
$ tnsping PMI_SVC1_DEV
TNS Ping Utility for Linux: Version 10.2.0.4.0 - Production on 13-MAR-2013 18:26:22
Copyright (c) 1997,  2007, Oracle.  All rights reserved.
Used parameter files:
/opt/oracle/product/10.2.0.4/network/admin/sqlnet.ora
Used LDAP adapter to resolve the alias
Attempting to contact (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=[hostname])(PORT=[listener-port])))(CONNECT_DATA=(SERVICE_NAME=[servicename])(SRVR=DEDICATED)))
OK (0 msec)
Finally here an oracle.php file that can be dropped in the /Application//mampstack-5.3.22-0/apache2/htdocs directory. Open a browser and test the integration

Friday, March 1, 2013

Finding RDP machine after router flushed MAC IP table

They flushed the router tables again... where is my RDP machine.... Zenmap/nmap to the rescue... the only thing you need to know is the actual assigned windows name for your computer... and make sure your have it powered up... waiting for logon.. The nmap command would be something like this for scanning the 0-255 ip addresses on a 10.77.114.x
$ nmap -v -sn 10.77.114.1-255 -p 3389

Starting Nmap 6.25 ( http://nmap.org ) at 2014-01-03 07:47 EST
Failed to resolve given hostname/IP: sn.  Note that you can't use '/mask' AND '1-4,7,100-' style IP ranges. If the machine only has an IPv6 address, add the Nmap -6 flag to scan that.
Initiating Ping Scan at 07:47
Scanning 256 hosts [2 ports/host]
Completed Ping Scan at 07:47, 8.83s elapsed (256 total hosts)
Initiating Parallel DNS resolution of 256 hosts. at 07:47
Completed Parallel DNS resolution of 256 hosts. at 07:47, 0.40s elapsed
Nmap scan report for 10.77.114.0 [host down]
Nmap scan report for 10.77.114.2 [host down]
Nmap scan report for 10.77.114.3 [host down]

Discovered open port 3389/tcp on 10.77.114.35
Discovered open port 3389/tcp on 10.77.114.36
Discovered open port 3389/tcp on 10.77.114.148
Discovered open port 3389/tcp on 10.77.114.185
Discovered open port 3389/tcp on 10.77.114.196
Discovered open port 3389/tcp on 10.77.114.150
Discovered open port 3389/tcp on 10.77.114.154
Completed Connect Scan at 07:47, 1.00s elapsed (20 total ports)
$