One of the most common ways to search in SharePoint is to find a document based on a text managed property. SP2010 search is more scalable than SP2007 and one reason is the new feature of reducing storage space for text type managed properties. When creating a new text managed property you can set the “Reduce storage requirements for text properties by using a hash for comparison” option. If you do not set this option the “=” or LIKE operator will not work. You can only use the CONTAINS full text predicate function with the FullTextSQLQuery class or the “:” operator with the KeywordQuery class, both of which will return results where the term is located within the text. This does not produce an exact match.

To fix this issue open a power shell window from Start menu–>All Programs–>Microsoft SharePoint 2010 products–>SharePoint 2010 Management Shell and execute below script (as an example I’ve used ‘Title’ property, you can try other properties like Filename, Path, Author etc),

  1. $ssa=Get-SPEnterpriseSearchServiceApplication
  2. $mp=Get-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $ssa -Identity Title
  3. $mp.IsInDocProps=$true
  4. $mp.MaxCharactersInPropertyStoreIndex=450
  5. $mp.Update()

To verify browse to central administration (You can find a shortcut in Start menu–>All Programs–>Microsoft SharePoint 2010 products) and select “Manage service applications” under “Application Management”, select “Search service application” –> Metadata properties (under Queries and Results) and choose a property (for example: Filename) and see the option “Reduce storage requirements for text properties by using a hash for comparison” is checked and do a full crawl.

Performing a full crawl is mandatory! Without which changes will not take effect for searching.

Dealing with Java path on Linux environment often turns out be tricky/tedious task even for experienced users. Here I’ve tried to gather few simple steps to install and configure Java on Redhat/Fedora & Ubuntu linux environment.

  1. Download JRE from here
  2. Extract the downloaded archive file and locate the .bin file (for example: /opt/jre-1_5_0_xx-linux-i586.bin)
  3. Make the .bin file executable: chmod 755 jre-1_5_0_xx-linux-i586.bin and run the .bin file: /opt/jre-1_5_0_xx-linux-i586.bin
  4. Set the Java plugin for browser:
    mkdir -p ~/.mozilla/plugins (if this folder is missing)
    ln -s /opt/jre1.5.0_xx/plugin/i386/libnpjp2.so ~/.mozilla/plugins/
  5. Now need to make the Java executable available for the whole system:
    vim /etc/profile.d/java.sh
    Now paste the following options into the file, remember to enter a carriage return after these lines, then save it. Remember to replace the xx with the latest version you have downloaded:
    export JRE_HOME=/opt/jre1.5.0_xx
    export PATH=$JRE_HOME/bin:$PATH
  6. If you don’t have /etc/profile.d, use vim /etc/profile instead and export the updated path as in previous step
  7. Reload the Java path settings:
    sudo source /etc/profile.d/java.sh
  8. Verify the Java path:
    which java
    You will see something like this for example: /opt/jre1.5.0_09/bin/java
  9. This is specific to Fedora/Redhat (configuring the JRE to be used from the system’s JVM list):
    /usr/sbin/alternatives –install /usr/bin/java java /opt/jre1.5.0_xx/bin/java 2
    /usr/sbin/alternatives –config java
    After you have entered the last command, you’ll be asked to choose which Java software you want for your system. Just press 2 key and hit enter.
    And finally, just type this command to see if everything looks good and your system has a new Java Environment:
    /usr/sbin/alternatives –display java
     
  10. Now java -version should display the current java version being used
If you find something is not working or missing, feel free to comment.

How can a developer become a sensible/pragmatic programmer out of the blue?? I keep asking this question myself every time I commit a mistake! Though I had few points one should keep in mind as a mandatory check list while coding… it’s very easy to forget.

Here today am jotting down few important points to be a pragmatic programmer (following these strictly would lead to delighting results),

  1. Meet Functional Requirements
  2. Minimize the code changes
  3. Ensure no side effects because of the code changes
  4. Reuse of existing code
  5. Care for Simplicity and Maintenance – Use suitable Design Patterns
  6. Check for Consistency and Concurrency
  7. Refactor Code and look for Performance Optimization
  8. Proper Exception Handling – Don’t just consume Exceptions!
  9. Increase Code Readability by formatting – I use Eclipse default formatting
  10. Follow proper Documentation
  11. Unit Testing – Think of extreme test cases, consider Test Driven Development
  12. Maximize code/stage coverage
  13. Don’t skip Code Review
  14. Check-In code to Source Control Management regularly
  15. Eagerness and flexible enough to learn new things and adopt quickly

These points are from my own perspective… There are a lot of books out there in the market evangelising above points from different point of views and in detail. Personally I prefer “The Pragmatic Programmer” by Andrew Hunt and David Thomas.

You can find many more general tips here – Pragmatic Software Development Tips

Kindly let me know if am missing something.

