- Disable auto update your operating system. For windows go to "Control Panel/Windows Update" and turn off auto update.
- Uninstall unnecessary toolbar like Ask Toolbar, iLivid etc.
- Go to "start menu" and type "run" in search box and select "run". Then type "gpedit.msc" in "run" box and type enter. Now go to "Computer Configuration/Administrative Templates/Network". Now double click on "QoS Packet Scheduler". Again double click on "Limit reservable bandwidth". After open the dialog enable "Bandwidth limit" and set value as "0". Restart your computer and start use.
Sunday, August 21, 2016
Common tasks to increase internet speed on windows
Thursday, August 11, 2016
Groovy call a closure with parameters
Closure closureTest = { def args1 = null, def args2 = null -> /* do something you wish */ } /* Call above closure as like: */ closureTest.call() /* It will pass args1 & args2 both null */ closureTest("value_args1") /* It will pass args2 null */ closureTest(null, "value_args2") /* It will pass args1 null */ closureTest("value_args1", "value_args2") /* It will pass both args1 & args2 value */ /* You can check number of parameters accept by a closure as like: */ closureTest.maximumNumberOfParameters
Wednesday, August 3, 2016
Grails track hibernate transaction begin, flush, commit and rollback status
Package: org.springframework.orm.hibernate4
Class: HibernateTransactionManager
Hibernate evict an persistent object from hibernate session
package com.pkm.evict_entity import grails.util.Holders import org.hibernate.SessionFactory /** * Created by pritom on 3/08/2016. */ class EvictEntityInstance { public static void _evict(def domainInstance) { getBean(SessionFactory).currentSession.evict(domainInstance) } public static <T> T getBean(Class<T> requiredType) { try { return Holders.applicationContext.getBean(requiredType) } catch (Exception e) { return null } } }
Monday, August 1, 2016
Salesforce PDF Viewer with custom PDF page
1. First create a apex class with following contents:
2. Now create a visualforce page with following contents (Name of visualforce page="QuoteCustomPdfView"):
3. Create a local js file with following contents:
4. Upload the js file in static resource section with name = "SaveQuoteAsCustomPDF".
5. After upload done click on view and copy the url from browser.
6. Now create a custom button under Quote section in setup with following configurations
6.1: "Display Type" = "Detail Page"
6.2: "Behavior" = "Execute JavaScript"
6.3: "Content Source" = "OnClick JavaScript"
6.4: Put the following contents in the box below:
7. Add the button in quote page layout.
8. View details of a quote & click the button you added on step 7.
global with sharing class QuoteCustomPdfGenerator { private ApexPages.StandardController sc; public Quote q {get; private set;} public String id {get; private set;} public QuoteCustomPdfGenerator(ApexPages.StandardController controller) { this.sc = sc; this.id = ApexPages.currentPage().getParameters().get('Id'); this.q = [SELECT Id,Name From Quote WHERE Id=:this.id]; } public PageReference viewPdf() { return null; } webService static String createQuotePdf(String Id) { try { PageReference pageRef = new PageReference('/apex/QuoteCustomPdfView?Id='+Id); Blob content = pageRef.getContent(); QuoteDocument doc = new QuoteDocument(Document = content, QuoteId = Id); insert doc; return 'SUCCESS'; } catch(exception ex) { System.debug('--- Error ----------'+ ex); return ex.getMessage(); } } }
2. Now create a visualforce page with following contents (Name of visualforce page="QuoteCustomPdfView"):
<apex:page standardController="Quote" extensions="QuoteCustomPdfGenerator" action="{!viewPdf}" renderAs="pdf"> This is my custom pdf for the quote=[[{!q.Name}]] </apex:page>
3. Create a local js file with following contents:
function SaveQuoteAsCustomPDF(quoteId) { try { var res = sforce.apex.execute("QuoteCustomPdfGenerator","createQuotePdf",{Id : quoteId}); if(res=='SUCCESS') { window.location.reload(); } else { alert('Error in attaching file ----'+ res); } } catch(er) { alert(er); } }
4. Upload the js file in static resource section with name = "SaveQuoteAsCustomPDF".
5. After upload done click on view and copy the url from browser.
6. Now create a custom button under Quote section in setup with following configurations
6.1: "Display Type" = "Detail Page"
6.2: "Behavior" = "Execute JavaScript"
6.3: "Content Source" = "OnClick JavaScript"
6.4: Put the following contents in the box below:
{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/24.0/apex.js")} {!REQUIRESCRIPT("/resource/1470022474000/SaveQuoteAsCustomPDF")} /* Location from step 5 */ var pdfOverlay = QuotePDFPreview.quotePDFObjs['quotePDFOverlay']; pdfOverlay.dialog.buttonContents = '<input value=\"Save Quote As PDF\" class=\"btn\" name=\"save\" onclick=\"SaveQuoteAsCustomPDF(\'{!Quote.Id}\');\" title=\"Save Quote As PDF\" type=\"button\" /><input value=\"Close\" class=\"btn\" name=\"cancel\" onclick=\"QuotePDFPreview.getQuotePDFObject(\'quotePDFOverlay\').close();\" title=\"Close\" type=\"button\" />'; pdfOverlay.setSavable(true); pdfOverlay.setPDFContents('/apex/QuoteCustomPdfView?Id={!Quote.Id}',null,null); pdfOverlay.display();
7. Add the button in quote page layout.
8. View details of a quote & click the button you added on step 7.
Subscribe to:
Posts (Atom)