Using pyVisa with IronPython - external

The combination pyVisa and IronPython is giving me a hard time currently. I'm trying to communicate with an external device over GPIB using the pyVisa package, from within a script which in turn is written in IronPython.
It is the line
visa.ResourceManager()
that causes problems. I get the error "expected LP_c_ulong, got NativeArgument", that I can't resolve.
Is there any simple solution to this issue?
Thanks.

In my exeprience is not possible to import directly pyVISA in ironpython, I did someting working using Tektronix dll
clr.AddReferenceToFileAndPath('C:\\Windows\\Microsoft.NET\\assembly\\GAC_32\TekVISANet\\v4.0_1.1.1.0__7f19bb2a5a9ae6e8\\TekVISANet.dll')
import TekVISANet

Related

Adding "ant-design-pro": "^2.3.2" and including it in project resulting in error

I'm getting the below error when I try to import "ant-design-pro": "^2.3.2" and use it in my ShadowCLJS project.
The required JS dependency "./factoryWithThrowingShims" is not available, it was required by "node_modules/bizcharts/umd/BizCharts.js".
Confirmed that after removing the dependency and referece of ant-design-pro gets my app up and running properly.
Any help would be highly appreciated.

Library class doesn't know of ConfigureWebHostDefaults extension method

I'm building a suite of REST micro-services using .Net Core 3.0 Preview 6. All these services will have the same start up logic. So, I'm trying to place all the code in a .Net Standard library.
The goal is to have the IHostBuilder:CreateHostBuilder method, as well as the Startup:Configure and Startup:ConfigureServices class and methods in the library. The library will also contain error handling logic, customized http response messages, etc.
However, I can't seem to find the correct package that contains the ConfigureWebHostDefaults method. I tried adding the Microsoft.AspNetCore package 2.2.0, but that didn't resolve the issue.
I added the Microsoft.Extensions.Hosting (3.0.0-preview-6) package, that also doesn't resolve the issue.
Is what I'm attempting even possible?
Thanks
-marc
I resolved it, not the best way, but it works. I decided to make the library targeted specifically for .NET Core 3.0. So, I changed the targetframework in the project file. That change automatically resolved my other issue.
Import the Microsoft.AspNetCore package, and use WebHost.CreateDefaultBuilder() instead. According to the code it is built from, both CreateDefaultBuilder() and ConfigureWebHostDefaults() call the same internal method: ConfigureWebDefaults().
The only downside of this is that the returned host will be an IWebHost instead of an IHost.

parse4cn1 has some issue when working with Node JS and parse-server open source

The parse4cn1 library works well with parse.com but it has some issues when working with Node 4.3.2 and parse-server open source. For example, when calling the ParseUser.signup() function, the "Invalid key name" exception is always happened. I tried to debug and figure out that the ParseCommand object should add the ParseConstants.CONTENT_TYPE_JSON to its header in order to make it can work. I don't why because it still works without doing this with parse.com.
Another issue is the ParseQuery.find() is always failed when using the ParseQuery.whereContainedIn(). The server exception is "ParseException [code=102, msg=Improper encode of parameter, cause=null]". I guess this issue probably regarding the parameter has the json format in this case as well but I don't know to to resolve it. Any advice is appreciate. Sidiabale, do you have any advice? Thanks!
These problems are solved in version 3.0 of parse4cn1. Apparently, Parse Server is stricter with the need to specify the content-type header so code that previously worked with Parse.com does not work with Parse Server. I've addressed these issues in the aforementioned release. Try again with version 3.0 and let me know if you encounter any issues.

Grails package change for domain class caused DuplicateMappingException

While working through a tutorial to start learning Grails, I made a mistake and ran:
grails create-domain-class com.FooBar
instead of:
grails create-domain-class com.acme.FooBar
It was immediately obvious I had made an error so I tried the following:
Searched for a function that reverses the create-domain-class command, it seems there isn't one.
Searched for advice on the web and the consensus is that you can delete a domain class file, any associated views and tests, then to be safe run a text search for your class name in your project directory for any references you may have missed. I have done all this.
Then I ran the correct command to create com.acme.FooBar, which worked.
After this the app fails to run and reports the following error:
org.hibernate.DuplicateMappingException: duplicate import: FooBar refers to both com.acme.FooBar and com.FooBar (try using auto-import="false")
After adding the following code to com.acme.FooBar:
...
static mapping = {
autoImport false
}
...
The app now runs as expected.
However as an experienced Java developer who occasionally does refactor a package I would like to understand how to do that without causing a DuplicateMappingException or resorting to the "autoImport false" solution.
Thanks.
You shouldn't be doing
static mapping = {
autoImport false
}
As, by doing this you said that don't check for domain just by name and look up for package as well. Hence, once you do that you will have to use Fully qualified name of the class in your queries / hqls which may itch sometimes.
You should be removing the Domain completely i.e.
remove the Domain
remove the view folder creating by default with very same name and so do the controller
Now, do grails clean-all(Make it a thumb rule to use grails clean-all first for any issue unexpectedly occuring).
To be more accurate do remove target directory from your project and then do run grails run-app.
I had done very same thing many times and got it resolved by above steps.
Hope it helps.

Strange errors when linking to libmariadb

I'm currently develop an Objective-C library that links to the MariaDB C connector. I believe there is a problem with the library, though.
Every time I execute my code I get very strange errors on the console. The -(id)init method of my library calls mysql_init(NULL) to initialise the library but as soon as I return from -(id)init I get the following errors in the console:
Object 0x10643df70 of class XXX autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
Thing is, there is no multithreaded code being executed and if I run the same - (id)init without the call to mysql_init(NULL) the errors disappear. I believe the libmariadb library is causing these errors to appear. I don't get why though.
Do I need to build it with any special command line switches? Am I calling the right methods? I obviously used the MySQL online documentation as a guide.
Make sure you add this anytime you have a new thread:
#autoreleasepool {
//enter code here
}
Have you tried latest revision from launchpad?
Also try to build libmariadb with -DUNDEF_THREADS_HACK and
CMAKE_USE_PTHREADS:BOOL=OFF)
I was busy with other stuff for a while. I've since updated MariaDB to the latest version and, as far as I can tell, it works fine.