Getting help from Warp 10 community

Looking for WarpScript help? Several channels exists. Anyway, you need to learn to share your execution context to help helpers!

Getting Help from Warp 10 Community

This short article sum up the ways to share data, snippets, with the Warp 10 community.

Even if you followed the WarpScript tutorials, you may sometimes need help from WarpScript experts. You may find us:

99.9% of the time, helpers will ask you the WarpScript snippet you struggle with AND a snapshot of your data, to be able to help you. A snapshot? What is that?

Helper Trust level: 100%

You are working on a public instance, you got a support contract with SenX and an NDA, or you consider there is nothing sensitive in your data. Just share your WarpScript, tokens, and your endpoint. In WarpStudio, this could be done with two clicks:

Full code snapshot, includes instance endpoint.

Then paste the snapshot URL into the help channel. It is really easy, but you share everything.

Helper Trust level: 50%

You need to hide your instance, your tokens. Or you are working on your computer or a LAN instance that could not be reached from outside anyway.

Here is a buggy WarpScript:

{
  'token' 'xx'
  'class' 'temperature'  
  'labels' {} 
  'end' xx  
  'start' xx
}
FETCH 'temperatureGTS' STORE

{
  'token' 'xx'
  'class' 'gps_data' 
  'labels' {}
  'end' xx 
  'start' xx
} 
FETCH 'gpsGTS' STORE

$temperatureGTS $gpsGTS
filler.interpolate FILL 
COPYGEO

FILL will raise an error, and there could be several reasons, depending on the FETCH output. To share your data, insert SNAPSHOT STOP before filler.interpolate.

$temperatureGTS $gpsGTS
SNAPSHOT STOP // returns the stack content and stops
filler.interpolate FILL
COPYGEO

After that, you can copy-paste the JSON output and share it with others. Helpers will be also happy if you copy-paste the few lines of code, removing manually the tokens or other secrets.

The JSON just contains one string. The string itself is valid WarpScript. Anyone can copy the string, then call the EVAL function to rebuild the stack exactly in the state you have, and therefore help you efficiently.

Trust level: paranoid

You do not want to share class names, or metadata, or real GPS position, or timestamps, because this is the nuclear core temperature and the GPS position of an SSN and the submersible number is in the labels. Seems legit.

Before SNAPSHOT, you need to clean up your data… Here is a useful macro to hide everything: for simplicity, it is hosted on our WarpFleet repo, available for everyone.

$temperature_data @senx/gts/hideMyGts
$gps_data @senx/gts/hideMyGts
SNAPSHOT STOP
filler.interpolate FILL
COPYGEO

@senx/gts/hideMyGts will define a random shift in time and space the first time you call it. Then it will apply these shifts, rename GTS to gts1, gts2, gts3, remove all the labels and attributes, leaving a randomLabel instead.

This cleanup may be “too much”. You can adapt it, here is the macro:

// Macro to anonymise data before asking someone else help !
<%
  //define random offsets, if not already defined.
  RAND -600 d * TOLONG 'hideMyGts_timeOffset' CSTORE
  RAND 0.5 - 40 * 'hideMyGts_latitudeOffset' CSTORE
  RAND 0.5 - 40 * 'hideMyGts_longitudeOffset' CSTORE
  RAND 0.5 - 100000 * TOLONG 'hideMyGts_elevationOffset' CSTORE
  1 'hideMyGts_nameSuffix' CSTORE

  SAVE 'context'
  
  STORE  'hideMyGts_input' STORE
  
  // shift the input in time
  $hideMyGts_input $hideMyGts_timeOffset TIMESHIFT

  // shift the input in space
  [ 
    SWAP
    <%
      'l' STORE
      [ 
        $l 0 GET 
        $l 4 GET 0 GET DUP ISNaN ! <% $hideMyGts_latitudeOffset + %> IFT    
        $l 5 GET 0 GET DUP ISNaN ! <% $hideMyGts_latitudeOffset + %> IFT     
        $l 6 GET 0 GET DUP ISNaN ! <% $hideMyGts_elevationOffset + %> IFT    
        $l 7 GET 0 GET // keep the value as it is.    
      ]   
    %> MACROMAPPER
    0 0 0 
  ] MAP
  
  // remove labels and attributes 
  { NULL NULL 'randomLabel' UUID } RELABEL
  { NULL NULL } SETATTRIBUTES

  // incremental name
  <%
    'gts' $hideMyGts_nameSuffix TOSTRING + RENAME
    $hideMyGts_nameSuffix 1 + 'hideMyGts_nameSuffix' STORE
  %> false LMAP 

  // if input is a single gts, return a single gts 
  <% $hideMyGts_input TYPEOF 'GTS' == %>  
  <% 0 GET %> IFT

  $hideMyGts_nameSuffix  $context RESTORE  
  
  'hideMyGts_nameSuffix' STORE
%>

'hideMyGts' STORE
$temperature_data @hideMyGts
$gps_data @hideMyGts

Share all the context!

You may want to share variables too. SNAPSHOTALL can do that. Not only it generates valid WarpScript to rebuild the stack, but it also generates all the context (all the variables or macro you stored).

Conclusion

  • Sharing the execution context is really simple with WarpScript. SNAPSHOT STOP is just what you need to remember.
  • If there is no NDA or support contract between you and helpers, be sure you do not share something highly confidential. @senx/gts/hideMyGts will help you.
Ask your VIP access to the Lounge and join the Warp 10 community.