Interesting note to self... the following code produces the same results, one using a chain of OpenCV methods and the other using a concise Caffe method.
Insights and lessons learned from designing and implementing cloud solutions on the Salesforce1 Platform. Side adventures into Heroku with Ruby on Rails apps also included.
Wednesday, July 27, 2016
Thursday, May 12, 2016
Mix Groovy and Java in STS 3.7.3.RELEASE
To mix Java and Groovy together in the same Spring Starter project, a few changes can be made to the project's properties and paths. By default, when a Java project is created it only looks for source files and test files in the src/main/java and src/test/java directories.
At this point, trying to run the Spring Boot app will generate errors that look like this.
Add src/main/groovy to Java Build Path
- Create the src/main/groovy directory
- Right-click the project in Package Explorer, then click Properties
- Click Java Build Path in the left sidebar
- Click Add Folder... to add src/main/groovy
Add Groovy libraries to classpath
- Right-click the project in Package Explorer
- Expand Groovy, then click Add Groovy libraries to classpath
Only include groovy-all
At this point, trying to run the Spring Boot app will generate errors that look like this.
...
org.apache.catalina.core.ContainerBase : A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
...
The errors can be resolved by removing the extra libraries STS automatically added in the previous step.
- Right-click Groovy Libraries in the project
- Click Properties
- Select "No, only include groovy-all" in the first panel that asks, "Should all jars in the groovy-eclipse lib folder be included on the classpath?"
Monday, May 9, 2016
Mix Groovy and Java in IntellJ IDEA
To mix Java and Groovy together in the same IntelliJ IDEA project, a simple change can be made to the project's .iml file. By default, when the project is created it only looks for source files and test files in the src/main/java directory.
By adding two sourceFolder elements IntellJ will automatically find and compile .groovy files in the Groovy directory.
Wednesday, May 4, 2016
Go to Assembla Ticket
Here's a simple JS code that can be converted into a bookmarklet to quickly open an Assembla ticket.
Labels:
Assembla,
hack,
JavaScript
Saturday, April 30, 2016
HTTP/REST API Specifications
Now that I have the pleasure of designing new APIs to support both B2C and B2B use cases, my first thought is to standardize. In the case of APIs, I believe standards reduce the burden of maintenance and improve the ease of integration.
To that end, I sought to define guidelines for all operations. These are not new or novel, but I need these to set shared expectations with my team. And we start with a few core principles:
To that end, I sought to define guidelines for all operations. These are not new or novel, but I need these to set shared expectations with my team. And we start with a few core principles:
- Follow REST conventions for CRUD operations
- Use JSON in all request and response bodies (Content-Type: application/json)...
- Except where binary content is involved (Content-Type: multipart/form-data)
REST conventions
Striving to KISS:
- Prefix all operations with a major version number, starting with "/v1" (ref PayPal, Salesforce)
- Stick with lowercase (ref Heroku)
- Map HTTP methods to CRUD operations (ref REST API Tutorial)
- Use route parameters for CRUD operations (ref Express)
- Use query strings only in GET requests
Error response body
Success responses will contain appropriate data for the request, but all error response bodies look alike. At least structurally, having only one field.
Each errors element has the following fields:
- Array<Error> errors - An array of any errors encountered while executing the operation. This field is always present for an error state (any non-200 HTTP status).
Each errors element has the following fields:
Labels:
API,
REST,
technical architect
Tuesday, February 2, 2016
Get Full DateTime Format (GMT) in Apex
To get the full DateTime format in GMT such that it's compatible with Apex methods like JSON.deserialize(), the most accurate method is to call DateTime.formatGmt().
For comparison, below are some other alternatives for generating similar String values for a DateTime object.
Labels:
Apex
Monday, January 11, 2016
6 Reasons You Got the Generic Error Page
Sometimes in Visualforce, you'll have debug logging enabled for a community or portal user, but loading a page fails with no trace of what went wrong. When you look in the debug log for an explanation, all you see is that Salesforce successfully loaded the Generic Error Page configured for the site.
Before logging a case or asking a fellow developer for help, check for the following 6 common culprits.
Before logging a case or asking a fellow developer for help, check for the following 6 common culprits.
- Are you missing any static resources, {!$Resource.__}?
- Are you missing any custom labels, {!$Label.__}?
- Are you missing any custom permissions, {!$Permission.__}?
- Are you missing any page references, {!$Page.__}?
- Are you missing any custom controller/extension properties bound on the page? This can be a problem when deploying packages among sandbox orgs.
- Are you missing any custom controller/extension actions bound on the page?
What I've also discovered, interestingly enough, is that for some reason using MavensMate v6.0.0 with Sublime Text 3, saving a Visualforce page or component skips the validation for global variables used in Visualforce.
Labels:
Communities,
deployment,
Force.com,
Visualforce
Subscribe to:
Posts (Atom)
