[24-11-2017]

Calling shell process from Groovy script

If you want to run shell script from Groovy, you can easily achieve that using either ProcessBuilder or execute methods. If you want to access environment variable (created inside Groovy) there are two ways: – create completely new environment – risky, you can forget some essential variables – create new environment based on parent’s one […]


[28-10-2017]

Fortran and GNU Make

Building binary file based on Fortran code that is organized in tree based source directories may be a struggle. Usually, you want to put all objects inside single directory while, at the same time, you would like to keep sources divided into some logical parts (based on source location and modules). Let’s say you have […]


[19-10-2017]

jshell and command line arguments

If you start your experience with jshell, you will notice that passing command line arguments to your script may be a struggle. Typically, you would expect something like this > jsell my_script.jsh arg1 ‘some other arg’ yet_another arg to be working such way, arguments are passed to your script. This is not the case here. […]


[05-10-2017]

R3.4 + OpenMPI 3.0.0 + Rmpi inside macOS – little bit of mess ;)

As usual, there are no easy solutions when it comes to R and mac ;) First of all, I suggest to get clean, isolated copy of OpenMPI so you can be sure that your installation has no issues with mixed libs. To do so, simply compile OpenMPI 3.0.0 # Get OpenMPI sources mkdir -p ~/opt/src […]


[15-09-2017]

C and controlling debug stuff (something, almost, like Log4j) ;)

In case you are not aware of the macros ;) I am sure you are aware, but, just in case :) int f(int a, int b) { #ifdef PROFILER BeginProfiling("f"); #endif … #ifdef PROFILER EndProfiling(); #endif } Then, you can control it by doing this // when you want to profile #define PROFILER // when […]


[15-09-2017]

Compiling Slatec on macOS

# SLATEC Common Mathematical Library, Version 4.1, July 1993 # a comprehensive software library containing over # 1400 general purpose mathematical and statistical routines # written in Fortran 77. If you want to install SLATEC, you need to make sure to install gfortran. Take a look here for a brief instructions, somewhere in the middle […]


[12-09-2017]

Jekyll on macOS

1. Install Ruby I prefer to install from sources: https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.gz > ./configure –prefix=$HOME/opt/ruby > make > make install 2. Install RubyGems I prefer to install from sources: https://rubygems.org/pages/download > export PATH=$HOME/opt/ruby/bin:$PATH > ruby setup.rb 3. Change repo location I compile Ruby without ssh support. I have to change the ruby gems repo > gem sources […]


[31-08-2017]

git, github and multiple users

Different solutions for working with github repos when you have multiple accounts If you have two user accounts at github: {user_a} and {user_b}. Sometimes, you may encounter issues while pushing changes back remote: Permission to {user}/{repo}.git denied to {user_a}. fatal: unable to access ‘https://github.com/{user}/{repo}.git/’: The requested URL returned error: 403 If you are using https, […]


[28-08-2017]

SVN and meld

> svn diff –diff-cmd=’meld’ file_you_have_changed.c


[28-08-2017]

SVN and multiline log comments

> svn commit -m"We tend to forget\ that multiline comments, in SVN, are supper easy.\ And, they can help to introduce multiple changes\ inside one commit. Like:\ – improvements,\ – bug fixes,\ – motivations behind the code." my_super_file.c


[23-08-2017]

Parameter Expansion – POSIX (bash)

+———————-+—————–+—————–+ | parameter | parameter | parameter | | Set and Not Null | Set But Null | Unset | +——————–+———————-+—————–+—————–+ | ${parameter:-word} | substitute parameter | substitute word | substitute word | +——————–+———————-+—————–+—————–+ | ${parameter-word} | substitute parameter | substitute null | substitute word | +——————–+———————-+—————–+—————–+ | ${parameter:=word} | substitute parameter | assign word […]


[10-08-2017]

R 3.4, rJava, macOS and even more mess ;)

So, you want to have rJava (e.g. rJava_0.9-8.tar.gz) inside your fresh, new installation of R 3.4 and you are running macOS. There are bad news and good news ;) Bad news. It will fail with default clang that comes with XCode. You need something better here, something with support for OpenMP. And you can get […]


[08-08-2017]

Retro Like (8bit) Terminal Game – playing for Fun and Profit :)

So, what do you think about playing retro style, terminal based, game where you can gain some real life experience as well. If you are interested, take a look below (click the image for the full experience – or click here for full screen size). I find Cathode to be supper fancy terminal emulator with […]


[02-08-2017]

How to share enum between C++ and Java ;)

Note! This is not actual suggestion for proceeding like this during development ;) It’s one of this “fake it till you make it” solutions. So, please, don’t try it at home! ;) There was this question at Stack Overflow. How to share enums. And you want to share them between C++ and Java. Well, there […]


[10-07-2017]

Running GDB in macOS sierra

At some point Apple dropped GNU based toolchain in favor of LLVM. However, sometimes you need these tools. One of such examples is debugging Fortran codes. lldb is not able to do it properly, yet. You can trace the execution of code, you can step over, but you can’t examine variables. In that case, you […]


[07-06-2017]

R, Java, rJava and macOS adventures

For updated info (for R3.4) take a look HERE. R, rJava, Java and macOS is a mess. In fact, Java itself is a mess when it comes to macOS. First of all, you can have different Java installations: Oracle based or system based. # this is the place where Java Framework resides /System/Library/Frameworks/JavaVM.framework # this […]


[05-06-2017]

There are daemons in Java ;)

Take a look here, for more details: recipe № 029


[25-05-2017]

JNI, Python and _Py_Zero that was not there

Recently, I had this issue with JNI code calling Python script using shared libraries provided by Python itself. The schema is quite easy to follow, and you can easily apply it inside C based code. // Initialize Python (can be done once – for a whole life of JVM) Py_Initialize(); // Remember to reserve PyGILState […]


[15-05-2017]

Remove redundant imports in Java file in CLI

cat MyClass.java | grep ^import | sort | uniq


[03-05-2017]

Multiple threads and JVM access from C code

In case you are looking for sample code related to JVM and accessing it from C (like this one): take a look here: recipe № 027.