Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline TheWizEd  
#1 Posted : 05 July 2010 20:17:06(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
I am exploring plugins. I followed the directions of the tutorial using the VB Express.

The project compiles successfully but when I launch SMath I get an error message

"Error occured while trying to load third party assembly. Plugin disabled"
"Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)"

I cut and pasted the New Guid("a37cba83‐b69c‐4c71‐9992‐55ff666763bd"Wink.

Has anyone been successfull in duplicating the plugin tutorial?
Ed

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline maweilian  
#2 Posted : 06 July 2010 18:27:57(UTC)
maweilian


Rank: Advanced Member

Groups: Registered
Joined: 09/01/2010(UTC)
Posts: 102
Man
United States
Location: Oregon, USA

Was thanked: 5 time(s) in 5 post(s)
Since I created that tutorial a few weeks ago, I have yet to hear if anyone has successfully completed the tutorial. So, I would also like to know if anyone has been able to duplicate it. Anyone?

As to the problem you have encountered above, I am not sure what could be causing the error. As far as I know the GUID you used should work for all versions of Smath. Perhaps you could post your source code? That may help us to determine the source of the error. Also, what version of Smath are you using?

Andrey, do you have any idea what would cause this error?

Will

Edited by user 06 July 2010 18:36:23(UTC)  | Reason: Not specified

Will Massie
Mechanical Engineer
Oregon, USA
Offline Andrey Ivashov  
#3 Posted : 07 July 2010 00:46:19(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Seems this is an error with specified GUID in dependences or into the AssebmblyInfo.vb file. If it is possible, please, copy every lines of code with GUIDS of your solution here on the forum - we will check it.

Regards.
Offline TheWizEd  
#4 Posted : 07 July 2010 05:28:32(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
It turns out you cant' cut and paste the GUI from the tutorial doc to the VB Express IDE. I deleted the New Guid parameter and put it in manually.

New Guid("a37cba83-b69c-4c71-9992-55ff666763bd"Wink

It compiles and load but when I try to execute the function I get an error message

combin(5,3)=
Unable to cast object
of type 'SMath.Manager.Term'
to type 'Systems.Collection.Generic.IEnumerable`1[SMath.Manager.Term]'

My source code is listed below.

Imports SMath.Manager
Imports SMath.Math

Public Class Class1
Implements IPluginHandleEvaluation, IPluginLowLevelEvaluation

Dim termInfos() As TermInfo
Dim asseblyInfos() As AssemblyInfo

Public ReadOnly Property Dependences As SMath.Manager.AssemblyInfo() Implements SMath.Manager.IPlugin.Dependences
Get
Return Me.asseblyInfos
End Get
End Property

Public Sub Initialize() Implements SMath.Manager.IPlugin.Initialize
Me.termInfos = New TermInfo() {
New TermInfo("combin", TermType.Function, 2, "(n, k) ‐ Returns the number of subsets (combinations) of k elements that can be formed from n elements.", FunctionSection.Unknown, True)
}
Me.asseblyInfos = New AssemblyInfo() {
New AssemblyInfo("Smath Studio", New Version(0, 88), New Guid("a37cba83-b69c-4c71-9992-55ff666763bd"Wink)
}
End Sub

Public ReadOnly Property TermsHandled As SMath.Manager.TermInfo() Implements SMath.Manager.IPluginHandleEvaluation.TermsHandled
Get
Return Me.termInfos
End Get
End Property

#Region "IDisposable Support"
Private disposedValue As Boolean ' To detect redundant calls

' IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
' TODO: dispose managed state (managed objects).
End If

' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
' TODO: set large fields to null.
End If
Me.disposedValue = True
End Sub

' TODO: override Finalize() only if Dispose(ByVal disposing As Boolean) above has code to free unmanaged resources.
'Protected Overrides Sub Finalize()
' ' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
' Dispose(False)
' MyBase.Finalize()
'End Sub

' This code added by Visual Basic to correctly implement the disposable pattern.
Public Sub Dispose() Implements IDisposable.Dispose
' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
#End Region

Public Function ExpressionEvaluation(ByVal root As SMath.Manager.Term, ByVal args()() As SMath.Manager.Term, ByRef store As SMath.Manager.Store, ByRef result() As SMath.Manager.Term) As Boolean Implements SMath.Manager.IPluginLowLevelEvaluation.ExpressionEvaluation
If root.Type = TermType.Function And root.Text = "combin" And root.ChildCount = 2 Then
Dim arg1 As Term() = Decision.Preprocessing(args(0), store)
Dim arg2 As Term() = Decision.Preprocessing(args(1), store)
Dim answer As New List(Of Term)
answer.AddRange(arg1)
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))
answer.AddRange(arg2)
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))
answer.AddRange(arg1)
answer.AddRange(arg2)
answer.AddRange(New Term([Operator].Substraction, TermType.Operator, 2))
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))
answer.AddRange(New Term([Operator].Multiplication, TermType.Operator, 2))
answer.AddRange(New Term([Operator].Division, TermType.Operator, 2))
result = answer.ToArray()
Return True
End If
Return False
End Function
End Class

Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices

' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.

' Review the values of the assembly attributes

<Assembly: AssemblyTitle("Combinations Function"Wink>
<Assembly: AssemblyDescription("Plugin with Combinations function realization"Wink>
<Assembly: AssemblyCompany("Andrey Ivashov"Wink>
<Assembly: AssemblyProduct("Combinations Function"Wink>
<Assembly: AssemblyCopyright("Copyright © SMath 2010"Wink>
<Assembly: AssemblyTrademark(""Wink>

<Assembly: ComVisible(False)>

'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("a37cba83-b69c-9992-55ff666763bd"Wink>

' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*"Wink>

<Assembly: AssemblyVersion("1.0.*"Wink>
<Assembly: AssemblyFileVersion("1.0.*"Wink>
Ed
Offline Andrey Ivashov  
#5 Posted : 07 July 2010 09:13:51(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Try to change lines like:
Code:
answer.AddRange(New Term([Operator].Factorial, TermType.Operator, 1))

to
Code:
answer.Add(New Term([Operator].Factorial, TermType.Operator, 1))


AddRange function of the generic List can have only IEnumerable objects as an argument.

Regards.
Offline maweilian  
#6 Posted : 08 July 2010 18:18:31(UTC)
maweilian


Rank: Advanced Member

Groups: Registered
Joined: 09/01/2010(UTC)
Posts: 102
Man
United States
Location: Oregon, USA

Was thanked: 5 time(s) in 5 post(s)
Dear TheWizEd,

Let us know if the changes that Andrey suggested above allowed you to successfully complete the tutorial. Your feedback is appreciated.

Thanks, Will

Edited by user 08 July 2010 18:21:30(UTC)  | Reason: Not specified

Will Massie
Mechanical Engineer
Oregon, USA
Offline TheWizEd  
#7 Posted : 10 July 2010 17:05:50(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
Sorry, I was out of town for a few days.

I changed the AddRange to Add as suggested. I should have been more careful and examined my code more closely. Any way I was successful in duplicating the example. Thanks for your patience and help.Clap
Ed
Offline 9_82abZ2  
#8 Posted : 14 September 2015 23:33:57(UTC)
9_82abZ2

Rank: Newbie

Groups: Registered
Joined: 14/09/2015(UTC)
Posts: 7

I know that this is an old thread, but all the more reason to comment on it.

The tutorial (To the best of my knowledge) is outdated. The *.dll files it told me to reference didn't exist at the specified file location: (SMath.Math.Numeric.dll vs. NuLib.dll)

Some variable names changed [to the best of my knowledge] (dim store as Store -> dim context as Store)

Also, it seems that New TermInfo() changed drastically as arugumentInfo has been implemented and the remaining arguments got moved around.

Don't get me wrong, this tutorial was still helpful (I used Visual Studio 2013) and I only had to spend a small amount of time to get a working 'plugin'.

With that being said, I received the same error that started this thread and it did not pertain to the formulas I used. Rather, Visual Studio was using a different GUID then that specified, I had to go into Assembly Info. and change the GUID there in order for the plugin to load into SMath.

I strongly urge the VB tutorial to create custom classes to be updated (Yes, I am bias to VB.net).
In addition, a tutorial showing the process of creating a custom control would be awesome (i.e. a button that refreshes the page on click, equivalent to pressing [F9])
Offline Davide Carpi  
#9 Posted : 16 September 2015 01:23:50(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,647
Man
Italy
Location: Italy

Was thanked: 1329 time(s) in 875 post(s)
Originally Posted by: 9_82abZ2 Go to Quoted Post
The tutorial (To the best of my knowledge) is outdated. The *.dll files it told me to reference didn't exist at the specified file location: (SMath.Math.Numeric.dll vs. NuLib.dll)


Attached the updated sources (with some comments) both in C# and VB.NET

Originally Posted by: 9_82abZ2 Go to Quoted Post
In addition, a tutorial showing the process of creating a custom control would be awesome (i.e. a button that refreshes the page on click, equivalent to pressing [F9])


To start you can look at the CheckBoxRegion in the SVN, it is simple and complete (mouse click swap the output value 1/0); working with VB.NET you need only a converter in the IDE (in Visual Studio 2013 was possible using the extensions) or to use a tool to convert the project from C# to VB.NET

Edited by user 20 May 2016 21:02:53(UTC)  | Reason: marked as solved

File Attachment(s):
Tutorials.zip (357kb) downloaded 22 time(s).
Davide Carpi attached the following image(s):
2015-09-16 00_00_36-SMath Studio Desktop - [Page1_].png
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Users browsing this topic
Guest
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.