Netbeans: “not all requested modules can be enabled”

If you have installed Oracle Java 8 via default installers and you get the awkward message “not all requested modules can be enabled” in your Linux box when trying to create a new project in Netbeans you should configure netbeans to use the proper JDK.

To find the path of the installed JDKs you can type:

$ update-java-alternatives -l

A sample output would be:

java-7-oracle 1078 /usr/lib/jvm/java-7-oracle
java-8-oracle 1081 /usr/lib/jvm/java-8-oracle

What you have to do is locate the file netbeans.conf and set the netbeans_jdkhome variable to one of the paths displayed above.

The easiest way to find netbeans.conf is to run the following command:

find / -name netbeans.conf 2> /dev/null

This may take a while since it will search the whole disk.

You could also look at the following standard directories:

  • /home/netbeans-X.Y/etc/netbeans.conf
  • /usr/local/netbeans-X.Y/etc/netbeans.conf

After you have found netbeans.conf, you perform the following steps:

  1. open netbeans.conf with any text editor you like
    1. set netbeans_jdkhome variable to point to the proper location, eg:
netbeans_jdkhome="/usr/lib/jvm/java-8-oracle"

 

 

References:

https://askubuntu.com/questions/750514/netbeans-not-all-requested-modules-can-be-enabled

 

C++ Data models

A usual headache to C++ beginners: What is the value of sizeof(int) in C/C++?

The answer is: there is no specific answer.

In theory, the C++ standard does not define explicitly the size of primitive data types but it does define their minimum size. You can read more about it at official C++ reference page

In practice though, there are 4 data models that are mostly used : LP32, ILP32, LLP64 and LP64. Both Windows and Linux 32 architectures use ILP32. Windows 64bit use LP64 and Linux 64bit use LLP 64.

If you compare the values, you will see that sizes of all floating point data types are the same regardless of architecture (float 4, double 8, long double 16) and all integer data types are the same apart from long (char 1, short 2, int 4, long long 8). Of course pointers depend on the architecture (32bit in x86 and 64 bit in AMD64)

Here is a handy table for you.

datamodels

 

 

Doom 3 in modern computers

In this post I explained in summary what you have to do to run Doom 1 & 2 in your modern PC. Doom 3 is a totally different story.

The reason is that ID released two games named Doom 3 which are considered totaly different by hardcore gamers:

  1. Doom3 (vanilla version). This version was released on 2004 and it is considered an old game. Doom3 vanilla version was designed as a thriller.
  2. Doom3 BFG, released on 2012. Doom 3 BFG was designed as a shoot em up.
Continue reading Doom 3 in modern computers

Frequently used Unicode math operators

This is a selection of the operators i use frequently while taking notes. You can find a detailed table on wikipedia.

You can find ways to type the symbols here and a complete PDF for math operators here

Predicate logic
existential quantification U+2203 U+2204
universal quantification U+2200
logical conjunction
logical disjunction
U+2227
U+2228

material implication
implication
U+21D2
U+2192

material equivalence U+21D4
 negation  U+00AC  ¬
entails
provable from
U+22A8
U+22A2

sets

proper subset U+2282
U+2283

U+2284
U+2285

subset U+2286
U+2287

U+2288
U+2289

element of U+2208
U+220B

U+2209
U+220C

 empty set U+2205  ∅
intersection
union
U+22C2
U+22C3

cross product U+2a2f

Here are some Copy-Q tabs to use:

  1. With set operators here
  2. With logic operators here

Render 2d points with gnuplot to PNG

One of the easiest way to render some points with gnuplot is:

  1. write to file (eg points.txt) the points you want to render in simple text format, one line per point (x,y pairs, no tabs no commas etc)
  2. create a script with the code shown below (eg graph.gnuplot)
  3. run the script with gnuplot (eg gnuplot graph.gnuplot)
  4. Open the png file with a program of your choice.

point file sample:

10 10
20 20
30 30


script sample

set terminal png
set size ratio -1
set output "./graph.png"
plot \
"points1.txt" notitle with points pointsize 0.5 linecolor rgb "green",\
"points2.txt" notitle with points pointsize 0.5 linecolor rgb "yellow",\
"points3.txt" notitle with points pointsize 0.5 linecolor rgb "black"


execution example:

gnuplot graph.gnuplot

Terminal PNG not found in gnuplot

In some linux destributions, the default version of gnuplot does not always include PNG support.

Here it the easiest way to fix this:

  1. Download gnuplot from https://sourceforge.net/projects/gnuplot/
  2. Untar to a directory of your choice
  3. Open terminal at that directory
  4. Run the following commands:
    1. sudo apt-get install libgd2-dev
    2. ./configure
    3. make
    4. make check
    5. sudo make install

That’s it.

You can find code examples for PNG terminal here:

http://gnuplot.sourceforge.net/demo_5.0/

You can read more gnuplot terminals here:

http://www.gnuplotting.org/output-terminals/