Snippets feature

Snippets feature - Messages

#1 Posted: 9/30/2010 10:08:09 AM
Andrey Ivashov

Andrey Ivashov

2270 likes in 3734 posts.

Group: Super Administrator

Hello.

SMath Studio 0.90 will have a new interesting feature - Snippets. Here is one case how it works:


SMath Studio will have some built-in snippets, but of course every user can create its own snippets. Snippet in SMath Studio is a simple *.sm file that is placed into the special "snippets" folder. Every snippet can be inserted to the page using Dynamic Assistance (pressing TAB will insert snippet inside th collapsed Area Region; pressing Shift+TAB will insert just all snippet expressions without Area Region) or directly from the "Snippet Manager" of the "Tools" menu group.

By the way, please, advise me snippets that you want to be built-in to the SMath Studio.

Best regards, Andrey Ivashov.
1 users liked this post
Radovan Omorjan 9/30/2010 12:26:00 PM
#2 Posted: 9/30/2010 2:13:28 PM
Oscar Campo

Oscar Campo

124 likes in 298 posts.

Group: Moderator

Thanks for this interesting feature.
I think that it would be useful to include a snippet for English <-> SI units.

Regards,

Oscar Campo
#3 Posted: 9/30/2010 3:43:16 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Hello Andrey,

I suppose Snippets would be useful if we want to have some sort of worksheets inside worksheets. With Area regions, dedicated "snippets" folder, we could have some collection of expressions which could be reused many times - some sort of "subroutines". If you remember there were extensive discussion and interest on the Forum about this possibility as a very welcome feature. I am just curious if there would be any specific rules for snippets *.sm files? Some sort of "input" into and "output" from the snippets, some local variables for the snippet. I suppose not this time because you mentioned that there is a possibility to insert the snippet either as Collapsed Area region or to insert the entire *.sm file - every expression in it. I hope I am right.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#4 Posted: 9/30/2010 5:17:36 PM
Andrey Ivashov

Andrey Ivashov

2270 likes in 3734 posts.

Group: Super Administrator

omorr, you are absolutely right. No any rules for snippet *.sm files will be required (except user can set shortcut to see the snippet in the DA list).

Regards.
#5 Posted: 6/1/2013 5:31:13 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Following Davide's recommendation, I supply the stuff as snippets with corresponding example. You may unpack the zip file in your SMath install directory, then the files go automatically to the correct locations.

Some remarks:
- The description in the snippet manager is taken from the file properties, this does not show up in the dynamic assistant.
- After insertion of the snippet, the dynamic assistant shows the the description text of defined functions along with their definition.
- The explanation text in the examples browser is taken from the file properties.
- The snippets are more of an exercise for me in making snippets and examples than a real contribution to the community, as they are quite trivial.

Also, I have not seen any set of snippets gaining such popularity that it is continuously discussed and improved like many of the great plugins. Feedback, however, is welcome. Perhaps, plotting related helper functions could be collected in a central example.

I also encourage the plugin makers to use the examples mechanism (examples folder) for documenting the use of their products. Partly this is already done.

The files in the attachment have descriptions in german and english.

Edit: 2013 06 02 fixed missing translations
2013 06 02 hatch and fill.zip (5 KiB) downloaded 135 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
3 users liked this post
Radovan Omorjan 6/2/2013 2:13:00 AM, ioan92 6/2/2013 3:52:00 AM, Davide Carpi 6/2/2013 6:09:00 AM
#6 Posted: 6/2/2013 7:33:21 AM
kilele

kilele

133 likes in 397 posts.

Group: User

Thanks. The second plot takes like 20 secs to load, some english/german descriptions do not show up in the snippet manager.
snippman.png
1 users liked this post
Martin Kraska 6/2/2013 8:15:00 AM
#7 Posted: 6/2/2013 8:14:19 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

Thanks. The second plot takes like 20 secs to load, some english/german descriptions do not show up in the snippet manager.



English descriptions were incomplete, fixed. And, yes, the fill function is slow (no performance optimization done so far). I had the idea of making coloured contour plots using dots with computed colors, but given the lousy performance I think that is a bad idea. On top of that, most graphics tricks are obsolete as soon as any of the plugins under construction are mature and feature-rich enough. Matplotlib would be nice, but there is few hope as they have no c# api.

My newly gained snippets experience has found it's way to the Handbuch now.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#8 Posted: 12/5/2013 5:42:26 PM
Ryan Freund

Ryan Freund

19 likes in 339 posts.

Group: User

Is there a way to use sub folders in the snippet folder or with the snippet manager? I think it would help with organization.

Thanks
#9 Posted: 4/15/2014 12:58:08 PM
Ryan Freund

Ryan Freund

19 likes in 339 posts.

Group: User

This may be stated somewhere but if you use area regions in your snippet make sure that they are expanded. That way when you insert the snippet into a calculation page between separators the snippet will not overlap other regions.
#10 Posted: 5/11/2016 8:25:19 AM
Davide Carpi

Davide Carpi

1417 likes in 2873 posts.

Group: Moderator

If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 users liked this post
sergio 5/15/2016 3:37:00 PM
#11 Posted: 9/28/2016 4:15:44 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Thanks for this interesting feature.
I think that it would be useful to include a snippet for English <-> SI units.

Regards,

Oscar Campo



It does include Imperial => SI
  • New Posts New Posts
  • No New Posts No New Posts