I'm trying to create a pjmedia recorder but after the creation the status is 12001 instead of PJSUCCESS(0).
pj_status_t function()
{
pjsua_recorder_id recorder_id;
pj_status_t status;
pj_str_t fileName =pj_str("mysong.wav");
status = pjsua_recorder_create(&fileName, 0, NULL, 0, 0, &recorder_id);
if (status != PJ_SUCCESS)
return status;
}
Thanks.
My mistake was that I didn't specify the full path of the file and it didnt get permission to write the file in that location.
Related
I'm setting up the client on my React Native project
let client = new LDClient();
let config = { "mobileKey": "YOUR_MOBILE_KEY" };
let user = { "key": "user_key" }; // where do I find this info?
await client.configure(config, user);
I'm currently getting as a return value to this {"_U": 0, "_V": 0, "_W": null, "_X": null} assuming that's because of the missing user_key.
Where can I find my user_key?
user_key is a unique string that identifies the user loading the website. It's something that you need to provide. LaunchDarkly needs to be able to differentiate your users in order to do things like partial rollouts.
I believe you got the user_key from launchDarkly or you can check it in their API documentation on how to get the user_key
As for the problem where you get {"_U": 0, "_V": 0, "_W": null, "_X": null}, this is what you get when you log Promise before it resolve.
I'd folow the example From I200 pdf for a stock item, but I dont' know how to download the file from an Sales Order. Does anybody has a clue?
IN202500Content stockItemSchema = context.IN202500GetSchema();
var commands = new Command[]
{
new Value
{
Value = "AAMACHINE1",
LinkedCommand = stockItemSchema.StockItemSummary.InventoryID
},
new Value
{
FieldName = "T2MCRO.jpg",
LinkedCommand =
stockItemSchema.StockItemSummary.ServiceCommands.Attachment
}
};
var stockItemAttachment =
context.IN202500Export(commands, null, 1, false, true);
You were almost there, in the "stockItemAttachment" variable you should have the content of the file "T2MCRO.jpg" in byte format.
The only thing you have left to do is to write it to your file system.
You can use the following command :
File.WriteAllBytes(Path, Convert.FromBase64String(stockItemAttachment[0][0]));
Anyone know to get a printer URI using CUPS API?
If not, does anyone know where I can find a list of allowable options that can be passed to cupsGetOption function.
Right now I can only find printer-info, printer-location, printer-make-and-model.
What your probably looking for is a the "device-uri". This is the uri to the remote device i.e lpd/socket/server address. If you're looking for the local uri it would be "printer-uri-supported" which would result in ipp://localhost:631/printers/printername. Here's how to get the remote uri...
#import <cups/cups.h>
const char * printer = "name_of_printer";
int num_dests;
cups_dest_t *dest,
*dests;
const char *value;
num_dests = cupsGetDests(&dests);
dest = cupsGetDest(printer, NULL, num_dests, dests);
if( dest == NULL){
return 0;
};
value = NULL;
if (dest->instance == NULL)
{
value = cupsGetOption("device-uri", dest->num_options, dest->options);
}
cupsFreeDests(num_dests, dests);
printf("uri - %s",value);
I have written the following lines of code to open a file under InstalledFolder directory:
Platform::String^ locationPath = Platform::String::Concat(Package::Current->InstalledLocation->Path, "\\Assets\\Logo.png");
CREATEFILE2_EXTENDED_PARAMETERS extendedParams = {0};
extendedParams.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
extendedParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
extendedParams.dwFileFlags = FILE_FLAG_SEQUENTIAL_SCAN;
extendedParams.dwSecurityQosFlags = SECURITY_ANONYMOUS;
extendedParams.lpSecurityAttributes = nullptr;
extendedParams.hTemplateFile = nullptr;
Wrappers::FileHandle file(
CreateFile2(
locationPath->Data(),
GENERIC_READ,
0,
OPEN_EXISTING,
&extendedParams
)
);
DWORD e = GetLastError();
if (file.Get() == INVALID_HANDLE_VALUE)
{
throw ref new Platform::FailureException();
}
The CreateFile2 returns access denied error. Can anyone please help me out?
As suggested by JP Alioto, I have tried with WinRT File I/O as the following
create_task(StorageFile::GetFileFromApplicationUriAsync(ref new Windows::Foundation::Uri("ms-appx:///Assets/Logo.png")))
.then([=](StorageFile^ f)
{
auto p = create_task(f->OpenAsync(FileAccessMode::Read));
p.wait();
});
I still get the following error at p.wait():
An invalid parameter was passed to a function that considers invalid parameters fatal
Thanks,
You are passing 0 for dwShareMode. The documentation for CreateFile2 says that this value...
Prevents other processes from opening a file or device if they request delete, read, or write access. Exclusive access to a file or directory is only granted if the application has write access to the file.
You do not have write access to files within the package, which is why you get the access denied error. You need to set the share mode to FILE_SHARE_READ.
I am trying to implment the XMPP Client. I am using BOSH Connection manager and can run the Strophe.connect but not Strophe.Attach. I have tried incrementing the RID, but no effect.. Any help please ? There is no error here, but the Strophe.Status.CONNECTED is never reached via the attach method and so I cannot send IQ or Presence.
Here is my code
try
{
var cookieJid = $.cookie("jid");
var cookieSid = $.cookie("sid");
var cookieRid = $.cookie("rid");
var connt = new Strophe.Connection("http://localhost:7070/http-bind/");
connt.attach(cookieJid, cookieSid, cookieRid + 1, function(status)
{
if (status === Strophe.Status.CONNECTED)
{
alert ("hola connected");
$("#userName").append("hola connected : " + connt.jid );
var iq = $iq({type: 'get'}).c('query', {xmlns: 'jabber:iq:roster'});
connt.sendIQ(iq, handleRoster);
connt.send($pres());
}
});
}
catch (e)
{
$("#userName").append("Pinky error is " + e);
}
Edit
Thanks Eric and Charlie.
So I took the latest Strophe.js and now Attached status does work.
But the connection disconnects instantaneously. I am not even able to fetch the Roster.
We can possibly do every thing with Connection.attach() as we would with connection.connect(), right?
Any thoughts?
Change the line:
if (status === Strophe.Status.CONNECTED)
...to...
if (status === Strophe.Status.CONNECTED || status === Strophe.Status.ATTACHED)
Are you using the latest Strophe library? In the version I'm using, I see that the status can be these values:
Status: {
ERROR: 0,
CONNECTING: 1,
CONNFAIL: 2,
AUTHENTICATING: 3,
AUTHFAIL: 4,
CONNECTED: 5,
DISCONNECTED: 6,
DISCONNECTING: 7,
ATTACHED: 8
}
Make sure you convert your cookieRid to a Number by using new Number(cookieRid). Otherwise, when you do +1 on it, you will get "####1".
You can test this out for yourself in Javascript:
var s = "123";
alert(s+1); // "1231" and not "124"
Also, as Eric answered, there is a status ATTACHED so you need to handle that event.