Error with SPPID's Interop.Llama library : System.Runtime.InteropServices.COMException (0x80000008): No DBConnect for Data_Dictionary - vb.net

I'm having the following error usiing SmartPlant P&ID (SPPID) automation library Llama (Interop.Llama.dll):
System.Runtime.InteropServices.COMException (0x80000008): No DBConnect for Data_Dictionary
at Llama._LMEquipments.Collect(LMADataSource& DataSource, _LMAItem& Parent, String& RelationshipName, LMAFilter& Filter)
Here is the code that calls it:
Dim objDS As Llama.LMADataSource
Dim objEquips As Llama.LMEquipments
objDS = New Llama.LMADataSource
objDS.ProjectNumber = Project.SPPIDName & "!" & Project.SPPIDName
objDS.SiteNode = Project.SiteServer
objEquips = New Llama.LMEquipments
objEquips.Collect(objDS) ' throws Exception
Any ideas on what might be wrong?
SPPID is an engineering tool used to develop and manage piping and instrumentation diagrams. Llama is an automation library supplied with SPPID.

This means that your code can't find that specific project in SPPID available plant structures database. Beware that the ProjectNumber string is case sensitive .
In my case, all I had to do was to change project name, from PF2_REF to PF2_Ref (replaced last two letters for lowercase equivalents).

Related

dnn 7+ search is not indexing custom module items

