How to load binary module - module

Next compiles well
-module(cipher_id).
-export([a1/1]).
a1(I) ->
binary:encode_unsigned(I).
But then i try to call cipher_id:a1(I) it crashes with
** exception error: undefined function binary:encode_unsigned/1
The same happened if try to call function from binary module in erl shell. m() outputs lists in which no binary module present.

From the Erlang documentation of the binary module:
The module is implemented according to the EEP (Erlang Enhancement Proposal) 31.
From the proposal page:
Status: Final/R14A Proposal is implemented in OTP release R14A
You're using R13B03. My feeling is that you need to upgrade to a newer Erlang installation. Binaries for Ubuntu are available at:
http://www.erlang-solutions.com/section/132/erlang-otp-packages

Related

(UndefinedFunctionError) function :ssl.cipher_suites/1 is undefined or private

I'm seeing this warning:
(UndefinedFunctionError) function :ssl.cipher_suites/0 is undefined or private
My application is crashing with this warning.
I recently upgraded Elixir and Erlang using asdf. How do I start my application now?
This Erlang page says:
Functions Deprecated in OTP 21
ssl:cipher_suites/0 (use cipher_suites/2,3 instead)
ssl:cipher_suites/1 (use cipher_suites/2,3 instead)
At the time of writing, the
I got it to work by changing the function call to:
:ssl.cipher_suites(:all, :"tlsv1.3")
Reference: Erlang manual for cipher_suites/23

When importing Nim module for Lua bindings, error shows: "could not load: lua(|5.1|5.0).dll"

I'm new to the Nim programming language, and coming from a Lua background, it excited me to find out that there is a module for adding Lua bindings to Nim.
I installed Nimble (Nim's package manager) for Windows and executed "nimble install lua" to download and install the correct module. Upon trying to import it and compile the source, this happened:
C:\Users\Ashley\Desktop\Stuff\Coding\Nim\Projects\LuaTest>nim c -r "C:\Users\Ashley\Desktop\Stuff\Coding\Nim\Projects\LuaTest\main.nim"
Hint: system [Processing]
Hint: main [Processing]
Hint: lua [Processing]
CC: main
CC: lua_lua
Hint: [Link]
Hint: operation successful (10698 lines compiled; 1.262 sec total; 16.163MB; Debug Build) [SuccessX]
could not load: lua(|5.1|5.0).dll
Error: execution of an external program failed: 'c:\users\ashley\desktop\stuff\coding\nim\projects\luatest\main.exe '
I have Lua 5.1 already installed with the proper entries in PATH. It's located in Program Files (x86). The directory contains a dll called lua5.1.dll. I tried looking up the error on Google, but there were no results that helped. What could be the problem?
On Windows you can put the library at the same place as the generated binary. In this case the file should be called lua.dll, lua5.1.dll or lua5.0.dll. Also make sure that the library and binary are both for the same system architecture, either x86 (32bit) or x86-64 (64bit).

Moonscript CLI launch error with Lua 5.3 on OSX

I'm on OS X 10.11.1 running the latest version of X Code. I installed Lua 5.3 today from source with no problem. Seems to work correctly. No errors installing luarocks and then using it to install moonscript. However, both moon and moonc give the following error when invoked from the command line:
$ moon
/usr/local/bin/lua: /usr/local/share/lua/5.3/alt_getopt.lua:24: attempt to call a nil value (global 'module')
stack traceback:
/usr/local/share/lua/5.3/alt_getopt.lua:24: in main chunk
[C]: in function 'require'
/usr/local/lib/luarocks/rocks/moonscript/0.4.0-1/bin/moon:2: in main chunk
[C]: in ?
Looking at alt_getopt.lua shows that it is indeed using the now-defunct 'module' keyword. The GitHub project for this module appears to be dead with no action in the past 3 years.
How should I proceed to get Moonscript working on my system?
Yes, as you noted, module has been deprecated for quite a while and was only working with earlier versions because of compatibility switches.
You can comment out the line 24 in alt-getopt and add the following line to the end of the alt-getopt.lua file: return {get_opts = get_opts, get_ordered_opts = get_ordered_opts}.
This should make this module Lua 5.2/5.3 compatible (I haven't checked if there are any other compatibility issues with using Lua 5.3 though).

cygwin: diff.exe: error while loading shared libraries: cygsigsegv-2.dll

I installed the latest cygwin x86-64. I added diffutils to get the basic diff(1) linux command. When I now run it, I get:
diff.exe: error while loading shared libraries: cygsigsegv-2.dll
I did a search for the dll here, but there are zero matches, not found.
I then re-ran the installer and did a search in the installer search box on this dll, and nothing came up.
Can you please advise?
cygsigsegv-2.dll is part of package libsigsegv2, which is required by
diffutils:
# diffutils
sdesc: "A GNU collection of diff utilities"
category: Utils
requires: cygwin libiconv2 libintl8 libsigsegv2
Installing that package should fix the problem.

What does this error mean in the Botan crypto library?

I'm using the c++ crypto library called Botan, and at arbitrary times I am getting the following error at runtime. What does it mean?
terminate called after throwing an instance of 'Botan::PRNG_Unseeded'
what(): Botan: PRNG not seeded: X9.31(AES-256)
I ran into the same error message, which was caused by missing any entropy source.
You can try to enable a entropy source when building Botan library or generating single source file.
For windows platform, add win32_stats module into option --enable-modules. For linux, use dev_random.
e.g. configure.py --enable-modules=win32_stats,...
Well it looks to me like you forgot to seed the PRNG (pseudo random number generator). Having failed to do so, the Botan library threw the aforementioned exception which seems to have caused the terminate function to be called.
The most likely answer is that you are using v 1.8.2 which had problems with its autoseeding routines. Upgrading to 1.8.4 or 1.8.5 has fixed this for everyone who had reported this problem up to now.