Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Nano-Sheets: A Small but Mighty Spreadsheet Engine in REBOL, Part 2 : Page 5

Building on Part 1 of this article, not only can you create a working spreadsheet in just a few bytes using REBOL, but you can extend it to support printing, standard keyboard navigation, macros containing code, and even make it shareable and dynamically updatable—while still using only a few bytes of code.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Receiving and Loading Data with an insert-notify Callback
To display the changed data to other users, you extend the load-sheets function in this second extension of Nano-Sheets so that when the send-server action above results in a new or updated spreadsheet, the insert-notify callback function will load the data. Here's the entire load-sheet file so you can see where to add the new code (after the ;--- comment).

last-file: none load-sheet: func [file [file! url!] /local data] [ collab-file: second split-path file clear-sheet parse load/all file sheet== ;---Add this code to receive and load synced ;---spreadsheets if all [ link? (last-file <> collab-file )] [ base-dir: any [ ( find/match what-dir link-root ) what-dir] remove-notify 'file-downloaded base-dir/:last-file last-file: collab-file insert-notify 'file-downloaded base-dir/:collab-file func [a data][ load-sheet collab-file ] ] current-file: file show lay compute ]

After adding this new code, all users who are given access to the nano-sheets fileset will receive the new file the next time their REBOL/IOS client connects to the X-Internet. This simple example assumes that users who want to see the spreadsheet when it is synced have Nano-Sheets running; if they do, it will load the file if you added the preceding code.

This example simply uses Nano-Sheets to receive and load the file, but you could add a management program to the nano-sheets fileset that loads the data and uses it to automate workflow.

Note that it requires only about 500 bytes to extend Nano-Sheets for collaboration with either itself, or with other programs.

The link? test lets Nano-Sheets operate with any version of REBOL, even without the X-Internet, or without any connection at all.

We hope you now appreciate the revolutionary design of Nano-Sheets as shown in the examples. REBOL enables concise, readable code that's tiny compared to other software technologies. The Nano-Sheets application is just an appetizer of what's possible with REBOL; and we hope these servings were palatable. You don't need a huge team of programmers to produce professional results using this example as a starting point.

Please refer to the sidebar "Major Benefits of REBOL" to see a further analysis of how REBOL functions under the hood of Nano-Sheets.

Commercializing the X Internet, Steve Shireman founded eFishAntSea to solve main-stream business problems with Advanced X Internet solutions. With over 27 years of product development in these areas: VLSI manufacturing, dairy automation with RF AutoID, safety-critical train automation, CDMA data wireless product design (including the only "land-line transparent" wireless local loop products, telematics systems, and the fastest wireless data TCP/IP/RLP implementation) Steve is pioneering some vertical market integration such as X-SCADA� and education with other X Internet partners and businesses.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date