Be Good & Do Good!

Year: 2009 (Page 3 of 15)

Salesforce – Schedule Apex to run at any time interval

Following is the snippet of anonymous code which will help you to schedule your apex for any interval. The Time parameter is not well structured and because of it I had to put in efforts in compiling the time parameter.

Update (@23 Nov 2011) – Use below code to schedule apex class 10mins (change it as per your need) from now

String str = system.now().addMinutes(10).format(‘ss mm HH dd MM ? yyyy’);
System.schedule(‘Registration Report’, str , new scheduledApexClassName());

  

I am documenting all the parameters neatly, which will help you to schedule apex to run at any time interval even minutes. Below code executes Apex every 10 minutes.

scheduledApexClassName m = new scheduledApexClassName();

String seconds = ‘0’; //Execute at Zero Seconds
String minutes = ‘10,20,30,40,50’; //Execute at every 10th minute of hour
String hours = ‘*’; // Execute Every Hour
String dayOfMonth = ‘*’; // Execute Every Day of the Month
String month = ’11’; //Execute only in November(11)
String dayOfWeek = ‘?’; //Execute on all 7 days of the Week
String year = ‘2009’; //Execute only for year 2009

//Seconds Minutes Hours Day_of_month Month Day_of_week optional_year
String sch = seconds + ‘ ‘ + minutes + ‘ ‘ + hours + ‘ ‘ + dayOfMonth + ‘ ‘ + month + ‘ ‘ + dayOfWeek + ‘ ‘ + year;
//String sch = ‘0 10,20,30,40,50 * * 11 ? 2009’;

system.schedule(‘Registration Report’, sch, m);

Execute above code in system log i.e., execute above annonymous code and it will schedule your Apex Class.

For More Information on how to define a Schedule Apex Class refer http://na1.salesforce.com/help/doc/en/salesforce_winter10_release_notes.pdf#rn_162_apex_scheduler

Indian Animation Industry

In possible good news for a faltering animation industry in India, NASSCOM has forecasted that the industry will grow to USD 1 billion by 2012 from an estimated USD 494 million in 2008.

The report, released at the NASSCOM Animation & Gaming Summit 2009 in Hyderabad, outlines the key challenges for the animation and vfx markets. Noteworthy among them are: ‘the limited demand for animation due to limited promotional budgets and restricted theatrical distribution, scarcity of long-term financing for animated films, competition from foreign animation and restricted use of vfx in Bollywood.’

Interestingly, the animation entertainment segment (which includes feature films, direct-to-DVD, advertising and TV) accounted only 22% of the total market in 2008; while vfx accounted for a mere 13% of the pie. As of today several animation films are in the pipeline for release next year. Biren Ghose, Chairman of NAGFO, who recently joined Paprikaas as General Manager, said, “Not many of the 15 or so animation films that have been announced will release next year.”

On a positive note, he said, “Visual effects (vfx) is an emerging market. About 8-12% of a movie’s budget is spent on vfx. Despite questions raised about the failure of vfx-heavy movies, it has to be noted that Aladin’s vfx budget was only 16% (10-20 crores) of the total cost. In other countries, box-office revenues are small chunk of total profit made by a feature, but in India box-office collection plays a major part in the revenues.”

He also added that animation industry should adapt to Bollywood’s example of having restructured to a higher profitability model, post recession.

Salesforce – Adobe Flash Builder for Force.com Webinar

Force.com Adobe Flash Builder is a  jointly developed integrated development environment (IDE) that gives developers a single, powerful tool for building cloud-based rich Internet applications (RIAs).

:: View the recorded webinar on Force.com Adobe Flash Builder
http://wiki.developerforce.com/index.php/Tech_Talk:_Adobe_Flash_Builder_for_Force.com

:: Reference other resources
http://developer.force.com/flashbuilder
http://www.adobe.com/devnet/salesforce/index.html

Salesforce AJAX Toolkit Shell

Came across something tweak toolkit installed and accessible right inside of any Salesforce.com Org. Access Salesforce AJAX Toolkit Shell @ http://instanceName.salesforce.com/soap/ajax/17.0/debugshell.html.

Enter the instanceName, such as na1, for your organization. You can see the instanceName in the URL field of your browser after logging
in to Salesforce.com.

Salesforce – Date (Calendar) Picker in VisualForce

In general it is a bad idea to use any of the javascript calls that references any standard app features.  These can and do change frequently and might have side effects that are hard to track down.

To get the datePicker the best solution right now is to use inputField and then use an empty SObject with a date field to store the value for you.

Visualforce

<apex:inputField value=”{!proxyObject.closeDate}”/>

Controller

Opportunity o = new Opportunity();
public Opportunity getProxyObject() { return o; }

then in your controller when you need to access the date you ask for o.closeDate.

Source : Salesforce Community

How do I escape ampersands in batch files?

Q: How do I escape ampersands in a batch file (or from the Windows command line) in order to use the start command to open web pages with ampersands in the URL? Double quotes will not work with start; this starts a new command line window instead.

  1. ‘&’ is used to separate commands therefore you can use ^ to escape the ‘&’
  2. Note that you need to supply a dummy first argument in this case, as start will treat the first argument as a title for the new console windows, if it is quoted. So the following should work (and does here):
start "" "http://www.google.com/search?client=opera&rls=en

Also note,if there are URL encoded characters (e.g. space is encoded as %20) in the URL and it is in a batch file then ‘%’ must be encoded as ‘%%’. This is not the case in the example.

Source : http://stackoverflow.com/questions/1327431/how-do-i-escape-ampersands-in-batch-files

Salesforce – Know-How : Anonymous Block

  1. Unlike classes and triggers, anonymous blocks execute as the current user and can fail to compile if the script violates the user’s object- and field-level permissions. So, essentially, it is only allows the user to do what they could through the API.
  2. if you don’t have CRUD for delete on Account, you can’t delete Accounts through anonymous blocks.
  3. The Author Apex profile perm, only applies to Apex that is stored in the org’s metadata (i.e. normal Apex Classes and Triggers that run in system mode).
  4. As far as Async Apex (Batch Apex), it doesn’t look like it is possible because @future requires the method be static but anonymous blocks can’t have static methods

Datasea – Human-like reasoning to find Data Relationships

DataSea is software that tells you about things.

  • Ask it about X and it tells you about X, instead of finding hits with ‘X’ in them.
  • Ask it about X from the point of view of Y, and it will tell you about X and Y, and also things which form connections and relationships from X to Y.
  • DataSea is a data architecture and an application that gives single-step access and control. It reduces the need for navigation and clicking. It answers complex questions and makes mini-reports in one step, which can not be done with search engines. It lets you do things like make calls and send email, also in one step.

    DataSea gives answers based on your input by using human-like reasoning to find the relevant connections among data. It supports natural language and can access a wide range of data sources, including relational databases, as well as unstructured sources, such as ad-hoc notes.

    Read more on human-reasoning to find Data Releationships at http://www.datasea.com/

    Executing JavaScript on page load

    Following code helps you to define any JS function to be called on page load. The tricky part of the code is that it waits until page is completely loaded.


    <script>
    function init() {
    alert('Loaded');
    }

    var previousOnload = window.onload;
    window.onload = function() {
    if (previousOnload) {
    alert('...loading ...');
    previousOnload();
    }

    init();
    }
    </script>

    « Older posts Newer posts »