Tools

Announcements of available shared folders

Tools

Postby oliver » Fri Jun 04, 2010 5:28 pm

Collection of calculator-related tools.

cwd
Show the current folder name

google
Brings up google in browser

googleFor
Googles for the string given by position 1 of your stack

inspect
Internal object dump. Let's you look "inside" objects. If the result looks just like the input that means the input is natively represented. (A vector is just a vector, for example, not a more complicated object.)

itsHTML
Shows the HTML string that is used by the given object for its representation on the calculator's HTML 5 stack. If the result looks just like the input that means there's no special formatting. Try custom objects (such as Chem) to see more involved formatting.

isType
Useful utility function that will check a given object for a type string. Will return the object if the object is of the given type. Otherwise a "argument is of wrong type" exception will be thrown. You can use this, in RPL or JavaScript, to safe-guard your function against wrong supplied arguments.
Examples:
JS:
Code: Select all
function (v) { Tools.isType(v, "vector"); return v.length; } // v is sure to be a vector, or an exception will occur

RPL:
Code: Select all
<< "vector" Tools.isType SIZE >> @ input is sure to be a vector, or an exception will occur

Note: in RPL you don't have to do a DUP before use of this function, as the test object will not be consumed.
This functionality will soon be available globally in the calculator. (You won't need to refer to the Tools folder.)

DOERR
Implementation of the DOERR function. It will throw an error and message the user with a given string.
As always, usable from both RPL and JS. (Although in JS you might just do "throw Error(msg)".

showUnits
Just showing how to access the Units object and how it's internal structure looks like.
One could write code that leverages it.

getURL
Expects a http: URL string and will fetch its contents. Has a thousand uses.
In JavaScript you may simply type requireURL(...) to the same effect.

getCode
Expects a name and a baseURL string and will fetch a resultant URL "baseURL/name.txt", run trans over the contents, write the result into a variable 'name' and show it in the editor.
This enables getting code from a remote location (=your web-sharing computer). See viewtopic.php?f=7&t=246 for steps how to make a key your "remote code" editing key.

trans
Given a string, translates RPL transcode characters (strange letter combinations like \<< and \->) into Unicodes.
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Re: Tools

Postby oliver » Thu Mar 24, 2011 9:29 am

Added various entries and removed NDfuncs (as now superseded by in-app documentation).
Edited first post to reflect changes.
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Re: Tools

Postby oliver » Fri Apr 22, 2011 4:38 pm

Three more additions: getURL, getCode, trans.
First post edited to reflect additions.

See http://forums.naivedesign.com/viewtopic.php?f=7&t=246 for a neat trick you can use getCode for.
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

getCodeAndRun; new tutorial

Postby oliver » Mon Feb 06, 2012 2:57 pm

getCodeAndRun was added to this folder.

It, and getCode, are described in a new tutorial: http://naivedesign.com/ND1/Computer_Link.html

See this for 3 methods that allow you to code on your computer, and run the code on ND1.
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm


Return to Downloadable Folders / Shared Data

Who is online

Users browsing this forum: No registered users and 2 guests

cron