3,776 questions
0
votes
1
answer
16
views
what is subclass tf.keras.layers.Layer instead of using a Lambda in this code?
An example of replacing a lambda with a subclass in code is as follows:
scale = tf.Variable(1.)
scale_layer = tf.keras.layers.Lambda(lambda x: x * scale)
Because scale_layer does not directly track ...
0
votes
0
answers
47
views
How can I use dict in response_schemas using Gemini API?
I'm attempting to enforce a schema on a prompt response from Gemini. As made clear is supported in the 'structured output' docs.
For important implementation reasons, my schema contains dictionaries ...
0
votes
0
answers
34
views
Jaxb Java: Ordering list of string
Is there a way to "force" the marshaller to respect the order of the elements inside the XmlElementsRefs annotation applied to a list of objects?
I have a Java Class which has an attribute ...
3
votes
1
answer
129
views
Spring SOAP request marshalling ~ How to force inlining of long data (JAXB2 & MTOM)
I have the following issue: I need to talk to an old SOAP service, and that one requires me to send a request object where a large amount of data is directly in the SOAP message body, like so:
<...
0
votes
1
answer
28
views
Serialize a java enum with multiple values
Here is a simplified version of the actual problem.
I have an enum with each entry having multiple properties
enum MyEntries{
ENTRY1("1","property1"),
ENTRY2("2",...
0
votes
0
answers
21
views
Mix jaxb and xml transformer with MarshallingWebServiceInboundGateway?
I have soap web service with 2 operations. Each operation use a Request and Response wrapper elements with xml data inside. The data in Response2 is the more complex.
With Spring Integration WS, I ...
0
votes
1
answer
90
views
Ruby socket data transfer issue
I am developing a client server architecture in a ruby project where the client sends some data to the server , but when the server receives it, its size is much smaller.
The client has the following ...
-1
votes
2
answers
81
views
marshall unmanaged structure to C#
how can I translate this unmanaged structure into c#.
typedef struct _EC_VARIANT {
union {
BOOL BooleanVal;
UINT32 UInt32Val;
...
1
vote
1
answer
90
views
Go how to only marshal a slice if its not nil. Json showing null for for nil slice
I have a struct in Golang which a slice of my alias type:
type Foo struct {
NextSet []House `json:"next_set"`
}
I want to marshal this into a json. When I do not initialise ...
-3
votes
1
answer
85
views
How to use one or another variable to json marshal with same json tag
Supose I have the structure:
type foo struct {
Name string `json:"name"`
AgeYears int `json:"age" rlp:"optional"`
AgeTimestamp time....
1
vote
2
answers
100
views
Can the Garbage Collector move a struct during a call?
I'm implementing a stack based vector type like this:
[StructLayout(LayoutKind.Sequential)]
public struct VectorI16x8 {
public short s0, s1, s2, s3, s4, s5, s6, s7;
public ...
0
votes
0
answers
127
views
NullPointer in org.glassfish.hk2.osgiresourcelocator.ServiceLoader during marshalling SOAP message
I am working on some SOAP call in a java application, and unfortunately I saw a very nasty issue and I have no idea how to solve it.
The stacktrace of the NullPointerException is the following:
ava....
-1
votes
1
answer
338
views
C# LibraryImport string output parameter marshalling
I have a native function that will write a string to a buffer provided in the call along with its size. Let's call it GetFooString(LPStr str, int strLen).
I found out so far that with DllImport the ...
3
votes
1
answer
186
views
.NET P/Invoke marshalling with spans instead of managed arrays
I have the following unmanaged function I need to call from C#:
TLINError __stdcall LIN_GetAvailableHardware(
HLINHW *pBuff,
WORD wBuffSize,
int *pCount
);
The library provides ...
1
vote
1
answer
44
views
How to serialize a list of Java Object to XML using javax.xml library with proper parent/child node names
I have a list called Documents that is comprised of different Document objects I created. I am trying to serialize the list to look like this:
<Documents>
<Document>
.
.
.
&...
1
vote
1
answer
233
views
Go JSON differentiating zero values vs null vs undefined
I know Go JSON issues are a-dime-a-dozen; the existing stdlib JSON package is clunky. There is ongoing discussion about a v2. Until then, I'm hoping someone can lend some inspiration here on how to ...
0
votes
0
answers
44
views
While converting json to pdf unicode characters are replaced
In my API I am getting JSON response from one API, I have to convert it to a PDF and send it.
But while marshalling characters like <, >, & .. are replaced by \u300e,...
Also " within ...
1
vote
0
answers
28
views
C# Source Generator Native Marshaling - Use Type Defined in Another Assembly?
We're currently modernizing our native interop implementations for marshaling data between C# and mainly C++ using source generators together with MarshalUsing attributes and CustomMarshallers, etc.
A ...
0
votes
1
answer
157
views
Optimizing json.Marshal in Go
I have a service that needs to marshal large JSONs (~50KB length).
In the beginning, I used map[string]interface{} and encoded it but it consumed a lot of CPU. Then I tried to map the JSON into ...
0
votes
0
answers
21
views
Change namespace with Jaxb2Marshaller
In my config spring boot have this:
@Bean
public Jaxb2Marshaller jaxb2Marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setPackagesToScan("com....
0
votes
1
answer
79
views
contextPath is not allowed to appear in element oxm:jaxb2-marshaller, when upgrading to Spring Framework 5
Background
Upgrading from Spring Framework 4.3.30.RELEASE to 5.0.20.RELEASE
Using oxm:jaxb2-marshaller
Problem
After upgrading the Spring Framework dependency version, the application fails to start ...
0
votes
0
answers
45
views
How to add only the namespaces that are used in the XML to the generated XML using the JAXB/Jakarta Marshaller?
How to ensure the Jakarta/JAXB marshaller adds only the namespaces that have been used in the provided Object which needs to be marshalled? and skip the unwanted namespaces from the generated XML even ...
1
vote
1
answer
95
views
Issue assigning string struct members by Marshal.PtrToStructure from a long string
I need to efficiently parse a fixed size, delimited message in VisualBasic WinForms application (.NET framework 4.6.2, VS20222). For a test, I built a small console app(.NET 8). The structure:
<...
1
vote
2
answers
103
views
JS Object Standard Prototype as a Symbols
Looks like it is not really feasible or very tricky still I'll take a try.
Say we have a config data of a fluent structure for user to provide.
E.g.
configRoot:
fluentSubSection:
someProp: 12
...
3
votes
1
answer
62
views
Nested Custom Unmarshalling
I need to implement a custom unmarshal logic (to VerifyingKey field) depending on a variable in a field value in upper levels (Type field). I can exemplify the situation as below (originating from ...
0
votes
0
answers
40
views
How can I make sure that unused bytes in a struct are zeroed out?
I have this structure:
[StructLayout(LayoutKind.Explicit, Size=56)]
public struct SaveDataDialogNewItem {
[FieldOffset(8)]
public IntPtr iconBuf;
[FieldOffset(16)]
public ulong ...
-1
votes
1
answer
157
views
How to marshal a struct with a nested array of structs when using P/Invoke C#
I have the following C function declaration which I would like to call from C# (Note I cannot access the source code of the dll):
int setData(OuterStruct *data);
And the relevant structs for this C ...
0
votes
1
answer
91
views
LibraryImport causes Marshal.GetLastWin32Error() to always return 0
When converting
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool QueryServiceStatusEx(SafeHandle hService, int infoLevel, IntPtr lpBuffer, uint cbBufSize, out ...
0
votes
1
answer
49
views
Fixed size byte array with fixed offset inside manually marshalled struct throws runtime exception?
Target is to have the following struct working in C# (.net 8.0)
[StructLayout(LayoutKind.Explicit, Size = 257, Pack = 1)]
public struct MyFrame
{
[FieldOffset(0)] public byte valueA;
...
1
vote
0
answers
110
views
How to send a WM_IME_REQUEST message from C#
I'm working on an IME tool. To figure out the caret position of the foreground window, I'm supposed to use SendMessage() to send a WM_IME_REQUEST (0x0288) message, along with the parameters:
wParam: ...
0
votes
0
answers
92
views
How can I use apache camel bindy to convert java pojo to fixed length string that has a list attribute?
I have a java pojo class as the following?
@FixedLengthRecord
public class Request {
@DataField(pos = 1, length = 15)
private String string1;
@DataField(pos = 16, length = 8)
private ...
0
votes
0
answers
148
views
.NET Core and Marshaling on Linux
I got third-party native C library.so in my .NET Core 3.1 application under linux os (debian).
There was identical library.dll under Windows with .NET SDK for it.
The Windows and linux C-libraries ...
1
vote
1
answer
187
views
Marshaling gives error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt"
I need to use C library for working with NetCDF file format in my C# project. To receive some portion of informtaion from NetCDF file, i need to use methods nc_open to open CDF file, nc_inq_att to get ...
0
votes
1
answer
317
views
JAXBException: Property appears in @XmlType.propOrder, but no such property exists
I have a save command that does simple marshalling:
//save command
...
try {
JAXBContext context = JAXBContext.newInstance(CollectionManager.class);
...
1
vote
0
answers
39
views
JAXBContext Unmarshaller Marshaller
When i am doing unmarshalling and marshaling for xml file that have different name spaces i want explicitly apply name space type to each child.
Original document:
<?xml version="1.0" ...
0
votes
0
answers
33
views
Casting each char from span vs MemoryMarshal.Cast<byte, char> [duplicate]
When debugging an operation with UTF8 strings, sometimes I want to see the string representation from a given ReadOnlySpan<byte> so i created a static function to help me achieve it, but, one of ...
0
votes
0
answers
59
views
MarshalDirectiveException in Unity when marshalling int[] to SafeArray
Marshalling int[] to SafeArray seems to behave differently in Unity and in a standalone .NET application.
I have a COM dll that defines an interface
[ComImport]
public interface Calibration
{
[...
0
votes
0
answers
53
views
Connect to Running Program via COM - Marshal.GetIUnknownForObject
I am using a software package that offers an "extension" package, largely undocumented, that allows for creation of extensions that allow automation within the program. It's a COM interface ...
-2
votes
1
answer
353
views
P/Invoke System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt
My code is raising an exception. I am using P/Invoke to call some C API from a .NET project.
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication ...
-1
votes
1
answer
88
views
Proper way to marshal char* to string using C# interoperability. Get "a heap has been corrupted" exception
not a lot of experience in C++. Attempting to Marshal char* in C to string in C#, using [MarshalAs(UnmanagedType.LPStr)], but I get a "a heap has been corrupted" exception. It does however ...
0
votes
0
answers
226
views
Marshalling structure with array of structure in C# .NET 7.0
I am trying to read structures from a TwinCAT3 Beckhoff PLC with C# via ADS.
This works fine. But when the structures become more complex, the marshalled values are not correct. The values are ...
1
vote
0
answers
65
views
Marshalling double pointers in C#
I have to interact with a provided C library where one of the functions is declared as follows:
int GetFileList(struct spiflash_file **ptr_spiflash_filelist, int **file_num);
where **...
-2
votes
1
answer
61
views
How to marshal raw text into JSON? [duplicate]
This is the content of the text file:
"{\"tpl\":\"key = ${key}\\nkey1 = ${key1}\",\"metadata\":[{\"key\":\"key\"},{\"key\":\"key1\&...
2
votes
0
answers
37
views
Release Build UWP C# Struct One Byte Larger than Debug
I have a class hierarchy consisting of an abstract base class with a few helper methods and no fields, and a handful of derived classes with a variety of fields. Here is MCRE code describing the ...
0
votes
0
answers
130
views
Why does using a custom MarshalJSON method on pointer receiver work when passing []T with and without address-of operator?
I would love to understands why the following sample code for passing both books and &books yields the result of the custom MarshalJSON() method defined on the pointer receiver *Book. I do ...
2
votes
1
answer
93
views
Why does C# consider this unmanaged struct to have an an overlap
I've defined a struct for an externally defined data-packet as follows:
[StructLayout(LayoutKind.Explicit, Size=18, Pack=1, CharSet=CharSet.Ansi)]
struct FlexTransmission
{
[FieldOffset(0), ...
0
votes
0
answers
175
views
C# reading memory allocated with AllocHGlobal with Span<T> instead of PtrToStructure?
I am not sure if this is even possible, but reading a lot about Span and started to play with BenchmarkDotNet and came to find out that my method is wasting a lot of memory of the heap.
I have to ...
0
votes
0
answers
15
views
Kafka producer partial serialization
I have this dto.
@Data
public class ProductDto implements Serializable {
private Long id;
private String name;
private String title;
private String price;
private String quantity;
...
0
votes
0
answers
107
views
infinispan - encoding type - not showing items
running keycloak + infinispan standalone well.
problem: when using infinispan Server management Console,
data container doesn't show real items.
wheng checkin sessions tab. --> empty
page show ...
3
votes
0
answers
63
views
Is there a way in .Net Framwork to reference an object cross AppDomains without Serialization?
I am developing an addon to a commercial software which has an object that I have no control with it. By "no control with it", I mean I can't access its source code and make it serializable....