Enterprise Architect Add-In ConstLayOutStyles usage - add-in

Basicly i'm trying to layout a Diagram in Enterprise Architect with newly added DiagramObjects via Add-In.
I found that i should use the LayoutDiagramEx method.
Next step is usage. Here's some code i'm trying to make work:
Repository.GetProjectInterface().LayoutDiagramEx(diagram.DiagramGUID, EA.ConstLayoutStyles.lsCycleRemoveDFS, 4, 20, 20, false);
Visual Studio hints that there is an error:
Interop type 'EA.ConstLayoutStyles' cannot be embedded. Use the applicable interface instead.
I cannot find the problem here sadly.
Does anyone know how to use the ConstLayoutStyles?
Thanks for the tips or the answer in advance!
Tamas

Hi Instead Try the values directly from below.
Repository.GetProjectInterface().LayoutDiagramEx(treeSelectedObject.DiagramGUID, 0x40000000, 4, 20, 20, false);
In most cases only the default layout will be assigned.
where LayoutStyle is one of the Enum values from below
You can find the constant values in EA.
Scripts -> Local Scripts -> EAConstants-JScript\EAConstants-VBScript
HTH
Arshad

I think you are having this problem because of the setting on the reference to EA.Interop.dll.
If you have the option Embed Interop Types as true you would see these kind of errors.
Setting it to false will probably solve the error without losing the ability to use the enumerations defined in the API.

Related

How can I add a packge to the reflection support on Graalvm?

Is it possible to add a package in the reflection-config.json?
Something like:
[
{
"name" : "org.apache.tinkerpop.shaded.kryo.serializers.*",
"allDeclaredConstructors" : true
}
}
Instead of doing it one by one.
Thanks :)
As far as I know, that isn't possible yet. There is an open feature request for this: https://github.com/oracle/graal/issues/1236
Probably the best would be to create a Feature class which would register classes for reflection programmatically. Here's a short example: https://www.graalvm.org/reference-manual/native-image/Reflection/#configuration-with-features
The feature class needs to be on classpath then referenced using the --features= command line option.
I am using tracing agent features to auto generate a list for reflection/jni/resources, this should be quite convenient until one day the wildcard features is implemented. (I bet it will not be implemented due to performance concern.)

Xamarin NetStandard Android sfChart DateTimeStripLine not displayed?

This is fairly specific (as the title suggests).
I've recently ported my Xamarin Forms app to NETStandard, and now my sfChart DateTimeStripLine are not visible on Android.
Things show up more-or-less fine on UWP, so I don't think I've introduced regressions.
Anyone else having similar experiences? Has anyone successfully used ChartStripLine on NET Standard?
We have prepared a sample using DateTimeStripline in SfChart with .Net Standard 1.3 and it’s working fine in this sample. If still you face the problem, please provide Stripline related code snippet, it would be helpful to provide better solution.
So, finally figured out the issue:
The StripLines declared in XAML work fine, but binding to a StripLineCollection did not (android only). Unfortunately, declaring in XAML is not a particularly useful option.
To fix/workaround, declare StripLine in XAML like so:
<chart:DateTimeAxis x:Name="TheTimeAxis" ...>
<chart:DateTimeAxis.StripLines>
<!-- Empty def requires at least one item to be used
This creates container to fill in ViewModel.
Fixes dissappearing StripLines bug on android -->
<chart:DateTimeStripLine WidthType="Day" Width ="1"
Start="09/28/2017">
</chart:DateTimeStripLine >
</chart:DateTimeAxis.StripLines>
Then, in the code behind access the named axis, pull out the striplines and modify to your hearts content.
// Workaround Android: Our StripLines do not appear to be
// refreshing when bound from XAML. To fix we create in XAML,
// then retrieve the existing collection and pass that to the
// viewmodel for modification
DateTimeAxis sl = this.TheTimeAxis;
var slc = sl.StripLines;

Why does LambdaExpression.Compile() work on iOS (Xamarin)?

Since Xamarin.iOS doesn't support code generation at runtime, why do Compile() and DynamicInvoke() work as expected?
For example, the following code works fine:
var lambda = Expression.Lambda(
Expression.Add(
Expression.Constant(1),
Expression.Constant(2)
)
);
var f = lambda.Compile();
var result = f.DynamicInvoke();
// result==3 at this point
Is Xamarin evaluating the expression tree at runtime instead of emitting IL code?
On platforms that support code generation, Reflection.Emit-based LambdaCompiler is used.
If that's not available, the expression is interpreted using the interpreter. For example, there are classes that interpret Constant and Add.
The details of the Xamarin limitations are here.
You don't seem to be using anything in the Reflection.Emit namespace, which is the big no-no. Your code must still be AOT'd. Otherwise, I would imagine it would not work.
But there HAVE been examples of [native] developers thwarting the iOS static analysis tool and circumventing the dynamic code restriction. I tried to locate the article, but couldn't find it.
Anyway, I don't think your scenario exemplifies that. Your code example will still be AOT-compiled.
But you raise a really good question: at what time does the expression get evaluated?
EDIT:
Another SO answer on the same topic: What does Expression.Compile do on Monotouch?
There's also some good info on Expression.Compile() and "full AOT" here:
http://www.mono-project.com/docs/advanced/aot/
EDIT:
After reading some more, I think I know what's going on here. It's not that Expression.Compile() won't work...it's that when your iOS app bundle is subjected to the iOS static analysis tool when you submit it to the app store, it will not pass the analysis, because it is dynamically generating code. So, sure, you can use Expression.Compile(), but don't expect it to be accepted into the app store. But as mentioned by #svick, if you use the "full AOT" compile option, your Expression.Compile() will probably fail at runtime, or perhaps even fail compilation.

