Pages

Friday, August 27, 2010

Easiest AJAX Pagination on Visualforce

There are two ways of writing a code, the hard way and the best way, Of-course the hard way is the easy way and best way if always hard way. If this sentence seems hard to understand, understand it is for the best.

When developing a VF page, the most important we need is pagination, throwing the large chunk of data on user screen is going to give the user goose bump. After trying a dozen method I came to know the easiest way of implementing pagination using standard set controller on a custom controller.

The demo of the code is available here

The visualforce Page:



            
                
                    
                    
                
                
                         First
                             Previous   
                                              
                            Next 
                             Last 
                               
            
           



Apex Controller:
public class OpportunityPagination{ 
    
    public ApexPages.StandardSetController Con{
        get {
            if(con== null) {
                con= new ApexPages.StandardSetController(Database.getQueryLocator([select name,closedate from Opportunity]));
            }
            con.setPageSize(5);
            return con;
        }
        set;
    }
    
    public List getOpportunities() {
         return (List) con.getRecords();
    }
    
     /*** Pagination control***/
    
     // indicates whether there are more records after the current page set.
    public Boolean hasNext {
        get {
            return con.getHasNext();
        }
        set;
    }
 
    // indicates whether there are more records before the current page set.
    public Boolean hasPrevious {
        get {
            return con.getHasPrevious();
        }
        set;
    }
 
    // returns the page number of the current page set
    public Integer pageNumber {
        get {
            return con.getPageNumber();
        }
        set;
    }
 
    // returns the first page of records
    public void first() {
        con.first();
    }
 
    // returns the last page of records
    public void last() {
        con.last();
    }
 
    // returns the previous page of records
    public void previous() {
        con.previous();
    }
 
    // returns the next page of records
    public void next() {
        con.next();
    }
 
    // returns the PageReference of the original page, if known, or the home page.
    public void cancel() {
        con.cancel();
    }
    
    //    
  
 /*** Pagination control***/
}

Wednesday, July 28, 2010

Clash of the Cloud, A presentation on cloud computing

Monday, May 10, 2010

Summer 10 Chatter in the cloud

Salesforce.com has done it again, coming in Summer 10, we take a exponential leap onto cloud and a brand new chatter application, openSocial web starts making sense.
With Chatter you can follow your objects, records or even users. Its just like twitter on steroids, with twitter anybody can make a tweet, in chatter its everybody in your own organization.
You can follow records, objects and applications using a simple click of a button on the chatter section of the page.

After that all the changes you follow can be seen on a single page, your dashboard.
E.g.,
You can now follow individual records and see if they have changed:
I wish to track changes on the opportunity and want to follow it through the stages, all I do is click on 'follow' of the opportunity record.
Also, I follow a certain case which was previously owned by me but now is transfered to someone else.
I can keep a track of the items I want to follow, next time I login, and the case is closed or the opportunity has advanced through a stage..
I see both of them on my dashboard. This will help the business users or even managers to keep an eye on the records they are interested. This is a good idea for the manager who wishes to be in loop while dealing with a big client. No need to ask for reports on what is happening, he has all of it on his own dashboard.
Some of the interesting features looking forward in the release:
Force.com – Chatter Platform :
Chatter gets a free upgrade this summer with integration with the custom cloud. Now you can follow custom objects, custom application, integrated applications using chatter.

Your own Domain:
Coming this summer your organization will have a unique salesforce.com URL for all your access. This will be benificial for branding of the organization. Currenlty with existing URL structure, salesforce runs on ServerURL.salesforce.com and visualforce runs on c.serverURL.salesforce.com
What we can understand from this update is all of this will run under same sub domain yourdomain.salesforce.com. Incidently on the updates page, there is no detail information on this update. So we should wait and watch whats coming.
Dependent Picklists for Pages
Finally its here, I voted for this update. The greatest of the dependent picklist are now available on Pages. No more need for multi-level picklist.
Sites Single Sign-On
Using the same login you use in Salesforce.com application (http://login.salesforce.com/) you can now access sites and other custom domain application. Single-sign on will be benificial for throwing away those memory pills you have to take to remember countless passwords and login ids. One ID and you are done.
Cookie Support
Its here, its here. Cookie support will enable developers to build complex applications that needs to store a cookie on the application.
Dependent Lookups (beta)Every salesforce user has faced the need a dependent lookup. If I have to add a account and a contact in a single page, why on earth will I need to select again from the list of contacts, I should only see those which are child of the account which is selected. This has come in Beta mode, meaning we should expect this to contain bugs and hope for update in next release. Well, something is better than nothing, I can now show the client that this can be done and make him feel at ease at least.
As I had mentioned earlier 2010 began with Apple and Google failed to cause a big dent in the Universe, I am sure Chatter will. Atleast so far it seems they will, only time will decide if chatter is here to stay, for Salesforce Sales Cloud and Service cloud have a great usability so far, cannot say the same for collaboration cloud coming this summer.
May the force be with you,
Ravan

Thursday, April 22, 2010

Blogger Copying prevention Widget


To prevent unwanted people from lifting off your hard written content from blogger, I have written a simple JavaScript widget to digitally lock the content together. The code simply prevents people from using right-click and select text function of the browsers.

To install the Braniac DigiLock click here

Installing Instructions:
Use the one click express installer button on the sidebar of Sidoscope, add the widget to your sidebar and it will create a image of lock as above on your sidebar, which can be moved to any corner of the page.

If you have too many widgets on your blog, it is recommended that you move the code on top so that it loads faster than the wi

FAQ:

1) Is this 100% foolproof method to protect the blog?
This may not be a 100% foolproof method but it does make the content stealing harder from your blog.