I have a dnn 7.2.2 development site running under dnndev.me on my local machine. I have created a simple product catalogue module and am trying to integrate the new search for dnn 7.
Here is the implementation of ModuleSearchBase in my feature/business controller
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Services.Search
Imports DotNetNuke.Common.Globals
Namespace Components
Public Class FeatureController
Inherits ModuleSearchBase
Implements IUpgradeable
Public Overrides Function GetModifiedSearchDocuments(moduleInfo As ModuleInfo, beginDate As Date) As IList(Of Entities.SearchDocument)
Try
Dim SearchDocuments As New List(Of Entities.SearchDocument)
'get list of changed products
Dim vc As New ViewsController
Dim pList As List(Of vw_ProductList_Short_Active) = vc.GetProduct_Short_Active(moduleInfo.PortalID)
If pList IsNot Nothing Then
''for each product, create a searchdocument
For Each p As vw_ProductList_Short_Active In pList
Dim SearchDoc As New Entities.SearchDocument
Dim ModID As Integer = 0
If p.ModuleId Is Nothing OrElse p.ModuleId = 0 Then
ModID = moduleInfo.ModuleID
Else
ModID = p.ModuleId
End If
Dim array() As String = {"mid=" + ModID.ToString, "id=" + p.ProductId.ToString, "item=" + Replace(p.Name, " ", "-")}
Dim DetailUrl = NavigateURL(moduleInfo.TabID, GetPortalSettings(), "Detail", array)
With SearchDoc
.AuthorUserId = p.CreatedByUserId
.Body = p.ShortInfo
.Description = p.LongInfo
.IsActive = True
.PortalId = moduleInfo.PortalID
.ModifiedTimeUtc = p.LastUpdatedDate
.Title = p.Name + " - " + p.ProductNumber
.UniqueKey = Guid.NewGuid().ToString()
.Url = DetailUrl
.SearchTypeId = 2
.ModuleId = p.ModuleId
End With
SearchDocuments.Add(SearchDoc)
Next
Return SearchDocuments
Else
Return Nothing
End If
Catch ex As Exception
LogException(ex)
Return Nothing
End Try
End Function
End Class
End Namespace
I cleared the site cache and then I manually started a search re-index. I can see from the host schedule history that the re-index is run and completes.
PROBLEM
None of the items in the above code are added to the index. I even used the Luke Inspector to look into the lucene index and that confirms that these items are not added.
QUESTION
I need help figuring out why these items are not getting added or I need help on how to debug the indexing to see if anything is going run during that process.
Thanks in Advance
JK
EDIT #1
I ran the following procedure in Sql Server to see if the module is even listed in the search modules:
exec GetSearchModules[PortalId]
The module in question does appear in this list. The indexing is called for the featureController, but the results are not added to the lucene index. Still need help.
EDIT #2
So I upgraded to 7.3.1 in the hopes that something during the installation would fix this issue. But it did not. The search documents are still getting created/ returned by the GetModifiedSearchDocuments function but the documents are not being added to the Lucene index and therefore do not appear in the search results.
EDIT #3
The break point is not getting hit like i thought after the upgrade, but I added a try catch to log exceptions and the following error log is getting created when I try to manually re-index (cleaned up to keep it short)
AssemblyVersion:7.3.1
PortalID:-1
PortalName:
DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke
ExceptionGUID:d0a443da-3d68-4b82-afb3-8c9183cf8424
InnerException:Sequence contains more than one matching element
Method:System.Linq.Enumerable.Single
StackTrace:
Message:
System.InvalidOperationException: Sequence contains more than one matching element
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at DotNetNuke.Services.Scheduling.Scheduler.CoreScheduler.LoadQueueFromTimer()
at DotNetNuke.Services.Scheduling.Scheduler.CoreScheduler.Start()
Source:
Server Name: KING-PC
EDIT #4
Okay, I fixed the problem in edit three following This Disucssion on the DNN issue tracker, but still no items being added to the lucene index.
The breakpoint is hit, and once i leave the debugger running for a while i get the following error:
{"Exception of type 'Lucene.Net.Index.MergePolicy+MergeException' was
thrown."} {"Cannot overwrite:
C:\websites\dnndev.me\App_Data\Search\_1f0.fdt"}
Looks like a permission error. I'll see what I can work out
J King,
I just finished a series on DNNHero.com on Implementing Search in your Module. Parts 3 and 4 are implementing and debugging your ModuleSearchBase implementation.
EDIT: Remove your assignment to the SearchTypeId in your implementation
Also, here is a sample snippet to see how i am setting the attributes of the SearchDocument. Again, watch my video for a whole bunch of other potential pitfalls in the Search implementation.
SearchDocument doc = new SearchDocument
{
UniqueKey = String.Format("{0}_{1}_{2}",
moduleInfo.ModuleDefinition.DefinitionName, moduleInfo.PortalID, item.ItemId),
AuthorUserId = item.AssignedUserId,
ModifiedTimeUtc = item.LastModifiedOnDate.ToUniversalTime(),
Title = item.ItemName,
Body = item.ItemDescription,
Url = "",
CultureCode = "en-US",
Description = "DotNetNuclear Search Content Item",
IsActive = true,
ModuleDefId = moduleInfo.ModuleDefID,
ModuleId = item.ModuleId,
PortalId = moduleInfo.PortalID,
TabId = tab
};

compressing the file using SevenZipSharp.dll

I want to compress and move the file using vb.net and SevenZipSharp.dll
c:\Backup\FULLBackup.bak -> c:\Archive\20130322.7z
I added a reference SevenZipSharp.dll
Imports SevenZip
SevenZip.SevenZipCompressor.SetLibraryPath(System.AppDomain.CurrentDomain.BaseDirectory & "\SevenZipSharp.dll")
Dim theCompressor As New SevenZipCompressor()
With theCompressor
.ArchiveFormat = OutArchiveFormat.SevenZip
.CompressionMode = CompressionMode.Create
.CompressionMethod = CompressionMethod.Default
.DirectoryStructure = False
.CompressionLevel = CompressionLevel.Normal
End With
theCompressor.CompressFilesEncrypted("c:\Archive\20130322.7z","c:\Backup\FULLBackup.bak")
I get an error : Can not load 7-zip library or internal COM error! Message: library is invalid.
I think it's simply the fact that the LibraryPath must not point to "SevenZipSharp.dll" but to "7z.dll".
http://blog.jongallant.com/2011/10/7-zip-dll-file-does-not-exist.html#.UaOLk0DxobA

query ebay odata with linq

I am pulling information from eBay using their odata feed. I am trying to use linq to pull the specific information we are after. Using linq I can get down to the specific element holding the information we want. What I can't do is figure out how to query the element data to get the specific child elements I want. I could just parse it but really want to learn linq. I am using vb.net as the language. To get the element I am after I use the following:
Sub Main
dim ns = "http://ebayodata.cloudapp.net/"
dim url as string = "http://ebayodata.cloudapp.net/Items?search=1756-L65"
Using reader As XmlReader = XmlReader.Create(url)
While reader.Read()
If reader.NodeType = XmlNodeType.Element AndAlso reader.Name = "entry" Then
GetChildContentElements(reader)
End If
End While
End Using
End Sub
Private Sub GetChildContentElements(reader As XmlReader)
' move to first child
While reader.Read()
If reader.NodeType = XmlNodeType.Element AndAlso reader.Name = "m:properties" Then
Exit While
End If
End While
Dim bookXml As XElement = DirectCast(XNode.ReadFrom(reader), XElement)
Console.WriteLine(bookXml)
End Sub
One of the elements this returns looks like:
<m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<d:Id>160917851201</d:Id>
<d:UserId>baltisales</d:UserId>
<d:Title>Allen Bradley 1756-L65 /B ControlLogix Processor 32MB Memory *60 DAYS WARRANTY!*</d:Title>
<d:Subtitle m:null="true"></d:Subtitle>
<d:SellingState>Active</d:SellingState>
<d:TimeLeft>P24DT2H25M33S</d:TimeLeft>
<d:Currency>USD</d:Currency>
<d:CurrentPrice m:type="Edm.Double">6446.14</d:CurrentPrice>
<d:MinimumToBid m:type="Edm.Double">6446.14</d:MinimumToBid>
<d:BidCount m:type="Edm.Int32">0</d:BidCount>
<d:Description m:null="true"></d:Description>
<d:QuantitySold m:type="Edm.Int32">0</d:QuantitySold>
<d:AutoPay m:type="Edm.Boolean">false</d:AutoPay>
<d:CharityId m:null="true"></d:CharityId>
<d:Country>US</d:Country>
<d:Compatibility m:null="true"></d:Compatibility>
<d:GalleryUrl>http://thumbs2.ebaystatic.com/m/m3Y01PfuyFhctnJiEet95Gw/140.jpg</d:GalleryUrl>
<d:GlobalId>EBAY-US</d:GlobalId>
<d:PostalCode>21209</d:PostalCode>
<d:ReturnsAccepted m:type="Edm.Boolean">true</d:ReturnsAccepted>
<d:PrimaryCategoryId>97184</d:PrimaryCategoryId>
<d:SecondaryCategoryId m:null="true"></d:SecondaryCategoryId>
<d:ViewItemUrl>http://www.ebay.com/itm/Allen-Bradley-1756-L65-B-ControlLogix-Processor-32MB-Memory-60-DAYS-WARRANTY-/160917851201?pt=BI_Control_Systems_PLCs</d:ViewItemUrl>
<d:PaymentMethods>PayPal ,VisaMC ,AmEx</d:PaymentMethods>
<d:Condition m:type="eBay.Model.Entities.Condition">
<d:Id m:type="Edm.Int32">3000</d:Id>
<d:Name>Used</d:Name>
</d:Condition>
<d:ListingInfo m:type="eBay.Model.Entities.ListingInfo">
<d:BestOfferEnabled m:type="Edm.Boolean">true</d:BestOfferEnabled>
<d:BuyItNowAvailable m:type="Edm.Boolean">false</d:BuyItNowAvailable>
<d:BuyItNowPrice m:type="Edm.Double" m:null="true"></d:BuyItNowPrice>
<d:ConvertedBuyItNowPrice m:type="Edm.Double" m:null="true"> </d:ConvertedBuyItNowPrice>
<d:Gift m:type="Edm.Boolean">false</d:Gift>
<d:ListingType>StoreInventory</d:ListingType>
<d:StartTime m:type="Edm.DateTime">2012-11-06T23:08:18Z</d:StartTime>
<d:EndTime m:type="Edm.DateTime">2013-04-05T23:13:18Z</d:EndTime>
</d:ListingInfo>
<d:Distance m:type="eBay.Model.Entities.Distance" m:null="true"></d:Distance>
<d:ShippingInformation m:type="eBay.Model.Entities.ShippingInformation">
<d:Delimiter m:null="true"></d:Delimiter>
<d:ExpeditedShipping m:type="Edm.Boolean">true</d:ExpeditedShipping>
<d:HandlingTime m:type="Edm.Int32">1</d:HandlingTime>
<d:OneDayShippingAvailable m:type="Edm.Boolean">true</d:OneDayShippingAvailable>
<d:ShippingServiceCost m:type="Edm.Double">0</d:ShippingServiceCost>
<d:ShippingType>FlatDomesticCalculatedInternational</d:ShippingType>
</d:ShippingInformation>
</m:properties>
I am struggling with querying the above to get the specific child elements we need to work with. The ":" in the tags seems to be confusing using namespaces. What I would like to do is to be able to query the element to get values for d:Id, d:UserId, d:Currentprice, etc. Any suggestions would be welcomed.
Try using WCF data services client. It can generate proxy classes for you that would simplify things. Refer to the documentation here.
Sample code for doing custom url's with generated WCF DS client,
const string baseAddress = "http://ebayodata.cloudapp.net/";
EBayData ebay = new EBayData(new Uri(baseAddress));
var items = ebay.Execute<Item>(new Uri(baseAddress + "Items?search=1756-L65"));
foreach (var item in items)
{
Console.WriteLine(item.Title);
}

VB.NET Serialization Missing dot right before new line serialization

I've been using XML serialization for a while, and today I realized something really odd. If I have a new line right after a "dot" (.), when i deserialize, I lose the dot. Has anyone ever had this happen to them? The following is my serialization code:
Serialize
Dim xmlSerializer As New System.Xml.Serialization.XmlSerializer(GetType(SilverWare.Licensing.Common.StoreLicense), New System.Type() {GetType(SilverWare.Licensing.Common.StationLicense)})
Dim gen As LicenseGenerator
If store Is Nothing Then
Throw New ArgumentNullException("store")
ElseIf store.StationLicenses Is Nothing Then
Throw New ArgumentNullException("store.StationLicenses")
ElseIf store.StationLicenses.Length = 0 Then
Throw New ArgumentOutOfRangeException("store.StationLicenses", "Must contain at least one element.")
End If
' Create a license generator for issuing new license keys.
gen = New LicenseGenerator(store)
' Generate store key.
store.LicenseKey = gen.GenerateLicenseKey
' Generate individual station keys.
For Each station In store.StationLicenses
station.LicenseKey = gen.GenerateLicenseKey(station)
Next
' Write license to file.
Using xFile As Xml.XmlWriter = Xml.XmlWriter.Create(licenseFile)
xmlSerializer.Serialize(xFile, store)
xFile.Close()
End Using
Deserialize
Dim xmlDeserializer As New System.Xml.Serialization.XmlSerializer(GetType(SilverWare.Licensing.Common.StoreLicense), New System.Type() {GetType(SilverWare.Licensing.Common.StationLicense)})
Dim result As SilverWare.Licensing.Common.StoreLicense
Using xFile As Xml.XmlReader = Xml.XmlReader.Create(licenseFile)
result = DirectCast(xmlDeserializer.Deserialize(xFile), SilverWare.Licensing.Common.StoreLicense)
xFile.Close()
End Using
Return result
The really funny part is that if I have a space after the dot, or remove the new line character, there are no problems. This only happens if it is dot which I find mind boggling.
Here is a quick sample of my XML file that was created when I serialized:
<?xml version="1.0" encoding="utf-8" ?>
<StoreLicense xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
...
<ReceiptAddress>98 N. Washington St.
Berkeley Springs West Virginia</ReceiptAddress>
<Name>Ambrae House at Berkeley Springs</Name>
<AliasName>Ambrae House</AliasName>
<Address1>98 N. Washington St.</Address1>
<Address2 />
...
</StoreLicense>
The line that is having the problem is the ReceiptAddress Node.
This post on MSDN seems to answer your question.
MSDN: Serialize String containing only whitespace such as a " " character
From that post, try this:
<XmlAttribute("xml:space")> _
Public SpacePreserve As [String] = "preserve"
This creates a root node like the following:
<DataImportBase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:space="preserve">
Jim
Since I was using someone elses dll, I didn't even think that it would be modifying my data when we imported it. What was happening was that the other programmer had a reg_ex that was looking for a dot before a new line. That was my issue, and my grief for 3 months.

ClearCase : list the content of a directory (ls) using CAL

In ClearCase, you can list the content of a directory using "cleartool ls".
My question is how can I do the same thing using CAL (ClearCase Automation Layer). The reason I prefer the COM API is because I won't have to parse the output of "ls".
So far, I am able to get the VOB and the View successfully, but I didn't find any method for listing the content.
My code so far:
IClearCase cc = new ApplicationClass();
CCVOB vob = cc.get_VOB("\\VOB-name");
CCView view = cc.get_View("ViewTag");
Thank you for your help.
I wrote VonC's answer in C# for those interrested.
string[] files = Directory.GetFiles("View path here", "*.*", SearchOption.AllDirectories);
foreach (string file in files)
{
try
{
CCVersion ver = cc.get_Version(file);
Console.WriteLine(ver.Path);
}
catch(Exception) {/*the file is not versioned*/}
}
May be this is a good start:
Set CC = Wscript.CreateObject("ClearCase.Application")
Set DirVer = CC.Version(".")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Folder = FSO.GetFolder(DirVer.Path)
Wscript.Echo "Files under source control: "
For Each File in Folder.Files
On Error Resume Next
Set Ver = CC.Version(File.Name)
If Err.Number = 0 Then
Wscript.Echo Ver.ExtendedPath
End If
Next
The idea being to use ICCVersion methods to try accessing the version of a file. If it does not return an error, it is indeed a versioned file.
Now I know the file is versioned, how can I remove it (rmname).
Do not use RemoveVersion():
Removes irretrievably the version (equivalent to cleartool rmver)
WARNING! This is a potentially destructive operation. Because CAL does not prompt the user for input under any circumstances, there is no confirmation step when RemoveVersion is invoked. Invoking RemoveVersion is equivalent to running cleartool rmver with the -force option.
Instead use the RemoveName from the ICCElement interface.