sane

Using Python's ctypes to pass/read a parameter declared as "struct_name *** param_name"?

I am trying to use Python's ctypes library to access some methods in the scanning library SANE. This is my first experience with ctypes and the first time I have had to deal with C datatypes in over a year so there is a fair learning curve here, but I think even without that this particular declaration would be troublesome: extern SANE...

SANE + Python, missing device after close statement

I'm having a trouble using SANE on Python to scan an image on a Kodak scanner. The real headache comes to when I close the scanner device after getting the image, it just disappears from the SANE Devices lists until I restarted the Python interpreter, making impossible to scan another image. It just acts like that with this scanner, I'...

prepopulate MVC Models with IOC - an alternative to caching?

Hello, I'm considering strategies for a simple-minded CMS implementation for an ASP.NET MVC site. The simple-minded part is that I've abstracted the values used in various partial views, all of which are user controls that share identical CSS layouts. So I'm populating the custom values in the identical partial views from the database ...

Manipulating the address of a variable to store a smaller type?

This is what I get for pampering myself with high-level programming languages. I have a function which writes a 32-bit value to a buffer, and a uint64_t on the stack. Is the following code a sane way to store it? uint64_t size = 0; // ... getBytes((uint32_t*)&size+0x1); I'm assuming that this would be the canonical, safe style: ui...

JNA calling a function which takes a pointer to a pointer to an array

I am trying to call the C function sane_get_devices from Java using JNA SANE_Status sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only); Where SANE_Status is an int and SANE_Device is a structure. typedef struct { SANE_String_Const name; /* unique device name */ SANE_String_Const vendor; /* device vend...