Getting access to a multiple layered non-public value - vb.net

I'm trying to get access to a property which is under multiple layers of non-public objects
if I copy the path I get:
DirectCast((New System.Collections.Hashtable.HashtableDebugView(DirectCast(DirectCast(tool, ESPRIT.KBMDAL.Collections.CuttingTools.CuttingTool).m_Technology, System.__ComObject).m_ObjectToDataMap).Items(0)).Value, System.Dynamic.IDispatchComObject).ComTypeDesc.TypeName
if I follow the path using the mouse it would be:
toollist is an arraylist
for each tool in toollist
tool -> non-public members -> m_Technology -> non-public members -> m_ObjectToDataMap -> object -> value -> ComTypeDes -> non-public members -> TypeName
I've also tried to get to the value step by step with reflection but with that it gets already Nothing for m_Technology.
The DirectCast says, that HashtableDebugView is Public and not accessible. Sadly nothing of that is from me I just try to get read access on this part.

Related

How do I resolve this error message? Azure DevOPs TF401232:Work item does not exist, or you do not have permissions to read it

Azure DevOPs TF401232:Work item does not exist, or you do not have permissions to read it
Open project setting -> Project configuration -> Areas -> select area path( 01 - Template ) -> click “…” -> security -> search for your account and then check the permission-View work items in this node and ensure it set to allow.
ALSO, make sure you are not part of the User Group that has an access level set to deny for view work items for respective node.

How can I dynamically generate test cases with common test?

With Common Test test suites, it looks like test cases must be 1:1 with atoms that correspond to top-level functions in the suite. Is this true?
In that case, how can I dynamically generate test cases?
In particular, I want to read a directory, and then, (in parallel) for each file in the directory, do stuff with the file and then compare against a snapshot.
I got the parallelization I wanted with rpc:pmap, but what I don't like is that the entire test case fails on the first bad assert. I want to see what happens with all the files, every time. Is there a way to do this?
Short answer: No.
Long answer: No. I even tried using Ghost Functions
-module(my_test_SUITE).
-export [all/0].
-export [has_files/1].
-export ['$handle_undefined_function'/2].
all() -> [has_files | files() ].
has_files(_) ->
case files() of
[] -> ct:fail("No files in ~s", [element(2, file:get_cwd())]);
_ -> ok
end.
files() ->
[to_atom(AsString) || AsString <- filelib:wildcard("../../lib/exercism/test/*.test")].
to_atom(AsString) ->
list_to_atom(filename:basename(filename:rootname(AsString))).
'$handle_undefined_function'(Func, [_]) ->
Func = file:consult(Func).
And… as soon as I add the undefined function handler, rebar3 ct start reporting…
All 0 tests passed.
Clearly common test is also using the fact that some functions are undefined to work. 🤷‍♂️
Data Directory
Each common test suite can have a "data" directory. This directory can contain anything you want. For example, a test suite mytest_SUITE, can have mytest_SUITE_data/ "data" directory. The path to data directory can be obtained from the Config parameter in test cases.
someTest(Config) ->
DataDir = ?config(data_dir, Config),
%% TODO: do something with DataDir
?assert(false). %% include eunit header file for this to work
Running tests in parallel
To run tests in parallel you need to use groups. Add a group/0 function to the test suite
groups() -> ListOfGroups.
Each member in ListOfGroups is a tuple, {Name, Props, Members}. Name is an atom, Props is list of properties for the groups, and Members is a list of test cases in the group. Setting Props to [parallel|OtherProps] will enable the test cases in the group to be executed in parallel.
Dynamic Test Cases
Checkout cucumberl project.

Get the JDBC Providers for the Cell using wsadmin

I am trying to list the jdbcprovider list at cell scope but it also list the jdbcproviders at node and server scope, how to get rid off the providers at node and server scope from the list?
AdminConfig.list('JDBCProvider', AdminConfig.getid( '/Cell:CellV70A/'))
output:
'"DB2 Universal JDBC Driver Provider(cells/CellV70A/nodes/nodename|resources.xml#JDBCProvider_1302300228086)"\n"DB2 Universal JDBC Driver Provider(cells/CellV70A|resources.xml#JDBCProvider_1263590015775)"\n"WebSphere embedded ConnectJDBC driver for MS SQL Server(cells/CellV70A|resources.xml#JDBCProvider_1272027151294)"'
If you look at the help for the AdminConfig.list command:
wsadmin>print AdminConfig.help('list')
WASX7056I: Method: list
...
Method: list
Arguments: type, scope
Description: Lists all the configuration objects of the type named
by "type" within the scope of the configuration object named by "scope."
...
It says "within the scope". Since node and server-scoped JDBCProviders are within the scope of the cell, they are returned by your command. If you list all JDBCProviders at cell scope using the Admin Console and then look at the Command Assistance, you'll see something like:
Note that scripting list commands may generate more information than is displayed by the administrative console because the console generally filters with respect to scope, templates, and built-in entries. AdminConfig.list('JDBCProvider', AdminConfig.getid('/Cell:MyCell/'))
So you'll need to filter your return list similarly. You could throw together a very simple script to do so:
jdbcProviders = AdminConfig.list('JDBCProvider', AdminConfig.getid('/Cell:MyCell')).split('\r\n')
for jdbcProvider in jdbcProviders:
if "/nodes/" or "/servers/" in jdbcProvider:
continue
print jdbcProvider

