Skip to content
Advertisement

Tag: c++

Why do we need to check null pointer in C++, but not in Java?

Supposed that, I have a class named of RequestType. In Java, code tends not to have any check for a new object being a null reference: But C++ code tends to check the allocation: Why do we need to check whether requestType is nullptr in C++, but can just use it without such a check in Java? Answer Your premise

Convert Long to DateTime from C# Date to Java Date

I’ve been trying to read the binary file with Java, and the binary file is written in C#. And some of those data is contain a DateTime data. When DateTime data will be written into the file (in binary), it using DateTime.ToBinary(); on C#. For reading the DateTime data, it will convert first from bytes into long data, using BitConverter.ToInt64(byte[],

CMake could not find JNI

I created a new Android Studio Project with C++ support and did not add anything to it. The project builds, compiles and runs with CMake. I then added the following two lines of code to CMakeLists.txt at the bottom of the file and I get a CMake build error. And this is the error I get when building the project

Need to reference and use a C# dll in Java

I need to reference a .Net dll in java. I have used jni4net libraries for the same. I have followed the steps mentioned in the video below : https://www.youtube.com/watch?time_continue=351&v=8OoSK_RWUe4 I have followed all the steps required to reference jni4net libraries but i get the following runtime Exception: After following all the steps, This is my code: I have tried executing

What is C++ version of Java’s cyclic barrier?

In java, multiple threads can wait all others at a certain point so that they don’t start a new block of codes before all others finish first block: is there an exact or easy convertion to C++? Also with OpenCL, there is a similar instruction: so all neighbor threads wait each other but it is only a constrained C implementation.

What is the equivalent of hashing Java code into C#?

I have a strange problem in getting equivalent hash code from C# code translated into Java. I don’t know, what MessageDigest update method do. It should only update the contents of digest and should compute hash after calling digest. Same thing I am doing in C# with SHAManaged512.ComputeHash(content). But I am not getting same hash code. Following is the Java

Grpc.Core.RpcException method is unimplemented with C# client and Java Server

I am having trouble finding the source of this error. I implemented a simple service using protobuf: When using a java client everything works fine, the server receives the request and responds appropriately. When using C# with the same .proto file for generating sources at the client.Login() I get the following errror: Grpc.Core.RpcException Status(StatusCode=Unimplemented, Detail=”Method tourism.RemoteService/Login is unimplemented”). The server

Use custom Manifest file and permission in Unity?

Im currently trying to program a little game for android with Unity3D. Because I want a visible status bar, I modified the AndroidManifest in the Project Folder (C:UsersPublicDocumentsUnity ProjectsProjectNameTempStagingArea) like this : But everytime i generate the APK, unity changes the Android Manifest to this : Unity3D does change my modified Manifests everytime? Answer You are modifying the wrong AndroidManifest

Mutex Locks vs Peterson’s Algorithm?

Do mutex locks ensure bounded waiting condition ? Is it possible if two threads are trying to get hold of a lock, but only one process (just by luck) gets it again and again. Since Peterson’s Algorithm ensures bounded waiting, is it better to use that instead of mutex locks ? Answer It is possible to have unbounded wait with

Advertisement