Friday, December 2, 2011

SharePoint 2010 Document Path Search with Contains

In short I do not believe it works or at least it doesn't work in how I think it should. Look at the following query:

SELECT WorkId, Title, FileName, Path
FROM Scope()
WHERE IsDocument = 1 AND "scope"='Test-Scope' AND (CONTAINS(path, '"file://testpath/test/%"'))
ORDER BY Rank Desc

I thought the above query would return all documents within the path that started with: file://testpath/test/

It does not. I stored all the document path information in SQL Server 2008 for the files that SharePoint indexed so that I could quickly run queries to determine the accuracy of SharePoint Path query counts. The SharePoint path queries produce too few or too many results every time. In the case I was testing with I had 1417 files (all of which SharePoint successfully indexed). The SharePoint Path query only returned a little over 1200. I am investigating the issue currently and when I have put together my thoughts on what I think is happening I will report back

Thursday, September 15, 2011

Oracle Datapump Export and Import to New Schema using schema_remap and the Affects on Java Stored Procedures

The situation:

Datapump export on Schema Named A. Datapump import to Schema Named B.  Schema A contains Java Stored Procedures. After importing to Schema B you get errors stating that the Java Stored Procedures cannot be resolved within Schema B.

A little PL/SQL script I wrote to run against Schema B after import to correct:

DECLARE
   CURSOR java_class_names
   IS
      SELECT name FROM user_java_classes;

   v_name   user_java_classes.name%TYPE;
BEGIN
   OPEN java_class_names;

   LOOP
      FETCH java_class_names INTO v_name;

      EXIT WHEN java_class_names%NOTFOUND;

      BEGIN
         EXECUTE IMMEDIATE 'alter java class "' || v_name 
           || '" resolver ((* B) (* public)) resolve' ;
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.put_line 
               ('catch comp errors due to dependencies');
      END;
   END LOOP;

   CLOSE java_class_names;
EXCEPTION
   WHEN OTHERS
   THEN
      IF java_class_names%ISOPEN
      THEN
         CLOSE java_class_names;
      END IF;

      RAISE;
END;

This updates the Java Class Resolver to Schema B. This should be handled by the schema_remap parameter on impdp, but unfortunately is not.

Tuesday, September 13, 2011

Acrobat 9.0 Batch Plug-in for Enhanced Bates Numbering

I have completed the basic functionality of the enhanced Bates Numbering plug-in for Acrobat 9.0.  I haven't tested the plug-in under version 10 yet.  Recall that I needed enhanced logging in the instance where the files are renamed post Bates stamping.  When a file is renamed I require the before and after names as well as complete path information for the respective files to be logged to a text file. A few interesting tidbits concerning this:

  1. You cannot get a handle to the default "Edit Batch Sequence" dialog that defines input/output locations concerning the PDFs you are trying to process. This is makes a kluge of things because I couldn't get a handle to the directories the user chose to process and output to as these are input fields on the dialog. I utilized the Acrobat SDK forums to verify my conclusions and my position was corroborated by an Adobe employee who monitors the forum. The only handle you have within the batch plug-in is that of the current document.
  2. The Acrobat API is adequately documented but only just so.  If your C/C++ is rusty don't get frustrated. Take your time and read the documentation thoroughly.  A hidden piece of documentation is the Adobe Dialog Manager API.  This is what allows you to construct custom dialog boxes within Acrobat and is a separate document from the general SDK.  The memset function is your friend and if you have forgotten, when using memset, memory is freed when the variable's scope is exited. Also refresh the memory on strcat, strncpy, strstr, strrchr, etc.  Null terminate those char arrays and careful with functions like strncpy that do not null terminate automagically upon completion.
  3. Remember the Acrobat API is heavy on abstraction since it supports multiple OS types and multiple versions of these OS types. 

Tuesday, August 30, 2011

Setting Up Acrobat 9 SDK Sample Plug-In Projects in Visual Studio 2010 C++

Download the Acrobat SDK for Acrobat 9 and extract/install.

