Saturday, October 22, 2016

Experiments in 3D printing

I've been experimenting with 3D printing recently after initially having similar opinions to Scott Hanselman on the subject:

The first 3D printed thing I ever saw was a florescent green Yoda head. First you're like "HOW DID YOU DO THIS?" but quickly you're more like "OK, how many brightly colored plastic pieces of crap do I really need in my life?" - Scott Hanselman

My previous impression was that the majority of things people printed were replacement parts for the printer itself.

But... then I got access to a printer to use for a few days and printed a few bits and pieces. I think the first thing I printed was a micro quadcopter frame to carry an equally small FPV camera.

Once I realized I could print things that could fly it sort of snowballed from there.

And fly they do...

Dreamforce

At the Chicago MVP Summit event and Midwest Dreamin' conference I'd taken along a handful of Deployment Fish to hand out to people. They were well received, which left me wondering if I could refine the idea for Dreamforce.

At first I thought I could do a 3D version of the Salesforce logo with a flash drive or Raspberry PI embedded.

The idea kind of worked, but I wasn't sure I wanted something that was the company's logo. Plus, I could never figure out how to correctly fill the middle of the cloud between all the defined spheres so it looked right.

I then tried some variations of the deployment fish concept. I really liked the idea of a punch out deployment fish, but the printer didn't have the resolution to do text for a business card. The other idea was a fish that would clip over a conventional business card.

In the end, keeping it simple seemed like the best idea. So I got some basic stickers printed with my details and put them on the back of the original designs. For good measure I did some Trailhead logos as well.

I also really wanted to get my Twitter handle on my conference badge. I had a number of people recognize me first by my handle. The fish was supposed to slot into the sharks mouth, but I didn't have time to refine it the day before departing for the conference.

Einstein

Shortly before Dreamforce the Einstein announcements started coming out. Putting Einstein in a plane just seemed like the thing to do.

I also played around with having the cloud be Einstein's brain.

Apex Hammer Test

Rumor has it that if you can catch one of each of the Seven Dwarf's they'll forge you a might Apex Test Hammer™ like the one that is used to check every orgs test cases during a seasonal release.

It may or may not bear a striking resemblance to Mjolnir with custom rune plates.

Quadcopter travel frame

I wanted to travel with my quadcopter but didn't want to draw attention to it strapped on the outside of a backpack. I made a basic case for it to slide into with the props removed. This was as much to protect the contents of the bag from it as it was to protect the quad.

Stuff for the kids

There is no end of things to print for the kids. I like the simplicity and usefulness of printing new train track connectors.

Sometimes things don't always go to plan

Sometimes the model isn't correct and you try and print a surface with no depth.

Sometimes the filament feed jams mid print.

Sometimes the entire print bed moves mid print.

If nothing else, 3D printing helps teach you perseverance. Happy printing!

Monday, October 17, 2016

Salesforce Tooling API Winter '17 (v38.0)

My saga continues. As the seasonal releases pass I'm beginning to suspect more and more that I'm the sole occupant of SOAP Tooling API town.

Previous encounters with the Tooling API include:

Today's post was encountered when updating to the Winter`17 (v38.0) Tooling API.
.NET would failed to update from the new WSDL with the error message:

Custom tool error: Unable to import WebService/Schema. Unable to import binding 'SforceServiceBinding' from namespace 'urn:tooling.soap.sforce.com'. Unable to import operation 'create'. The datatype 'urn:metadata.tooling.soap.sforce.com:FTestGeneratedEntityComplexValueType' is missing.

The useful bit is hiding at the end - "The datatype 'urn:metadata.tooling.soap.sforce.com:FTestGeneratedEntityComplexValueType' is missing.".

v38.0 of the Tooling API WSDL contains two new and really odd complex types. FTestGeneratedEntityFtest and FTestGeneratedEntityWithLongishNameFtest. The first of these refers to the second via the namespace prefix mns, which is "urn:metadata.tooling.soap.sforce.com". That's fine, except they are both defined within the "urn:sobject.tooling.soap.sforce.com" namespace.

Commenting these extra complex types out of the WSDL seems to be sufficient to get it going again.

Raised as support case 14900660 for those who want to play along at home.

Update: Now a known issue The datatype urn:metadata.tooling.soap.sforce.com:FTestGeneratedEntityComplexValueType is missing


Bonus Round!

The Tooling API now includes the dreaded QuickActionLayout complex type and the corresponding generated quickActionLayoutColumns multidimensional array. As such, the generated C# class will need the same fix that the Metadata API does.


Double Bonus Round!

The describeGlobal method on the Tooling API is returning 122 new sObjects in the autogen__ namespace. They all have the label "Metadata Facade Template" and the keyPrefix "0Dw". If you attempt to do a describeSObject or describeSObjects API call for any of these autogen__ types you get a GACK response.

Raised as support case 14909168.

Friday, October 14, 2016

Dreamforce 2016 Round-up / Summary

This was my third year attending Salesforce's annual Dreamforce conference in San Francisco.

On the first day of the conference, within the first minutes of entering Moscone West, I walked into a both demoing Microsoft HoloLens units. That sort of set the pace for the rest of the conference. I certainly didn't get to as many sessions as I would have liked to. Managing about a dozen over the 4 days. I'd planned to attend many interesting sessions. According to agenda builder I had a laughably optimistic 58 sessions bookmarked. Instead I focused on the activities that could only be done while there in person. The backlog of 40 odd sessions will have to wait for the recordings to become available.

Salesforce DX

