Posts

Regular Expression Powerfull sample in java

We can use regular expression and to do large set of works as simple and single line code . In this example i will show you how the regular expression play a vital stage . I want to read a file and insert a new line (\n) at every 100 th character in that file content and write those changes in another file. Normally what i did first is written a code to read file line by line and written a sample piece of code to read position and insert the new line in that particular position then written in new file. Instead for write separate function i write an replaceAll with regular expression. The sample code given below, package com.shinnedhawks; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; public class REPower {     public static void main(String[] args) {         new REPower().replace();   ...

Javascript Remoting : Pass parameters from javascript to Salesforce standard object field

            Here we are going to pass the sobject from the java script to apex using javascript remoting to insert the record in the database.             Here we are going to use our custom object to pass parameter to apex and insert the record. I am using the custom object name as CustomObj__c . Then the controller name is MyCustomController. The code is given below Step 1:         Need to write javascript code to create the customobject mannually.  the customobject in javascript is given below               function CustomObj__c(){ this.Id= null; this.name__c = null; this.address__c = null;              } Then create the instance for the function. ie object var custObj = new CustomObj__c(); step 2:     Then assign the calue what you want to store. custObj.name__c = 'RamaKavanan'; ...

Visualforce Remoting Exception: Unexpected type for MyController.myMethod(CustomObject)

What happened in Background :                 This error mainly happened when the javascript object set incorrect type value to the object fields.            So we can check the assigned values. but every body normally check the value but not the field type with the assigned value             we need to check both of that.              After check again the error display means we need to check the date field value. because mainly the javascript remoting can set the default value as null. What kind of value set in date field it shows what kind of error happening is given below as deep,             1. null                      when using the null to assign the value than java script remoting throws the  Visualforce Remoting Exception: Unexpected type for Mo...

Access Static Resource in Visualforce Page

           Accessing salesforce static resource depends on the whether you want access standalone single file or you can access file with in archive such as .zip           1. You want access stand alone single file means use $Resource . filename. here filename indicate which file you want to import in visualforce page. We want to use   $Resource.filename with this {!}. other wise it throw the error the example is given below,             <apex:image url="{!$Resource.CoffeeImage}" /> or we can access using URLFOR to access the static resource             <script type="text/javascript" src="{!URLFOR($Resource.Mainjs)}"/>          2. Access static resource from the archive means use URLFOR function. this first parameter used to point out the archive name and second parameter used to indicate the file name which are ...

Apache Lucene Ultra Search Utility

 Apache lucene sets the standard for Search and Indexing performance It is high performance and full-feature text search engine fully written using java. It is used to any application that requires full-text search, especially cross platform. It is open source project we can download it freely. Using this link to download the apache lucene from server download  . Features: 1. Scalable and High performance  Indexing Small Ram  require i.e 1 MB Heap Incremental indexing is faster than Batch indexing  2. Powerful, Accurate and Efficient Searching algorithm  It is support Ranked Searching i.e best result return first  It is allow Fielded searching  It is allow Sorting by any order  It support Multiple-index searching   Allow concurrency access i.e at the same time indexing and updating it  It is easy to fetching, join, and grouping data  It is fast retrieve  3. Stop-word processing  ...