Posts

Showing posts from 2015

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  ...

Send Email using Python through Gmail, Sendgrid and Elasticmail

Image
We have the lot of use case to send the email through the code.  For that purpose, I had post this to send email / notification through the python smtp . Description      We have to send the email using the python code. That will use the third party smtp library to send email. For this we have to get the smtp configuration from the email service provider .  Based on the configuration we can send the normal email or attached one. But this will help us to send the marketing email / notification and other purpose. Pre-requesting  Have to install python on your machine. And have to install  smtplib library with the help of  pip or other tool. Have to get the gmail smtp information Use cases : Now a days with out email notification none of the application delivered.  That would help to boom the sales or reach out the right customer. Sample code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26...

SSI (Server Side Includes) in Servlet

Image
         Server Side Includes  are commands and directives placed in the web page that can be evaluated by the web server when the web page being served. The servlet code embedded inside the HTML code called as SSI .            SSI cant be supported for all web server. so you can read web server supported documents before using the SSI in your code.            It helpful for when you want to small part of page loading dynamically instead of whole page loading. Below the Syntex given, <SERVLET CODE=MyservletClassname CODEPASE=path      initparam1=initparamvalue initparam2=initparam2value> <PARAM NAME=name1 VALUE=value1> <PARAM NAME=name2 VALUE=value2> </SERVLET> Here the path indicate the MyservletClassname class name path in the server.  you can setup the remote file path also. the remote file path syntex is, http://server:port/di...

Servlet Tutorial

Image
What is Servlet ?       Servlet  is a java  programming language class used request  response programming model. Used to create server side web application and generate dynamic web page. Servlet language is Robust and scalable because of java language.Before Servlet we used CGI (Comman Gateway Interface) for server side programming.  The javax.servlet and javax.servlet.http packages provide the servlet interfaces and classes to implement the servlet.      All servlet must implement the servlet interface. Advantage of Servlet :  The servlet contain the many advantages over the CGI. The web container creates threads for handling the multiple requests to the servlet. Threads have a lot of benefits over the processes such as they share a common memory area, lightweight, cost of communication between the treads are low.The following benefits for Servlets are , 1. Better Performance --> Because it create thr...

Reason for Wait, Notify and NotifyAll are in Object class Not in Thread Class

The mostly asked interview question for experienced person who have experience Nearly 2-3 years in java. Here  are some thoughts on why they should not be in Thread class  which   make sense to me : 1)  W ait and notify is not just normal meth ods or synchronization utility,  more than that   they are communication mechanism between two threads in Java. And Object class is correct   place to make them available for every object if this mechanism is not available via  any java  keyword like synchronized.   Remember synchronized and wait notify are two different area and don’t confuse that they are same or related. Synchronized is to provide mutual exclusion and ensuring  thread safety of Java class  like race condition while wait and notify are communication mechanism between two thread. 2   )Locks are made available on per Object basis, which is another reason wait and notify is   decl...

Adding an Existing Project to GitHub Repository

Image
The following steps to add the existing projects to add github repository Step 1: Create New Repository in your github id.             To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub. Then to see the below image for creating new repository in your github  Here need to give the repository name, and need to choose the repository type i.e Public or private. Step 2:   After create the repository please note down the repository Url i.e SSH or HTTPS  For example : git@github.com:MedicalManager/MedicalMaster.git Step 3:  Then open the terminal for Mac, Linux users Or Open command prompt in Windows Step 4:  Change the current directory to Project directory using cd command on Linux and Windows Step 5:  After that initialize the git repository using the following command   ...

CometD Chat Integration with Java Web Application

Image
CometD :Google, Facebook Similar Chat in your Java Web Application              I was able to implement chatting application by using  CometD  and more customizable chat windows opening on the browser which is exactly similar to Google. This works almost all the modern browsers. This article explains step by step, How to implement chatting application from the scratch and also How to integrate chatting application to your existing Java based web application.              You need to  download the cometD  from their official web site. It has all the dependencies required to implement the chatting application except 2 java script libraries. I have written two Javascript libraries, one to create dynamic chat windows like Google and other to handle CometD chatting functionality in generic way. CometD documentation provides good details. But, I go ahead with the tutorial by using those 2 libraries...