using the add function in a modular project

I have modeled my project in alloy, and I want to separate the run part from the modeled part of my project.
In some fact and predicate I use the add function in cardinality comparison.
Here is an example :
#relation1 = add[ #(relation2), 1]
When the run part and the model part are in the same file all work successfully.
But when I separate them in 2 files, I have the following syntax error :
The name "add" cannot be found.
I thought it needed to open the integer module where there is an add function, so I have opened it it the header of the model part.
But then the runtime ask me to specify the scope of this/Univ.
You must specify a scope for sig "this/Univ"
Here is an example :
first the model in one module
module solo
open util/ordering [A] as chain
//open util/integer
sig A{ b : set B}
fact { all a : A - chain/last | #(a.next.b) = add[ #(a.b), 2]}
sig B{}
then the run part in another module :
module due
open solo
run {#(solo/chain/first.b) = 2 }for 10 B, 5 A
when I call it like this I have the "the name add cannot be found" error.
When I uncomment the integer module opening, I have the "You must specify a scope for sig "this/Univ"" error.
What should I do that to make it works?
If I'm not mistaken + is the union operator and thus can't be used to perform additions.
Which version of alloy are you using ?
I think the add[Int,Int] function was added recently, before it used to be plus[int,int].
You might want to try plus[Int,Int] and see if it solves your problem.
Else it would be nice to have access to your models. Maybe the error comes from elsewhere.

Signing an F# Assembly (Strong name component)

I found this article on CodeProject:
http://www.codeproject.com/Articles/512956/NET-Shell-Extensions-Shell-Context-Menus
and thought it would be nice to give it a try, but in F#. So I came up with the following code:
open System
open System.IO
open System.Text
open System.Runtime.InteropServices
open System.Windows.Forms
open SharpShell
open SharpShell.Attributes
open SharpShell.SharpContextMenu
[<ComVisible(true)>]
[<COMServerAssociation(AssociationType.ClassOfExtension, ".txt")>]
type CountLinesExtension() =
inherit SharpContextMenu.SharpContextMenu()
let countLines =
let builder = new StringBuilder()
do
base.SelectedItemPaths |> Seq.iter (fun x -> builder.AppendLine(sprintf "%s - %d Lines" (Path.GetFileName(x)) (File.ReadAllLines(x).Length)) |> ignore )
MessageBox.Show(builder.ToString()) |> ignore
let createMenu =
let menu = new ContextMenuStrip()
let itemCountLines = new ToolStripMenuItem(Text = "Count Lines")
do
itemCountLines.Click.Add (fun _ -> countLines)
menu.Items.Add(itemCountLines) |> ignore
menu
override this.CanShowMenu() = true
override this.CreateMenu() = createMenu
However, I noticed that there is no support for signing an F# assembly in VS2012 (step 4. in the article). I learnt that if I want to do so, I need to create a key manually (typing "sn -k keyName.snk" into the command prompt) and then add a flag in "Project Properties -> Build -> Other Flags" (--keyfile:keyName.snk).
I still didn't manage to successfully run this. Moreover, using the author's application (in "Debugging the Shell Extension" section) I get an error that my assembly doesn't contain a COM server.
I believe I'm doing something wrong with the signing the component. Could you help me in running this ?
One way to sign an F# assembly is via the AssemblyFileKeyAttribute attribute.
Create a new module and in it put:
module AssemblyProperties
open System
open System.Reflection;
open System.Runtime.InteropServices;
[<assembly:AssemblyKeyFileAttribute("MyKey.snk")>]
do()
Where "MyKey.snk" is the path to your key relative to the project directory.
Another way, as found in this bug report on Microsoft Connect, is to add --keyfile:MyKey.snk to the Other Flags field in the Properties --> Build tab.
Using either approach; running sn -v myfsharpassembly.dll will assert that the assembly is valid after compilation.
Maybe the problem is that the assembly is not "ComVisible"?
I'm using this library in F# like this:
[<assembly:ComVisible(true)>]
[<assembly:AssemblyKeyFile("Key.snk")>]
do
()
That is, I specify the assembly-level attributes at a top-level do-block.