2) What does this code actually do?
The code simply takes control of the browser and prevents the overrides the text selection button and right-click function of the blog. It also adds a small image to your sidebar, which links to the installer of the code so that your friend bloggers can know.

3) I want people to select text but I do not want them to copy images.
Please email me your id, I will send you the code.

4) What all browsers does it code work?
The code has been tested on IE 6, 7, 8, Mozilla 3.5 +, Chrome, Opera and Safari on windows and Linux, however I cannot assure you if this works on all browsers existing. They should work on browser working on DOM model, in simple words, test it on your browser and give me feedback. 

5) Does this code protect my content everywhere?
This code only protects your blog, your content can be picked up by search engine, your feeds and other places also like images.google, these loopholes you have to take care of. 

6) Will my blog crash with the code.
I have myself used it in my blog, it has not crashed. Even if it does tamper-hamper or destroy your blog, remove the widget from it,

7) Can I use it on WordPress also.
I myself have not able to understand Wordpress, but my friend Pramathesh has managed to install it on his wordpress.org blog. Please contact him.

8) Do I need to link the image to your blog.
My blog has the installer on it, I would suggest you to keep the link open so that others can also be benefited by the code.

9) What are the ways I can still overcome the widget and copy content.
Meet me in person, I would like to see you and take your mug shot for future reference.

10) Why don't you charge for this.
This code is not a rocket science it is a simple Javascript, I am a blogger myself and I don't like people stealing off stuff from my blog. I do accept donations thought.

Friday, January 29, 2010

Salesforce.com 2010



I started working on Salesforce on winter 09, since then Salesforce has gone on steroids, with so many excellent and superb technological advancements coming up in newer and newer releases, that I sometimes feel afraid I will fall behind catching up them.... ok so far I haven't.

With the introduction of sites, Salesforce has gone a million miles beyond CRM and you can safely say, it is a novel web-based products which is so simple to use, that you need not be a web guru to use it. Of course you do need developers to develop it (or I will stay hungry) but the simplicity of use is what Salesforce excelled on.

As always this year Salesforce is revolutionizing the world, what with the launch of Apple iPad and the forthcoming Google Crome OS, this year is a revolution for Cloud Computing.

However, with the year beginning with a bad presentation from Google and also the same old stone age technology from Apple (iPad was not expected from the people who made the dent in the universe) I just hope, Salesforce keeps up with the high expectations we hold for them.


Some advancements we are looking forward too...

Salesforce Sites

When Salesforce Sites was launched, it was a excellent concept but with no practical usage, there was a tedious task for creating a login page for it. Why would someone go for sites if all you have to do was load static content in excellent GUI but no real-time support???

This is changing... in Spring 10, Force.com is coming up with real-time authenticate support for enterprise and ultimate users.

No more complex ANT script to deploy application, or eclipse IDE. Just few clicks and its done.

GUI Changes

Finally Salesforce undergoes makeup. The new GUI is marvelous, its pleasant and looks cool than the present boring old static GUI. I saw the preview and trust me it is b-e-a-utiful!!!!

Rich Text Support




Multi-level Master detail Relationships

Can it get any better?
Create up to three child levels of master-detail relations
Rollup your data from the deepest child level all the way to the parent
Reports pulling data from all the levels of your complex data model

Limits on Collection has been removed, oh my this sure is exciting...


See it to believe it...

I am desperately waiting for chatter, anyone got preview???

Thursday, January 14, 2010

Ajax Animation Images

Continuation of Ajax Animation Post

Here are some brilliant Animation for you to use.







The last one is used by SFDC Standard.

Tuesday, January 12, 2010

Happy New Year

I know I am a lot of late for new year wishes, but I am really busy switching cities nowdays. I will be settling down after 15th.

Guess what? I managed to replicate around 60% of salesforce using visualforce, the benifits? The critical processes where we want to add our own stuff into salesforce which is not possible can be achieved with it.

I succeeded in creating a very complex products module, as well as a email on attachment module.

I will get you the code soon.

As you can see, the design of the site is undergoing changes, I am trying to implement a new design which is getting very slow and steady, due to my shifting.

Do suggest changes if you find some.

Cheers,
SiD