Plotting graph in R with X11 window system using Cygwin

Submitted by Dickens A S on Tue, 09/07/2021 - 03:02

This article demonstrates how to show a simple graph with help X11 system available in Cygwin/X

1.) How to install X11 in Cygwin

Double click the setup and launch the list of software shown in the previous article

choose the below two softwares

xinit

xorg-server
 

Compete the installation 

2.) How to start the X11

Go to Start Menu

Click on "XWin Server"

Wait for 30 seconds

in your taskbar you will see two icons as below

Compile/Install GTK4 on Ubuntu Focal 20.04 or Bionic 18.04

Submitted by Dickens A S on Thu, 08/12/2021 - 12:36

This article explains how compile GTK4 on Lower LTS versions of Ubuntu

Compiling GTK4 on a older version of linux is very difficult and identifying the corresponding dependency libraries alos very difficult, unfortunately the online build tools only uses the long time table version likke bionic or focal

Therefore I have managed to get the sequence of install command to install all pre-requested libraries to make the GTK4 compile with best possible facilities without leaving any minor facility in GTK4.

Reading MIDI Port from Kotlin Native using rtmidi in Windows

Submitted by Dickens A S on Sun, 08/08/2021 - 01:48

This article demonstrates how a MIDI port can be read from Kotlin native code via rtmidi library

rtmidi_get_port_name

This C function/api offers identifying the port of the MIDI which needs to be monitored/watched

rtmidi_in_set_callback

This C function/api offers receiving the byte which is the key pressed in the MIDI keyboard or MIDI simulator, the message: CArrayPointer<UByteVar> parameter contains the numeric of the key pressed

Kotlin Code

Use MathGL to generate piano sound using OpenAL in Kolin

Submitted by Dickens A S on Sun, 08/01/2021 - 14:05

This article demonstrates how to use MathGL to generate a sine wave and modify it using a cosine envelope and transfer that data to the OpenAL

MathGL is a versatile matrix and array manipulation library, It can be used for stats, numerical methods, simulation, graphics, games etc., 

This article peculiarly uses it for creating an audio. Audio is simply a sequence by bytes sent an amplifier and a speaker. 

Therefore it can be generated using any numerical methodology and set in an array of bytes.

Below code explains how it is done.

Full Kotlin code

Combine / Call Fortran DLL inside Kotlin Native using Gradle KTS

Submitted by Dickens A S on Thu, 07/22/2021 - 10:54

Call Fortran from Kotlin Native

This article demonstrates how to change the toolchain name using Gradle KTS and invoke gfortran compiler instead of g++ compiler and produce a DLL and reuse a Fortran subroutine or function inside a Kotlin Native code

There is a sub project named libfort1 which has Gradle KTS file, it has been improved to trigger a different exe command line using Gradle Action APIs, which allows the developer to modify the executable as well as parameters sent to the executable

Launch Visual Studio Code From MSYS2

Submitted by Dickens A S on Wed, 07/21/2021 - 05:35

This article demonstrates How to launch vscode.exe with MSYS2

Download Visual Studio Code

download the .zip version of the VS Code from the below URL

https://code.visualstudio.com/download

Unzip the .zip into C:\msys64\opt\vscode

Launch VS Code

open 64 bit MINGW by running c:\msys64\mingw64.exe

check version of vs code by running 

$ /opt/vscode/bin/code --version
1.58.2
c3f126316369cd610563c75b1b1725e0679adfb3
x64

launch vs code be running 

Installing R inside MSYS2 using Miniconda in Windows

Submitted by Dickens A S on Tue, 07/20/2021 - 06:19

This article demonstrates how install R using Miniconda inside MSYS2 MINGW64 shell

Download and install Miniconda

Install miniconda iniside c:\msys64\opt\miniconda without adding to PATH

Set PATH environment variable permanently in MSYS2 .bashrc

Open c:\msys64\home\<username>\.bashrc and add scripts folder to the PATH

Example .bashrc

Kotlin JVM JNI C++ Inheritance and Callback using SWIG

Submitted by Dickens A S on Tue, 07/20/2021 - 03:59

This Article demonstrates how to Inherit class from C++ class and how to make C++ calls back the Kolin function using overriding

In case there is Java or Kotlin inheritance is used how a JNI function get a handle for that.

System.loadLibrary is used to load the JNI library in JVM.

Below code explains how the inherited function is invoked and a callback which is written in Java or kotlin is invoked from a C++ code.

The Gradle SWIG Task of cpplib

Kotlin JVM JNI using SWIG Arrays and Pointers

Submitted by Dickens A S on Mon, 07/19/2021 - 09:28

This Article demonstrates how to pass pointers and arrays in and out using pure C code and JNI and force pure C code in Gradle

The Gradle SWIG Task of cpplib

val swigTask: Exec by tasks.creating(Exec::class) {
	commandLine (
		"swig",
		"-java",
		"-cppext",
		"c",
		"-addextern",
		"-module",
		"${project.name}",
		"src\\main\\swig\\${project.name}.i"
	)
}

The Gradle C Compiler Arguments (-lc -x c -std=gnu99) forces the g++ to use gcc compiler as pure C compiler