ACR1222L and Ruby smartcard gem - ruby

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).

Related

odoo.sh ver. 14 WKHTMLTOPDF 0.12.25: Unable to call host printing service (HTTPError). How to circumvent this?

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.

encoding error while running Sinatra

I have my Sinatra-Redis Blog which had ran pretty well on my computer before I uploaded it on server. But I got the error that saying when I am running it on my server
"Encoding::CompatibilityError - incompatible character encodings: US-ASCII and UTF-8"
I found there are some answer like putting "#encoding:UTF-8" ahead my code, it doesn't work for me
I've tried to put ".force_encoding("utf-8")" after the values in my erb file, it works, but I don't think this is the only way to solve the problem, because I don't want to put ".force_encoding("utf-8")" after all my values.
Ruby version: 2.3.1
redis version:3.0.7
and I am using erb as my templating system.
Thanks in advance!
I have encounter this problem many times. It runs pretty well on my localhost (MacOS) and found to have problem on the server(Debian). It is possibly because your server is using a different encoding setting.
You may want to change the encoding and restart your server.
Reference:
https://www.linuxquestions.org/questions/linux-newbie-8/how-to-change-the-default-encoding-203988/

Using maketorrent in libtorrent examples

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.

Error when attempting to call a remote method in DBus

I am trying to invoke a remote method using
dbus_g_proxy_call(proxy,"myFunc",&error,G_TYPE_INVALID,G_TYPE_INVALID);
but when I try this I get an error message saying "Method "myFunc" with signature "" on interface "com.myinterface.dbus" doesn't exist". What am I doing wrong in this? myFunc is of type void and no input parameters to it.
This error means that the server does not have a method with this name/signature combination at the path that your proxy is set up to use.
This can happen for a number of reasons, it may have crashed or just not be running for some other reason, or it may not have registered the function correctly.
Alternatively, you may not be using the correct path when creating your proxy, or your server may be registering the method at the wrong path.
Without seeing more of your code, it is hard to say what your problem is.
Introspecting the objects, interfaces and methods actually exported by your service using a tool like D-Feet would probably help here.

GetBinaryType() fails with a last error of ERROR_PARTIAL_COPY

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.

Resources