Recently I got a chance to work on Microsoft SharePoint 2010 for a project… Err! Though am 100% newbie to SharePoint, figured few things quiet easily due to huge official documentation and articles from user groups.

Unfortunately, I was stuck in an issue for a pretty long time – The “System.IO.FileNotFoundException” while creating SPSite object. This scenario used to work perfect in a console application as the application is running locally and has got the full privileges to access SharePoint repository.

Issues arrived when I started using the snippet in a WCF service and consuming it from a remote client (Java or .NET). Thinking is there a simple way to create WCF service…?? Yes you’re right! Here it is CKSDev.

After Googling for long, found few possible solutions and nothing helped me!
Here they are,

  1. Check whether your application is using .NET version 3.5 and platform x64 (as SP2010 runs on 64-bit m/c)
  2. Try to use the application pool used by SharePoint web application itself
  3. And last but not least, check for the database permissions and site collection privileges
  4. Enclosing the code snippet within SPSecurity.RunWithElevatedPrivileges(delegate(){ … });

Someone else has faced the same issue but did not get any help from here!

May be I’m so dumb, finally got the recommendation to use SPContext.Current.Site instead of just instantiating SPSite.

You can find my detailed blog posts here! :)

Conclusion??
Yes, I can’t miss this one. One can instantiate and use SPSite without any issues, if an application would be running on a server locally (In case of SP 2010, even the consuming application needs to be a 64-bit process). If you are planning to use SP server-side object model – SPSite from a remote context, then try using SPContext.Current.Site instead. There are other alternatives to communicate with SP remotely using Client Object Model. Please give a try!

Finally the story ends with a smile…Accepting my ignorance!

Howdy folks,

I had presented a session on creating CXF based web service nearly a year back. Thought it would be of help to others  in need.

Web service development using Apache CXF

This short tutorial explains all possible ways of creating a SOAP based and makes use of SoapUI tool for generating and testing the service.

Enjoy!

NTLM (NT LAN Manager) is a suite of Microsoft security protocols that provides authentication, integrity, and confidentiality to users. There use to be days one would break his/her head to integrate Java and .NET through web services (authentication and authorization issues). Out there we have JCIFS, HTTPClient and what not? Often these does not provide sufficient documentation or it is scattered across or complex to understand at the first look…

To solve all these hiccups and provide relief to Java developer there is another simple yet powerful alternative to use the Authenticator! One needs to provide an implementation of this abstract class and make it as the default authenticator for communication channel…Voila! You are done…

Lets see an example,

/**
* Sample NTLM program
* @author Praveen
*/

package com.test.ntlm

import java.net.Authenticator;

public class NTLMTest{

    //Custom authenticator for SharePoint

    private static class SharePointAuthenticator extends Authenticator {

private String user;
private String pass;

public SharePointAuthenticator(String user, String pass) {
this.user = user;
this.pass = pass;
}

public PasswordAuthentication getPasswordAuthentication() {

return (new PasswordAuthentication(user, pass.toCharArray()));

}

   }

public static void main(String[] args){

Authenticator.setDefault(new SharePointAuthenticator(“domain\\user”, “password”));
// code snippet accessing SharePoint resources through web services

}

}

Hope the example was simple and straight enough. Have a nice day!

Today I faced a weird database error – Got minus one from a read call while connecting to an Oracle instance running remotely. The error message is very cryptic and not detailed – It is as simple as saying connection terminated at the peer abruptly. After googling for a while found this error could arise due to one of the follow reasons,

  • ACL is enabled on the database listener
    - You can follow these steps to avoid the error:
    1. Go to directory $ORACLE_HOME/network/admin
    2. Modify sqlnet.ora file with following parameter:
    tcp.validnode_checking = no
    3. If you don’t want to disable this, you can put the machine names as follows:
    tcp.invited_nodes=(machine1, machine2)
    4. Bounce the listener
  • Wrongly configured tnsname.ora and listener.ora
    - Below snippets are valid,
    #### TNSNAMES.ORA ######
    TEST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))  )
    (CONNECT_DATA =
    (SERVICE_NAME = ORCL)
    ))
    ###### END OF TNSNAMES.ORA ########### LISTENER.ORA #################
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = XYZ)))
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    )))SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (GLOBAL_DBNAME = ORCL)
    (ORACLE_HOME = C:\oracle\ora90)
    (SID_NAME = ORCL)))
    ######## END OF LISTENER.ORA ########
  • Low processes or shared pool size limit (Need to bounce the database after reconfiguring the parameters)
    - Alter system set SHARED_POOL_SIZE=150M (by default it would be Zero)
    - Alter system set PROCESSES=1000 SCOPE=SPFILE; (1000 is just a sample value)

Hope the details help you fixing the error. If there any other possibilities for the above stated error, kindly comment and let us know.

Follow

Get every new post delivered to your Inbox.