The resolution:
  1. You will likely get an error complaining about the AcroSDKPIDir environment variable.
    • Create this environment variable and have it point to the plug_ins directory underneath your acrobat directory in program files
  2. Now go to Project Properties->Build Events->Post-Build Step
  3. In the Command Line property put
    • copy "D:\PathToYourProjectFolder\Debug\*.api" "$(AcroSDKPIDir)"
  4. Now go to Project Properties->Build Events->C/C++
  5. In Additional Include Directories include (your paths may vary):
    • D:\Acrobat\sdk91_v2_win\Adobe\Acrobat 9 SDK\Version 1\PluginSupport\Headers\API
    • D:\Acrobat\sdk91_v2_win\Adobe\Acrobat 9 SDK\Version 1\PluginSupport\Headers\SDK
    • D:\Acrobat\sdk91_v2_win\Adobe\Acrobat 9 SDK\Version 1\PluginSupport\Headers\3D
Enjoy....

Friday, August 26, 2011

Converting to AL32UTF8 Character Set from the Oracle Default of WE8MSWIN1252

The situation:
  1. Current database uses WE8MSWIN1252
  2. Migrating to new database, considering going to AL32UTF8 encoding.
  3. AL32UTF8 is an Oracle UTF8 encoding of the Unicode characater set. Hence it is multibyte.  WE8MSWIN1252 is a single byte character set.
  4. I want to use expdp/impdp to handle character set migration
What can go wrong? 
  1. A varchar2 field declared with a max length of 4000 that contains 4000 bytes, or close to it, and contains characters that are converted to multibyte representations on import will fail with an ORA-12899.  This is a complaint that the maximum length for the column has been exceeded.  Why? Remember VARCHAR2 fields are constrained to 4000 bytes, not 4000 characters.  Need proof? Create a sample database using the AL32UTF8 character set and try and declare a VARCHAR2(4000) column.  It will fail, regardless of whether or not you use character/byte level semantics when declaring the column ala VARCHAR2(4000 CHAR).
    • How To Fix:
      • Convert any column you perceive as close to its 4000 character limit to a CLOB.
      • You will need to precreate your tables in the schema, how?
        • imdp user/pass dumpfile=test.dmp content=metadata_only data_options=skip_constraint_errors schemas=your-schema
      • After precreating your schema, drop your offending varchar2 columns and then replace with CLOB columns.
        • alter table my-table add(clob_column_name CLOB DEFAULT EMPTY_CLOB() NOT NULL);
      • Run another data import
        • Do yourself a favor and disable constraints and drop indexes before running the import below.  
        • imdp user/pass dumpfile=test.dmp data_options=skip_constraint_errors table_exists_action=append schemas=your-schema content=data_only
In a nutshell:
  1. Export Schema
  2. Precreate tables
  3. Drop offending varchar2 columns
  4. Replace Dropped columns with CLOBs
  5. Do data only import.
  6. Test your application for any other issues.

Thursday, August 25, 2011

SharePoint 2010 and Office Web Apps View in Browser and ConversionError

Network administrator sends an email that notes the view in browser feature for OWA no longer works when opening documents from a SharePoint Document Library.  He thinks maybe the installation of SharePoint SP1 broke it.  I didn't even know we had OWA installed.  I do a little poking around and discover that Microsoft has issued SP1 for Office Web Apps and suggested he install.  The administrator does and he informs me it still doesn't work. Utilizing ULS Viewer I track down the error correlation ID to the error message in the logs. To summarize the message is: ConversionError.  I do a quick Google search to see if I can get lucky, luck is in short supply.  After stupidly looking at complicated possible causes I shoot off an email asking if he ran the "SharePoint Products Configuration Wizard" post OWA SP1 install. He did not.  Bingo.  I run the wizard and the problem is solved.

tl;dr
Be sure to run the SharePoint Products Configuration Wizard after installing Office Web Apps SP1, otherwise the view in browser feature will cause a "ConversionError".