What is the correct place to list and examine ports in erl_driver - c

In the tutorial for erl_driver there seems to be no indication to where does the first ErlDrvPort object comes from. Say I want to wrap libusb-1.0 to use it from erlang. There is no place in the API described by ErlDrvEntry for any index methods. How does one find a port to open?

Normally you obtain the first port using the erlang:open_port/2 function, usage of which is shown in the code example in section 6.2 of the tutorial you linked to in your question.

Instead of using Ports to wrap a C library, you can also use NIFs. With Nifty there exists even a wrapper generator that does most of the work for you.

Related

what library does LED belong to in Pspice?

I am a student and new to Pspice, I am given the following example circuit
and asked to created the following circuit,
which I have this
I think I have my circuit designed correctly. However, I am having trouble with finding the correct diode. I have tried different library such as diode, ediode, diode_bridge, on_diode and infineon, but the diodes from these library don't give a current of 20mA(typically lower than that). I also tried to find discrete.olb, however it's not in my capture library.... Is there any other library contains the 2legs led like the diodes in example circuit?I think the reason why I am not getting 20mA is because of the diode?
As can be seen here on the PSPICE website, you should be able to find all of the LED models in the Optoelectronics->LEDs library.

Mono embed API modifying method body at runtime

Is it possible to modify a method body at runtime using mono embed API. Is there is a way to access method's body and signature. I know it's a little bit complicated but I really need it for a school project.
I was able to do this with the .Net framework. I found out that the .Net framework resolves all the methods at the managed code and there is an external method called SetmethodIL which I had to call using refelection and It worked but mono takes a different route. Mono takes the unmanaged code choice which calls an external method called create_runtime_class that gets the job done.
Thank you for your support.
I found out by examining the reflection_methodbuilder_to_mono_method method that a MonoMethod must have a MonoMethodHeader which contains information about the method.
At the line 3014 you will see how they were able to set the code of the method by passing the array address as a guint8.
As far as I know the code contains the CIL Instructions which is an array of bytes.
By using the method called mono_method_get_header you will be able to get the header of any method and by using technique above you will be able to modify the code. But I'm not sure if this gonna work or not It may only works with dynamically generated methods.
If you call an internal call with a byte array parameter to c Maybe we could get it right.

How can I supply pathconf with FUSE?

I would like to create a FUSE file system to mount tape archives. To do this correctly, I need to be able to supply replies to two pathconf keys, specifically _PC_NAME_MAX and _PC_PATH_MAX. It seems that FUSE takes the answer for the _PC_NAME_MAX key from the statfs function you provide, but I haven't found a way to set _PC_PATH_MAX. Is there a way to configure the answer to _PC_PATH_MAX? Is there in general a way to supply an answer to any pathconf call?
Further research indicates that this is not possible with FUSE at all. What a sad excuse for an API.

Generating an outgoing call in asterisk

I am using asterisk 11.9.0 and i want to generate an outgoing call.I found that for outgoing i have to make a .call file and place it in a var/spool/asterisk/outgoing.I am following the link below
http://the-asterisk-book.com/1.6/call-file.html#call-file-parameter
my code is same as given in the above link,the above example uses only single fixed number to call.
My problem is that
i have to generate an outgoing to a number fetched from database(outgoing to new number everytime),so how to write the code of .call file for multiple numbers outgoing and how to pass these numbers fetched from database to .call file from my extensions.conf
Is there any way to do that.
I am new to asterisk.
Any help would be appreciated.
You can use vicidial.org software to do that things.
Note, it is very bad idea do outboudn dialler-like app in asterisk without understanding asterisk logic and very-hi skills in programming/database.
For more info you also can use this page
http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out
Might be easier using WombatDialer as it has a plain API where you can tell it what you want it to do and it will take care of the rest. We have a plain set up for outbound and it took maybe a couple of days from zero to what we have now. ViciDial would have been overkill.
On why rolling your own is not a great idea, the Wombat manual is quite clear: http://manuals.loway.ch/WD_UserManual-chunked/ch01.html#_why_was_wombatdialer_created
You could also use the AMI (Asterisk Manager Interface), would be easier to program with a deamon running in the back to control what gets dialed and the responses to those dials. Mora info here https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=4817239.

Labjack Humidity Probe Example

I realize this might be a long shot, but does anyone have an example of using the EI-1050 probe with a Labjack controller in something C-related? I'm currently using a Labjack U12 if it matters.
It installed 2 examples, ljsht and ljsht-multi, that seem to be doing something related to it, but I can't find the source code.
Thank you for your time.
The applications you mentioned are written in LabVIEW, and the source code is available. Use LJSHT.exe to make sure your EI-1050 is connected right and giving good readings.
Refer to the EI-1050 datasheet for information about interfacing with the U12.
Then start with a basic C example like "VC6 Simple Example" or "U12 Dev-C++ Example":
http://labjack.com/support/u12/examples
... and add a call to the function SHT1X() described in Section 4.31 of the U12 User's Guide.

Resources