Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • Belen 9:31 am on March 18, 2025 Permalink  

    Tip: Use *trigger to Keep Programs Responsive in Loops with Numerous Iterations 

    When a loop runs a large number of iterations without a break, it can cause the program to become unresponsive.  To prevent this, adding a *trigger inside the loop can help. Even if the *trigger does not perform any specific action, it interrupts the loop execution, allowing the program to continue running smoothly.

    Here is an example of how you would do this:

    *while: some_action
    	*trigger: meaningless_trigger
    	-- loop content here

    This simple addition ensures that the loop does not run indefinitely, preventing the program from freezing.

     
  • Belen 11:19 am on November 11, 2024 Permalink  

    Feature update: Drag-and-drop to add images 

    Adding images to your program just got easier: drag and drop them in the code editor, and you’re done!

    Alternatively, you can still add images the old way by specifying the URL of the image that you want to display:

     
  • Belen 10:00 am on November 8, 2024 Permalink  

    Feature update: JSON encoding and decoding 

    The JSON data format allows for structured data to be easily stored and exchanged. For example, in a Real Estate app, the data related to a given property could look like this:

    {
    	"propertyID": "12345",
    	"price": 350000,
    	"location": {
    		"city": "Anytown",
    		"state": "CA"
    	},
    	"details": {
    		"type": "Single Family Home",
    		"beds": 3,
    		"baths": 2
    	},
    	"features": [
    		"garage",
    		"fireplace"
    	]
    }
    

    In GuidedTrack, we use an association to structure data in a similar manner:

    >> propertyData = {"propertyID" -> "12345", "price" -> 350000, "location" -> {"city" -> "Anytown", "state" -> "CA"}, "details" -> { "type" -> "Single Family Home", "beds" -> 3, "baths" -> 2}, "features" ->  ["garage", "fireplace"]}
    

    Or, in a more visual way:

    >> propertyData = {}
    
    >> propertyData["propertyID"] = "12345"
    >> propertyData["price"] = 350000
    >> propertyData["location"] = {"city" -> "Anytown", "state" -> "CA"}
    >> propertyData["details"] = { "type" -> "Single Family Home", "beds" -> 3, "baths" -> 2}
    >> propertyData["features"] = ["garage", "fireplace"]
    

    To convert a GuidedTrack association into a JSON string, such as when using it as input for a ChatGPT conversation, use the function encode with the “JSON” scheme:

    >>propertyData_jsonString = propertyData.encode("JSON")

    Similarly, to convert a JSON string back into an association, use the decode function with the same scheme:

    >>propertyData = propertyData_jsonString.decode("JSON")

    To summarize:

    FunctionInput TypeOutput Type
    .encode(“JSON”)associationtext
    .decode(“JSON”)textassociation
     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel