Quick fix for netbeans update fail

If you are stuck with an old Java distribution (< 8) , you might see Netbeans fail when it tries to connect to its repositories with this message:

Unable to connect to the Certified Plugins because of Received fatal alert: protocol_version

This is happening because before Java 8 the default version for TLS is 1.0 and the repo server is expecting TLS 1.2

Fortunately, since Java 1.6 r1.1.1 you can use the TLS newer version; just look for the Netbeans launch script (mine is /opt/netbeans/bin/netbeans) and edit the last paragraph:

[...]
eval launchNbexec \
   --jdkhome '"$netbeans_jdkhome"' \
   --branding nb \
  --clusters '"$netbeans_clusters"' \
  -J-Dnetbeans.importclass=org.netbeans.upgrade.AutoUpgrade \
  -J-Dnetbeans.accept_license_class=org.netbeans.license.AcceptLicense \
  -J-Dhttps.protocols=TLSv1.2 \ ${netbeans_default_options} \
  '"$@"'
;;
esac
Publicado en english, GNU / linux | Deja un comentario

Compile / install 4.3.2 nodejs

I had some trouble recently trying to compile nodejs under Slackware 14 and I would like to share some notes about it,  just in case someone gets stuck in the same situation.

First of all: there is a precompiled package that should work, so why all the hassle?

Well, I like to compile my own packages. I use Slackware, we don’t have a package manager, we should be able to compile our software ourselves.

Second: slackbuilds can help you

slackbuilds.org has a build script for nodejs 4.2.4 If you are familiar with Slackware, for sure you know what to do with it. But there are three small problems;

  • I want nodejs 4.3.2 and the script is for 4.2.4
  • I am using Slackware 14, not 14.1
  • nodejs wont compile, any version of it

So, I download the script and the 4.3.2 sources, take a peek to nodejs.slackbuild and modified it to compile the new version:

VERSION=${VERSION:-v4.3.2} #4.2.4

Let’s try it, it’s just a minor version change, it probably works… errr… no. During config, a message alerts that

WARNING: C++ compiler too old, need g++ 4.8 or clang++ 3.4 (CXX=g++)

Damn, Slackware 14 g++ is 4.7.1 !!  I don’t want to update gcc! It is A LOT of trouble! What if I just …

Third: use an alternative version of gcc / g++

Hmm… so install a newer version, tell configure and make that we want to compile using it… that can’t be so difficult.

I will install gcc and g++ from the oficial distro repos. Yes, I know what I said about «compiling my own software», but NO, I am not compiling gcc. In the distro I trust.

So, get them from here and here and

# mkdir /opt/gcc
# installpkg --root /opt/gcc ./gcc-4.8.2-i486-1.txz
# installpkg --root /opt/gcc ./gcc-g++-4.8.2-i486-1.txz

Now just tell the script to use it.  Let’s add at the beggining of nodejs.slackbuild

PATH=/opt/gcc/usr/bin:$PATH
export PATH=/opt/gcc/usr/lib/gcc/i486-slackware-linux/4.8.2:$PATH
export CC=/opt/gcc/usr/bin/cc
export CXX=/opt/gcc/usr/bin/g++

This must work now… and… and… NO!

Fourth: assembler error???

Compiling fails saying

{entrada estándar}: Mensajes del ensamblador:
{entrada estándar}:32423: Error: se espera una instrucción de cadena después de `rep'
make[1]: *** [/tmp/MKp/node-v4.3.2/out/Release/obj.target/v8_base/deps/v8/src/api.o] Error 1

After some thinking and testing, I finally realize that the «-march=xxx -mtune=xxx»  options are to blame. How? well, I just tried to compile the source without the build script, and suddenly I realized that what g++ was saying that there was something rotten when translating to assembler if I tried the default slackbuild options, but everything was fabulous when saying just «./.configure;make»

So, I add a new line to the build script, just under the $SLKCFLAGS assignment to override it

SLKCFLAGS="-O2 -pipe"

And… HEY, KNOW WHAT? IT WORKS!

Final thoughts

So, after some wrestling with the bloody nodejs, looks like it doesn’t like how my computer is arch-tuning it… I don’t know if mine is the only case, but for sure this took me some time to solve, so here it is for your compiling pleasure.

Next, I think I will dig into Slackware’s installpkg script, as I can’t find the new gcc/g++ listed under /var/log/packages and I don’t know why…

Publicado en GNU / linux | Deja un comentario

Voronoi / Delaunay GIMP plugin

This plugin will render Voronoi and Delaunay diagrams from a list of random points (sites). It uses Fortune’s algorithm (see libvoronoi.py) which is pretty fast; oddly enough, the slowest by far task in this plugin is the pdb.gimp_paintbrush_default part. Maybe I am doing something wrong…

gimp_voronoi_plugin_dialog

Anyway, try a small number of sites first, and be sure to select a small brush (1 pixel is great) or the diagram will be a blob.


gimp_voronoi_plugin_both gimp_voronoi_plugin_delaunaygimp_voronoi_plugin_voronoi


Extract the plugin to your ~/.gimpX.X/plug-ins folder under Linux or equivalent under Windows. The file py_tesselate.py must be executable.

You will find the plugin under Filters/Render/Tesselate

tesselate_0.1.tar.gz

Publicado en gimp | Deja un comentario

Gimp plugin for BPG

The BPG image format, developed by Fabrice Bellard, is a good alternative to the ubiquitous but very old JPEG. Using the HEVC encoding/compression algorithm, it can store images with a better quality per byte than jpeg, webp or png.  It also allows loseless compression, embedded metadata, and alpha channel. As a big bonus, HEVC enc/dec should be supported by video hardware in the near future, so the most time consuming processes will be vastly accelerated.

This is a (linux) Gimp plugin that uses his libbpg library to import BPG files.  The encoding part (data to BPG) is not yet included in the library,  so there is no export function in this plugin.

If you want to see what BPG is capable of,  look here for a comparison!! Also, take a look at this page; Bellard even wrote a javascript that decodes BPG files on the fly and renders them inside <canvas> elements !

file_bpg-0.1.tar.gz

Publicado en C, english, GNU / linux | 3 comentarios

extracting 3d meshes from ANZ files

This is a small C app that will extract static mesh 3d objects from an ANZ file to an OBJ.

Wavefront OBJ is a well known file format, supported by all major 3d editors, but it lacks bone and animation descriptors. This app will only extract meshes, UVs and embedded textures, but will also show bones and animation info if present.

anz2obj_0.9.tar.gz

Publicado en C, GNU / linux | Deja un comentario

Renaming files with special characters

There are situations in wich a file containing special characters can be created in your file system, making it hard to remove or rename them as the file manager and even the console won’t escape the name correctly. If the file was created using UTF-8 there is no problem, but if it was first named using a different character set (say, SJIS for instance) or its name is stored in a descriptor (i.e. a ZIP file), Linux won’t be able to open it.

You can still get acces to it via its index node, without using the filename.

(一般コミック) [大友克洋] AKIRA 第01巻.zip

This file was created using Windows. KDE understands the japanese kanji and you can rename or delete it. But when you extract its contents, the file names stored inside the ZIP file do not have any character set associated, so the filesystem does not recognize them.

?????S?t????1_????.png
?????S?t????1_?-??.png
?????S?t????1_???-?+??.png
?????S?t????1_???-????.png
?????S?t????1_???-?-??.png

You can use find to rename them.

First, get their inode using ls -i

12323499 ?????S?t????1_????.png
12323351 ?????S?t????1_?-??.png
12323581 ?????S?t????1_???-?+??.png
12323418 ?????S?t????1_???-????.png
12323479 ?????S?t????1_???-?-??.png

Then using find …


$ find . -maxdepth 1 -inum 12323499  -exec mv '{}' ./akira_01.png \;

And so the file gets renamed.

To do this for a group of files in a subdirectory we will use a counter


$ let c=0;for i in `ls *.png -i|cut -d ' ' -f1`; \
do let c=c+1 ;  \
find *.png -maxdepth 1 -inum $i -exec mv '{}' ./AKIRA_01_$c.png \;  ; \
done

so files get their new readable name

AKIRA_01_1.png
AKIRA_01_2.png
AKIRA_01_3.png
AKIRA_01_4.png
AKIRA_01_5.png

Note: you must end the mv command given by -exec with ; before exiting the loop with ;done. Also, it is a good practice to prepend the semicolon with a \ to prevent the special characters messing with the mv.

Publicado en english, GNU / linux | Deja un comentario