Use ruby gem https://github.com/nehresma/cupsffi
(wrapper cups.h https://github.com/nehresma/cupsffi/blob/master/lib/cupsffi/lib.rb cupsffi/lib.rb for ruby)
There are two servers cups. One works without problems. Another one crashes when trying to send a print job:
https://github.com/nehresma/cupsffi/blob/master/lib/cupsffi/printer.rb#L151
Error message: The printer or class does not exist.
The error appeared after the service that uses cupsffi moved to another server. CUPS server remains the same
Any advice?
Related
We're using odoo.sh platform with odoo14. The installed wkhtmltopdf is wkhtmltopdf_paas_wrapper 0.12.5, we can't upgrade to 0.12.6 because the access is very limited we cant use 'sudo' to apt-install. To temporarily solve this, we decided to use the 0.12.5 version. But it returns "Unable to call host printing service (HTTPError)" even with the right arguments. I've already tried it with the staging and production server, but still the same result. The ticket I've sent hasn't been replied to yet. This is so frustrating, I'm going bonkers...please help.
here's a screenshot:
ps: unrecognized argument error was intentional so I can display the available args. I've also crossed out the project domain. Thank you
Apparently, to properly execute the package, it should not have been "wkhtmltopdf" but instead "wkhtmltopdf.bin". I've overridden the ir_actions_report.py to change the package name. Here's the snippet of the original source code:
They shouldve known better, its a paid platform.
I want to create a Windows system service using QT/MinGW which communicates with other applications over DBUS (from freedesktop.org). For the moment DBUS is running as a "service" by meaning of it was installed as service using the instsrv/srvany tools (however, the DBUS will get it's bus-service-win later). Since running as a service, DBUS is running as system bus.
I wrote a simple application to ensure that DBUS is working (creates on simple object with 1 method and exectued it with QDBusViewer). Well, that worked.
Next I tried to use the same DBUS stuff in the ServiceMain from my service, where ServiceMain is a member of a class created by our own). I can see the object in QDBusViewer, but as soon as I select it, QDBusViewer reported a timeout (no reply) after it stucked for a while.
I have seen this behavior in my test application, and could fix it by creating a QCoreApplication "app" and "block" on app.exec() after the DBus object have been created. I tried the same in the service, but got a warning that QCoreApplication was not created in the main thread, and the problem still persists.
I tried to create "app" in the function that calls StartServiceControlDispatcher() and run app.exec in the ServiceMain, but app.exec() quits immediately with a the error "must be called from the main thread".
How can I get over this? Have much thanks in before.
Comparing my own service class against the QtService class from "QT Solution" fixed my problem.
All after all I needed to put the StartServiceControlDispatcher() function into a QThread and change the method of my service class in a way that exec() is only executed when definitely running in the context of the SCM.
So I am trying to build an application that uses libtorrent. However, before I start I would like to make sure that I have compiled the lib correctly and that I have a functioning environment for testing.
I am currently running a VM with opentracker and I try to connect using the example client in libtorrent.
First I start by creating a .torrent file using libtorrent (I am currently not sitting in front of a computer with libtorrent available so I might be remembering the exact commands a bit wrong):
maketorrent.exe dummy.txt -t "http://10.XXX.XXX.XXX/announce"
This gives me a .torrent file called a.torrent. Opening the file everything looks ok, the bencoding is correct and the announce address is there.
Next I try to add it to the example client hoping it starts to seed:
client_test.exe a.torrent
Everything starts up OK, but no tracker is found. Then if I press t to show tracker information I see an error (maybe not the exact phrasing):
Alert: {null} unsupported URL protocol
OK, so maybe something is wrong with how I built libtorrent. So I get the Halite client instead since that is also supposed to be build upon libtorret. But there I have the same problem.
So I have a look at the code and found where this error message is generated. The code is checking if I am supplying an address using the HTTP or HTTPS protocol, which I am. So could it be that I am not able to use a bare IP-address or am I doing something wrong?
I found the problem. It was not a problem with the IP address or the torrent itself. Instead it was a problem with caching.
The first time I added the torrent I used http:\XXX.XXX.XXX.XXX instead of http://XXX.XXX.XXX.XXX which didn't work. However whatever change i did to the torrent file after that did not stick. It was always falling back to that original file until I removed the .resume folder.
I'm trying to make a ACR1222L work with this ruby script that I found on github.
The script is made for the older ACR122U, but in my research I've seen that they both should be pretty similar.
My problem is when trying to run the script, I get this error:
C:\Users\Emil\Desktop>driver.rb
Calibration Time!
Place and leave a tag on the device
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/smartcard-0.5.5/lib/smartcard/pcsc/conte
xt.rb:112:in `wait_for_status_change': (0x100000006) (Smartcard::PCSC::Exception)
from C:/Users/Emil/Desktop/driver.rb:24:in `<main>'
Could it be that the "smartcard" gem used by the script does not support the ACR1222L, or am I simply just missing something?
Hope that someone can help!
The Smartcard::PCSC::Exception error code you get (0x100000006) translates to the Windows API error code INVALID_HANDLE_EXCEPTION (0x00000006). This typically indicates that the context handle used in the API call is invalid. With the smartcard gem, the PS/SC context (SCardEstablishContext) is established through the initializer of Smartcard::PCSC::Context. This operation seems to be successful, otherwise you would get an exception on line 13. The source of the INVALID_HANDLE_EXCEPTION seems to be SCardGetStatusChange (invoked by context.wait_for_status_change).
A possible reason for that call to fail with an INVALID_HANDLE_EXCEPTION could be a mismatch in the handle format, for instance caused by a 32-bit/64-bit mismatch. Thus, I would assume that the smartcard gem is designed for 32-bit only (while your path indicates that you are using a 64-bit version of Ruby).
EDIT:
The ERROR_PARTIAL_COPY error was not caused by the call to GetBinaryType() but by an earlier call to EnumProcessModules(), that was attempting to acquire the full path of the executable for a process to pass to GetBinaryType(), that failed. There was exception chaining occurring which I missed and that set the error message of the exception to the same error message in the original post but retained the OS error code of ERROR_PARTIAL_COPY.
This function is called from within a 32-bit Windows Service. I have searched the internet and stackoverflow and found no other instance where GetBinaryType() failed and GetLastError() returned ERROR_PARTIAL_COPY:
Only part of a ReadProcessMemory or WriteProcessMemory request was completed.
A possibility I considered was that ERROR_PARTIAL_COPY was being set by an earlier WINAPI call and GetBinaryType() does not SetLastError() correctly. I attempted to reproduce this by:
executing it with the path of a file that does not exist
executing it with the path of a non-executable file
executing it with the path of a file that denies access
with no success (I called SetLastError(ERROR_PARTIAL_COPY); prior to each of the attempts): each of these attempts produced the expected result.
The code snippet is:
std::string full_exe_path =
a_impl->exe_installation_dir + "\\" + a_impl->exe_name;
DWORD bin_type;
if (FALSE == GetBinaryType(full_exe_path.c_str(), &bin_type))
{
throw Base_exception(
__LINE__,
__FILE__,
"Failed to get binary type for " + a_impl->exe_name);
// Optional argument here that defaults to GetLastError()
}
Does anyone know, or have any suggestions, as to the cause of this?
Note: this is happening on a machine that I do not have access to (and works on over 99% of the machines on which the Windows Service is running)
I can't test this right now so the following is a bit speculative :-(
It is really hard to be sure what is causing what you see - AFAIK you need to check the following possibilities:
Windows Service
In which user/context is the service running ?
Since Windows Vista MS has applied several changes to improve security that changed behaviour for example when accessing a network share from a Windows Service!
Bitness
ERROR_PARTIAL_COPY can happen esp. when the bitness of your application differs from the bitness of the file you are checking.
.NET files (EXE/DLL)
GetBinaryType() can behave strangely if the file you are checking happens to be a .NET file.
Virus scanner etc.
Any virus scanner etc. can interfer in strange ways with GetBinaryType().
rootkit infection and similar
This can give really some strange results since no rootkit is perfect...
virtual machine
IF the Windows Service is hosted inside a virtual machine I had several strange experiences with network access.
Another point you could check is whether the behaviour is the same when running this code from a "normal application" - this could give you a clue whether the "Windows Service/Network share" has anything to do with it.
Also check whether you can open the respective file (readonly, no locks) and what GetFileType() returns in that case.