Lazarus Free Pascal / Delphi - RunError 211

I'm trying to connect my Windows XP program (Lazarus) to my Ubuntu postgres server.
When the Lazarus program runs, it seems to compile fine but I get this error:
Project ... raised exception class 'RunError(211)'.
Then it terminates execution (and I don't see any output), and opens up a file customform.inc. In that file, it shows a procedure procedure TCustomForm.DoCreate; where it highlights a line: if Assigned(FOnCreate) then FOnCreate(Self);
I believe this is one of the system's files.
I never get to see any output.
What could this be? Thanks!
MORE INFO:
I've narrowed down the error to this line:
dbQuery_Menu.SQL.Text:='Select * From "tblMenus"';
dbQuery_Menu.Open;
the exception is triggered when the OPEN statement gets executed.
BTW, dbQuery_Menu is defined as a TSQLQuery component.
Clueless! :(
Run error 211 appears when you try to call an abstract method. Check this link from more information on FreePascal/Lazarus runtime errors.
Since you say all is done by code and you have no visual components, the problem probably lies in your code trying to use an ancestor component which has not overriden the Open method. You should be able to solve this by using the correct descendant component.
Another possibility, although I would strongly recommend to avoid this one, is to override the Open method yourself. It should be avoided because if you are using an ancestor component then you probably would have to override more abstract methods.
HTH
After nearly 5 days I found the answer. Many thanks to all thos e ho have contributed with their ideas ESPECIALLY RRUZ, RBA and Guillem Vicens. there are other related posts all connected to getting the FIRST Lazarus program working with PostgreSQL.
Summary.
The biggest mistake I made here was that I used the TSQLConnection component. Don't do this. Instead use the TPQConnection.
Everything is done through code. We're not using any draggable components from the top tab.
Don't rely on the Lazarus docs (wiki) at least for working with PG DBs.. It is outdated. Some of the examples can be pretty misleading.
Make sure that fields have some default values. For example, if a Boolean field has no true or false (t/f) set, this may lead to errors.
And that's it! I hope many postgres+Lazarus newbies will find this useful.
From here - http://www.network-theory.co.uk/docs/postgresql9/vol2/SQLSTATEvsSQLCODE.html - -211 (ECPG_CONVERT_BOOL) This means the host variable is of type bool and the datum in the database is neither 't' nor 'f'. (SQLSTATE 42804)

How to filter Delphi 2010 compiler output (hints)?

I'm trying to get rid of some hints(*) the Delphi compiler emits. Browsing through the ToolsAPI I see a IOTAToolsFilter that looks like it might help me accomplish this through it's Notifier, but I'm not sure how to invoke this (through what xxxServices I can access the filter).
Can anyone tell me if I´m on the right track here? Thanks!
(*) In particular, H2365 about overridden methods not matching the case of the parent. Not so nice when you have about 5 million lines of active code with a slightly different code convention than Embarcadero's. We've been working without hints for months now, and we kinda miss 'm. :-)
Even if you could query BorlandIDEServices for IOTAToolsFilter, that interface isn't going to help you do what you're asking. That interface was introduced as part of a mechanism for adding additional build tools (compilers, etc.) to the IDE (before the IDE used MSBuild). It allowed you to write a custom "filter" to handle output from a particular build tool, but it would not let you apply a filter to one of the built-in tools (like the delphi compiler).
The reason the Supports(BorlandIDEServices, IOTAToolsFilter, OTAToolsFilter) call fails in Delphi2010 is that once MSBuild support was added to the IDE, the old way of adding build tools to the IDE was disabled, and the BorlandIDEServices interface no longer supported IOTAToolsFilter.
The declaration of IOTAToolsFilter should probably have been marked deprecated in ToolsAPI.pas (or least it should have been mentioned in the source code comment that it is no longer supported).
As far as your desire to filter a particular hint, I'm not aware of a way to do that via the ToolsAPI. It seems like a reasonable thing that can be added to IOTAMessageServices (the ability to enumerate, filter, and possibly change the messages in the IDE's Message View). I would enter a request in QualityCentral for that.
Also, please vote for QC #35774 (http://qc.embarcadero.com/wc/qcmain.aspx?d=35774), as if that were implemented, you would not need to use the ToolsAPI for this sort of thing.
According to http://docwiki.embarcadero.com/RADStudio/en/Obtaining_Tools_API_Services it should be possible to access it directly using BorlandIDEServices, eg:
var
OTAToolsFilter: IOTAToolsFilter;
begin
if Supports(BorlandIDEServices, IOTAToolsFilter, OTAToolsFilter) then
ShowMessage('supports IOTAToolsFilter')
else
ShowMessage('IOTAToolsFilter NOT supported');
end;
However this doesn't return the desired interface in Delphi 2010 (you'll get the not supported message), so there's either an error in the documentation, or an error in BorlandIDEServices not returning the correct interface.

Resources