Rank: Advanced Member Groups: Registered
Joined: 18/05/2011(UTC) Posts: 36
Was thanked: 3 time(s) in 3 post(s)
|
Hey All,
Thanks for responding. I think i found the error.
The include function appears not to work, if the document it's running in is NOT SAVED.
once the document is saved, then the include extension works.
I'm going to keep playing with the include function (i've been waiting for smath to have this ability for a long long time).
Will report back with any errors.
Thanks!
-Pete
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Updated. Added support for strings. Error handling is changed. |
Russia ☭ forever Viacheslav N. Mezentsev |
1 user thanked uni for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
Preliminary handbook pages: File Attachment(s): mkraska attached the following image(s): |
|
2 users thanked mkraska for this useful post.
|
on 01/12/2013(UTC), on 01/12/2013(UTC)
|
|
Rank: Advanced Member Groups: Registered
Joined: 18/05/2011(UTC) Posts: 36
Was thanked: 3 time(s) in 3 post(s)
|
There appears to be severe degradation on the time it takes to include a smath file, if that smath file contains a variable that is a string of length greater than 16.
Lets say I had two smath files as such
smathToInclude.sm { a:="some string of some length" }
smathFile { include(smathToInclude.sm) }
as the length of the string a increases so does the time it takes to include the file.
To test this, I created the following file.
smathFile { for b:=1 to 20 //do this 20 times to get a true sense of the include function time c:=include(smathToInclude.sm) }
And i changed the length of variable a to the following lengths, and got the following times
strlen TimeToInclude 10-.07 11-.07 12-.075 13-.085 14-.09 15-.095 16-.11 17-.169 20-.451 21-.74 22-1.16 23-1.851 24-2.841 25-4.519 30-49.0
It appears that string lengths above 16 chars is where the time to include shoots off the map - which makes me think the error has to be 16 bit representation.
Just letting you guys know,
-Pete
|
1 user thanked sublim21 for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Thank you, Pete. I'll check this.
This behavior may be due to using a regular expression search. I am using a string representation of expressions to make some changes. Search using regular expressions can lead to such delays. It will take time for profiling the code. |
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
Files to be used by include() do not typically reside in the document directory where they are used but at some central repository in a given installation. Candidates for such repositories might be the extensions/snippets or extensions/example directories in the settings directory as found by SettingsDirectory().
How about adapted versions of include() either with a second argument or (more convenient in the dynamic assistant) a special name like include("name.sm","examples" ) or example("name.sm" ) or include_example("name.sm" ) or whatever seems to be convenient?
Then we could use the extensions manager for distribution and download of such files. Would also be nice to have a mechanism to include the complete contents of extensions/snippets or whatever dedicated directory by default (source lib plugin). |
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 23/03/2014(UTC) Posts: 1 Location: Texas
|
I'm not sure if I am using "include" correctly. But, when I include a file that has an expression with units, the defined object does not manipulate the units correctly. For instance -
LL.g=20*'lbf/{'ft^2}
LL.g*1/{25*'psf}=0.017*{'lbf*'m*'s^2}/{'ft^2*'kg}
When I multiply LLg times 1/25 psf; the result should be a unitless amount. It is coming up with a mixed unit that cannot be manipulated or dealt with.
Can you help with this?
Great Program!!!
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Originally Posted by: wfoster982 I'm not sure if I am using "include" correctly. But, when I include a file that has an expression with units, the defined object does not manipulate the units correctly. For instance -
LL.g=20*'lbf/{'ft^2}
LL.g*1/{25*'psf}=0.017*{'lbf*'m*'s^2}/{'ft^2*'kg}
When I multiply LLg times 1/25 psf; the result should be a unitless amount. It is coming up with a mixed unit that cannot be manipulated or dealt with.
Can you help with this?
Great Program!!!
Without using the include() function you get the same result? EDIT: I have reproduced the problem. I can't advise something for now. Edited by user 27 March 2014 12:56:45(UTC)
| Reason: Not specified |
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Updated. Try this LL.g:eval(LL.g) before LL.g*1/{25*psf}. Edited by user 27 March 2014 14:41:58(UTC)
| Reason: Not specified |
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Originally Posted by: mkraska Files to be used by include() do not typically reside in the document directory where they are used but at some central repository in a given installation. Candidates for such repositories might be the extensions/snippets or extensions/example directories in the settings directory as found by SettingsDirectory().
How about adapted versions of include() either with a second argument or (more convenient in the dynamic assistant) a special name like include("name.sm","examples" ) or example("name.sm" ) or include_example("name.sm" ) or whatever seems to be convenient?
Then we could use the extensions manager for distribution and download of such files. Would also be nice to have a mechanism to include the complete contents of extensions/snippets or whatever dedicated directory by default (source lib plugin). Updated. Now file is searched for in two stages (if absolute path not used): 1. In the folder: /extensions/ 2. In the document directory folder. So, if you want to include some example sheet you need to use this: include( "examples\example1.sm" ) = EDIT: Definitions in areas not supported. Edited by user 27 March 2014 20:19:09(UTC)
| Reason: Not specified |
Russia ☭ forever Viacheslav N. Mezentsev |
1 user thanked uni for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Updated. Added support for names which start with ` symbol ( Linq). |
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 17/01/2013(UTC) Posts: 296 Location: Khabarovsk, Russia Was thanked: 151 time(s) in 107 post(s)
|
Originally Posted by: uni EDIT: Definitions in areas not supported. Could you please address this limitation? Thank you! |
Best regards, Mike Kaganski |
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
I'll do that little later. |
Russia ☭ forever Viacheslav N. Mezentsev |
1 user thanked uni for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Updated. Definitions in areas now supported and function works faster. |
Russia ☭ forever Viacheslav N. Mezentsev |
2 users thanked uni for this useful post.
|
on 01/05/2014(UTC), on 01/05/2014(UTC)
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/12/2011(UTC) Posts: 319 Location: italy Was thanked: 109 time(s) in 93 post(s)
|
"includes" do not work correctly if you use the comma for decimals and the "dot" to denote the subscript in the variables. However I have seen in previous posts that Radovan had reported the problem to the name variables, and Martin has posted an example that uses a comma for decimals. someone confirm?
sergio
|
1 user thanked PompelmoTell for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Originally Posted by: PompelmoTell "includes" do not work correctly if you use the comma for decimals and the "dot" to denote the subscript in the variables. However I have seen in previous posts that Radovan had reported the problem to the name variables, and Martin has posted an example that uses a comma for decimals. someone confirm?
sergio Updated. My fault. The algorithm was changed and I forgot about it. |
Russia ☭ forever Viacheslav N. Mezentsev |
1 user thanked uni for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Updated (for compatibility with SMath Studio 0.97.5283).
UnitInfo.GetCurrentUnitName() changed to UnitsManager.GetCurrentUnitName(). |
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 18/09/2014(UTC) Posts: 71 Was thanked: 7 time(s) in 7 post(s)
|
A lot of discussion has taken place here so I post my bug report here too. Or shall I use the bugtracker system instead? Include does not work for variables defined in programming environment like if or for, see the example below, bread is not accessible in testmaster.sm brotjob attached the following image(s):
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Quote:Include does not work for variables defined in programming environment like if or for, see the example below, bread is not accessible in testmaster.sm You can do this like on the picture below. include() works with static global definitions (:=) only (static defs you can read directly from the sm-file, but for dynamic you must evaluate it first). I can't do that you want because this is too complicated. You may ask Andrey to add include() function in SMath Studio. He can do that. Edited by user 17 October 2014 12:05:42(UTC)
| Reason: Not specified uni attached the following image(s): |
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 18/09/2014(UTC) Posts: 71 Was thanked: 7 time(s) in 7 post(s)
|
This is a very elegant way for the above example. Thanks for showing me this. In cases where you have complex conditions and you want to define many variables in if statements it would not work. Also it does not work for loops for, while. That's why I will ask Andrey to implement this. see feature request To implement an include() function able to handle dynamic definitions. Please vote! Edited by user 17 October 2014 20:35:33(UTC)
| Reason: +link to ticket
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.