Fiddle is an extension to translate a foreign function interface (FFI) with ruby.
Questions tagged [fiddle]
52 questions
1
vote
0 answers
ChartJS - how to config Scales?
I am creating a website about Bitcoins and using some interactive Charts from ChartJS.
Until now the scales in the Charts are changing with the data. But I think to compare the differencesbetween the years I would like them to not change and stay…

Kaja S.
- 37
- 4
1
vote
1 answer
How to copy an instance of the Ruby Fiddle struct?
It's not obvious how to copy an instance of the Fiddle struct. I found an ugly solution using the Fiddle::Pointer like this.
require 'fiddle/import'
X = Fiddle::Importer.struct [
'int a',
'int b',
]
x = X.malloc
x.a = 1
x.b = 2
x2 =…

relent95
- 3,703
- 1
- 14
- 17
1
vote
1 answer
What is the "struct" in the documentation of Ruby Fiddle?
I had used Ruby 1.9 long ago and now I am trying Ruby 3.2 Fiddle. I tried the following snippet in the README.md, but it raised a NameError on the struct.
StudentCollegeDetail = struct [
'int college_id',
'char college_name[50]'
]
How can I use…

relent95
- 3,703
- 1
- 14
- 17
1
vote
0 answers
How do I allocate a buffer with Ruby's Fiddle for use with Win32 functions such as SendMessage?
The function signature for SendMessageW as per MSDN:
LRESULT SendMessageW(
[in] HWND hWnd,
[in] UINT Msg,
[in] WPARAM wParam,
[in] LPARAM lParam
);
I wish to get the text in a window title/caption using the WM_GETTEXT Msg.
The problem I…

Usernamed
- 41
- 5
1
vote
2 answers
Is there a way to change the working directory of fiddle?
I'm trying to load a C shared library within Ruby using Fiddle.
Here is a minimal example:
require 'fiddle'
require 'fiddle/import'
module Era
extend Fiddle::Importer
dlload './ServerApi.so'
extern 'int era_init_lib()'
extern 'void…

3limin4t0r
- 19,353
- 2
- 31
- 52
1
vote
3 answers
How can I get a space to take up space?
I need a paragraph with a space to take up space.
This fiddle shows that a space renders just the same as nothing at all:
1
2
4
How can I achieve this effect?user11623835
1
vote
1 answer
Unable to Get this fiddle in page
I am trying to make this fiddle work on web page without success. I have done this before but this fiddle is not working.
I tried to add google's jquery or min jquery, without success. I also tried to add javascript code after div instead of in…

user6601842
- 27
- 6
1
vote
4 answers
Plus/Minus Max Value Input
I have a plus/minus button and would like it so that users cannot select over 20 but do not know how to get it working. I tried using the min="1" max="5 attributes but they did not work. Here is my code and a link to a fiddle.…

sizemattic
- 139
- 1
- 7
- 17
1
vote
1 answer
Ruby Fiddle and Global Interpreter Lock (GIL)
I am using Fiddle to call an external C Function for some heavy linear algebra calculations (Mac OSX).
The module definition looks like
module BLAS
extend Fiddle::Importer
dlload $BLAS_PATH
extern 'void cblas_dgemm(int, int, int, int,…

Rojj
- 1,170
- 1
- 12
- 32
1
vote
0 answers
Ruby Fiddle - Pass array to C function
I am trying to pass an array to a C function using Fiddle (2.0.0-p247). This is my ruby script
require 'fiddle'
clib = Fiddle.dlopen('sum_array')
f = Fiddle::Function.new(clib['sum_array'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT], …

Rojj
- 1,170
- 1
- 12
- 32
1
vote
1 answer
How to keep HTTPS traffic really secured where Fiddler is allowed?
I know how Fiddler can decrypt HTTPS traffic by using Man-In-The-Middle approach. I understand the trusting Fiddler's root certificate comes with the risk and one should trust it responsibly by understanding its implications. However, it leaves you…

Learner
- 4,661
- 9
- 56
- 102
1
vote
1 answer
Ruby copy to clipboard with Fiddle
I am trying to copy a string to the clipboard with the Fiddle module,but this code fails.
require'fiddle';
user32 = Fiddle.dlopen 'USER32.dll';
$openClipboard =…

Redouane Red
- 509
- 1
- 5
- 13
1
vote
1 answer
How to add custom attributes to head tag in js Fiddle?
After the recent uplift of js Fiddle, where can we include custom attributes(like ng-app) to head tag in JS Fiddle HTML?

sudheeshcm
- 3,310
- 4
- 14
- 21
0
votes
1 answer
Space-Shooter game - bullet does't move anymore when I hit the object
I am lerning to code in javaScript and for that I am coding a space Shooter game. I came until level 2 so far but now I am having a problem which I can't fix by myself because I am not seeing the problem.
In level 2 I create some ufos which can…

Kaja S.
- 37
- 4
0
votes
0 answers
How can I pass a FILE * to stdin/stdout to a C function via Ruby's Fiddle?
I'm trying to interface with an ncurses library (Thomas Dickey's dialog to be precise) using Fiddle and I need to pass FILE pointers for stdin and stdout to the library, but everything I try results in a segfault. Here is an example of one thing I…

Joe McDonagh
- 163
- 6