The clues I'd been seeing about "artifacts" turned out to be the internal name for a replacement to packaging that formed part of the larger Salesforce DX (Developer Experience) changes. While many of the conference headlines were for Salesforce Einstein, as a developer the Salesforce DX changes will have a more immediate and significant impact to my day to day operations over the coming years (unless they can get a Salesforce Einstein type product to do intelligent debug log parsing - hint, hint.).

Salesforce DX can mostly be thought of as a catch all name for a number of changes coming for developers (and admins). There are a number of areas affected and numerous changes will need to come together over the next few releases to make it a reality. You might be looking at piloting in Summer '17 and GA in Winter '18 (the usual disclaimer applies). You can register your interest to be in the pilot test when it opens up.

You might like to take a detour to the Salesforce DX posts by Peter Knolle or Matt Lacey

Session videos:

Source-driven development

The current status quo for development, especially of a managed package, is that a single packaging org stands as a source of truth for the current release. With Salesforce DX you will be able to drive deployments from a source control system of your choosing.

To make this possible, we're enabling you to export more of your metadata, define data import files, and easily specify the edition, features, and configuration options of your development, staging, and production environments. [Source]

The metadata for a single custom object can be split over multiple files. E.g. Split out each individual field.

Scratch Orgs

Scratch Orgs will be shorted lived and provisioned via the new CLI (and in theory a backing API call that the CLI uses). The most appealing part of these orgs is that a JSON file provided to the CLI tool will configure which features are enabled or disabled for the org (Org Shape by declaration). You will no longer need to wait 4+ days for support to enable multi-currency in your development org at some random inopportune moment. It will be interesting to see how flexible the APIs will need to become to access things there were previously only accessible via the UI. E.g. Remote Site Settings.

I recall hearing that scratch orgs would last around 2 days, but don't hold me to that. Also, they likely wouldn't be hosted on the production instances, which might open up the options for using the interactive debugger.

In another session it was suggested that instead you would have a finite number of scratch orgs and would need to explicitly delete them.

They will have a combination of parts from DE and the Branch Org pilot (giving support for multi orgs with the same global namespace). The Accounts etc... that get created with a standard DE org won't exist.

SourceMetadataMember with RevisionNum field will be used to keep local file system source control in sync with any changes made directly in a scratch org. Might be enhanced in the future with a StreamingAPI topic that can be monitored for direct changes in the org.

force.com CLI interface ++

The extended force cli appears to be a number of additional commands added to the existing force.com CLI, or something like it if you start to merge in the Force.com Migration Tool. I mostly view this as a command line friendly wrapper over the functionality provided by the Tooling and Metadata APIs. The big advantage here is that the command line access to these APIs provides an interface that many other developer tools can integrate with. The increased API and CLI support will move many of the developer tasks away for the UI.

Implemented in Node.js using the Heroku CLI pluggable architecture. Support Web and JWT Bearer Token OAuth flows.

Salesforce Environment Manager

[...] a tool we’ve created to make it easier to manage the orgs you use as part of the development process. Most of these orgs will be scratch orgs, but it also allows you to manage your sandbox and production orgs. Furthermore, the Salesforce Environment Manager/Hub makes it easy to attach your orgs to Heroku so that they can participate inside of Heroku Pipelines, our continuous delivery tool. [Source]

Packaging / Artifacts

Some of the key themes (for the future):

  • Moving from UI centric to an end-to-end API and CLI support
  • Modules & Namespaces help in name isolation and metadata organization
  • Multiple packages share the same namespace. Removes the need to extension packages and global Apex classes.
  • One App Exchange listing that can install multiple packages.

The Tooling API will be extended (GA Winter `17) to allow for package creation. There will also be an API (Enterprise API?) (GA Winter `17) to create Push Requests.

FMA (Feature Management Activation?) to sit besides the LMA in the LMO to allow features to be toggled in the package. It will include an Activation API and Activation Metrics. For admins in the subscriber orgs it will appear similar to how existing Salesforce features are activated.

Register to Learn More about Salesforce DX

Peek Under the Hood of the New Apex Compiler

This was a really interesting session.

Firstly, it covered how Apex classes are compiled to byte code and then to an interpreted form for execution on the app servers. There are various levels of caching involved at each step.

The latter part of the talk was on how the new Apex compiler was being regression tested to ensure it produced the same output as the existing compiler.

Coming Attractions: Change the Game with Event-Driven Computing on Salesforce

Another really interesting talk about providing a mechanism to raise and consume events. It would be accessible in Apex for event publishing and in Triggers for consuming events. (__e suffix.) They could be described via the Metadata, but won't support queries or updates.

Platform Events (Winter 17 Beta) - PDF

Roadmap is:

  • Winter '17 Beta of Platform Events, Apex Subscriber, External Pub/Sub Platform Events
  • Spring '17 GA for Platform Events, Pilot for High Volume Platform Events
  • Summer '17 Beta for High Volume Platform Events. Additional Messaging protocols.

The Dark Art Of CPU Benchmarking

Conclusions...

  • Assignment from static field reference = 20x slower than variable assignment
  • Assignment from dynamic field reference = 30x slower than static reference
  • Use temporary variables instead of referencing a field multiple times!
  • Doing lots of math? Use doubles instead of decimals
    Doubles are 200 times faster (.5 us vs 100 us for decimals)
  • Serializing data can eat up CPU time, depending on the amount of data being serialized.
  • Processes are much less efficient than the equivalent workflow rules.
  • Use Limits.getCPUTime() to find out if you’re getting into trouble, and exit (or go async) if you’re getting close.

True to the core

Meet the developers

Random