Author Archives: Randall

Oil and Gas Web Application

The last freelance project I worked on was for an oil and gas environmental consultant. The application computes greenhouse gas emissions at oil and gas wells. My client has used the application to manage submittals for over 20,000 oil and gas wells over the course of 5 years, and continues to use the application.

I designed the application with one of the leading MVC PHP frameworks, and used a combination of jquery and Backbone for the front-end. The user interface of the application was patterned after a Bootstrap template I found on wrapbootstrap.com. Here’s a few screenshots:

Wells

Wells Query

GHG Query

Salesforce Schedule APEX Batch Job

To test an APEX Batch job, open the Developer Console then the Anonymous Execute window. Here’s the code to run the job:

1
2
3
4
5
6
7
8
9
10
11
datetime thisTime = system.now().addMinutes(1);
integer second = thisTime.second();
integer minute = thisTime.minute();
integer hour = thisTime.hour();
integer day = thisTime.day();
integer month = thisTime.month();
integer year = thisTime.year();

String timeStamp = second + ' ' + minute + ' ' + hour + ' ' + day + ' ' + month + ' ? ' + year;

String jobId = System.schedule('Test Opportunity Contact Lookup', timeStamp, new ZD_UpdateContactOpportunityBatch());

Salesforce Add Action To apex:enhancedList

There’s no quick way to add actions to the action column of an apex:enhancedList. Here’s the workaround.

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
27
28
29
30
31
32
33
34
<apex:page >
    <style>
    .x-grid3-dirty-cell {
        background-image: none;
    }
    </style>
    <script type="text/javascript">    
    function endsWith(str, suffix) {
        return str.indexOf(suffix, str.length - suffix.length) !== -1;
    }
    function setActions() {        
        Ext.ComponentMgr.all.each( function(item, index, length) {
            if(endsWith(item.id, "grid")) {                
                var action = '<a href="/apex/My_VisualForce_Page?id=%s"><span>My Action</span></a>';
                item.store.each( function(record) {
                    var id = record.id;
                    var temp = action;
                    temp = temp.replace("%s", id);
                    record.set("ACTION_COLUMN", [temp]);
                });
                item.store.on("load", function() {
                    item.store.each( function(record) {
                        var id = record.id;
                        var temp = action;
                        temp = temp.replace("%s", id);
                        record.set("ACTION_COLUMN", [temp]);
                    });
                });
            }
        });
    }
    </script>
    <apex:enhancedList type="Systems__c" height="300" oncomplete="setActions();" />
</apex:page>

Salesforce uses the Extjs framework (Sencha.com) to implement list views. All user interface components on an Extjs page are registered with a component manager. The code accesses the component manager, looks for a component whose id corresponds to a grid (our enhancedList), and then changes the action items in the store associated with the grid.

Network Security is Relative

That is why security experts aren’t surprised by the Sony story. We know people who do penetration testing for a living — real, no-holds-barred attacks that mimic a full-on assault by a dogged, expert attacker — and we know that the expert always gets in. Against a sufficiently skilled, funded and motivated attacker, all networks are vulnerable.

A quote from Bruce Schneier, probably the leading cryptologist on the planet, and whose blog I regularly read.

I’ve blogged before about computer security, and the ramifications of the NASA, Google, Sony, Target, Home Depot, JP Morgan, etc. attacks are apparent. The bad guys are winning. The market is ripe for a secure computing platform.

Salesforce Custom Hours Billed Quote with Conga Composer

For a recent client project working with the Salesforce.com platform I used Conga Composer to create custom quotes. The client is an engineering firm and one of the quotes listed employee hours billed under dynamic categories. Here’s how to create the quote.

Continue reading

Sameoldreader is now DeliciouRSS

I updated the home page and a few other extras for my Delicious reader app: http://deliciourss.appspot.com/.

Here’s a screenshot of my Delicious account loaded:

Deliciourss App

Google App Engine released PHP support, which is a bummer since I developed the app in Python but would prefer PHP. Its still nice to learn Python. At some point I’ll add tracking of read articles and tracking of new articles.

Enclosed Space Technology – Airplane, Boat, Train, Building

I recently tweeted an article from Ars Technica on Linux technology being used by Raytheon for US Navy warships.

Although the article is recent the technology is old. I worked on projects 10 years ago that utilized the same concepts – military grade server hardware that is not susceptible to vibrations or EM, Ethernet based network that connects various components to various control points, a push / pull data subscription model based on widespread industry protocols (ARINC), and SBC embedded devices that interface to various equipment such as water systems, entertainment systems, lighting, etc.

Nullsoft Installer for Salesforce Java Swing & RSSBus Application

In a prior post I explained how to create a simple Java application that downloads Salesforce data via the RSSBus JDBC Salesforce driver. Here’s the script to create a Windows Installer that will install the Java application onto a Windows machine.

Continue reading

Salesforce.com Data Download via Java Swing, RSSBus JDBC Driver, and Apache Commons Daemon

I recently developed an application that synchronizes Salesforce.com data to a local PC. The application is developed in Java using the Swing graphical framework and uses a Salesforce.com JDBC driver provided by RSSBus. The application stores Salesforce.com credentials and synchronization interval timing data in a Java properties file. The application allows non-graphical execution via the “nogui” command argument. I also include an Apache Commons Daemon class and script that allows running the application as a service. The follow code is licensed under the GPLv3.

Continue reading

Salesforce Trigger To Add Contacts From Account Linked to Opportunity

I couldn’t find any example code on the Net to accomplish a task that is probably common amongst many Salesforce implementations. I have a requirement to link a second account to an opportunity in Salesforce. In my use case, the primary opportunity account represents a construction project general contractor, and the second linked account represents the building owner. I need to automatically pull the building owner account contacts into the opportunity contact roles list. Here’s the Salesforce Trigger to do just that:

Continue reading