Categories
IDE

GNU/Linux terminal as Integrated Development Environment.

There are tons of IDEs to choose nowadays, but I never found in all the years I have been programing one that fits me more than the GNU/Linux command line.

Only in Gentoo GNU/Linux there are 19.107 packages available, a good amount of them are programs useful while writting code, like vim, rg, docker, screen, firefox, qemu, git, perl, rust, cargo, etc.

I found IDEs easy to missconfigure and easy to get lost in them while if you mess a config file is obvious to know where to find it again, a GNU/Linux IDE is easy to fix, faster and does not waste all the resources of my machine, this made of it the definitive (For now) integrated development environment for me.

Commons complains to this approach to software development setup are:

  • You won’t be able to track where a function is declared on a large project
    • I am able to do it using rg which supports regular expresions to find where something comes from, many people which use IDEs end using grep or rg anyway when they need something more powerful.
  • Debugging is harder since your setup will lack the debugging capabilities of for example eclipse.
    • Most programming languages come with a good way to debug using the command line, sometimes this kind of debugging can be more powerful than the GUI since it allows you to send a debug session to others so they can help you identify the error without they having to look the session while you do it, allowing a more asyncronous debugging collaboration. (If we finally go to Mars this may get very useful to someone.)
  • An IDE would analyze your syntax on real time to help you avoiding errors.
    • While lacking of that functionality you can write the code with the potential errors and then ask the compiler to check or compile your code and hunt the errors one peer one.

I am not saying you should stop developing on Eclipse or whatever IDE you use, I think everyone should use the tools that fit them the most, and for me GNU/Linux is the winner as development environment.

I think in this post is a mandatory reference to in this article https://blog.sanctum.geek.nz/series/unix-as-ide/ I do not share from that article that command-line is not suitable for easy programming in Java since I have done it with no problem once learned how, but this introduced myself to the idea that I was in fact using a proper IDE while using the GNU/Linux command-line.

Categories
C Perl XS

If you program in Perl and learn XS is like you have super powers.

Perl has a big amount of modules available, but sometimes you need a library from C, in my case that library was Duktape to embed a JS interpreter in my application to be able to use a scrapped function from the Youtube video player to implement download videos with obfuscated signatures in Peertube-dl.

XS allows you to embed C libraries in Perl, this opens the door to many applications from writting programs using GTK to fast a critical in performance subroutine, tons of CPAN modules use it to extend the Perl’s capabilities.

The main resources to learn XS are: https://perldoc.perl.org/perlxs and https://perldoc.perl.org/perlguts.

This is how a very basic XS Perl module look:

#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "duktape.h"
#include "duk_config.h"
#include "javascript_builtins.h"

MODULE = Peertube::DL::Javascript  PACKAGE = Peertube::DL::Javascript
PROTOTYPES: ENABLE

SV *
_duk_create_heap_default()
    CODE:
        duk_context *context = duk_create_heap_default();
        if (context) {
            duk_push_c_function(context, js_builtin_print, 1);
            duk_put_global_string(context, "print");
            RETVAL = newSVuv((size_t)context);
        } else {
            RETVAL = &PL_sv_undef;
        }
    OUTPUT:
        RETVAL

This is how the loader Perl module would look:

package Peertube::DL::Javascript;

use strict;
use warnings;

use feature 'say';

use XSLoader;
use Data::Dumper;

XSLoader::load();

sub new {
    my $class = shift;
    my $self  = bless {}, $class;
    $self->{___ContextPrivateDONOTTOUCH} =
      Peertube::DL::Javascript::_duk_create_heap_default();
    return $self;
}

You can check for a complete example on the source of Peertube-dl: https://gitea.sergiotarxz.freemyip.com/sergiotarxz/Peertube-dl

Categories
Rust

Rust rules for complex projects.

I had the luck to try Rust because when I started developing FakeSFTP I needed a language which could provide me with type safety and speed to made my own implementation of a sftp server thought to interact with Nextcloud.

I really got pleased by the way Rust helped me to resolve my problem giving me what I asked and many more.

The struct syntax when making a class means if you need a struct on a moment you have that, but if this struct grows to need methods to treat with the structure you have not to rewrite so much the approach.

I love the way you can redefine a variable with let multiple times changing the type from that point in a safe way, many times I found myself working with a variable that is also the id which builds other and has only that use, for example the typical variable named username and contains the username that is the attribute you use to retrieve the User object from a DAO, in Rust you could do:

let user = get_argument('username');
let user = user_dao.get(user);

Redefining the user variable and avoiding to repeat yourself.

I love also the way Rust handles mutability because not only helps you avoiding modifying something where you should not, but also to know better what the code is going to do if you are reading code.

Cargo is great since allows you to manage compilation process of Rust projects in a really easy way, usually you add dependencies on Cargo.toml and Cargo does all the work, forget the Automake nightmare with the m4 language nobody understands.

In FakeSFTP I did not follow a strict OOP, I made objects when needed or when some struct had to much static functions to work with but thanks to the type system and the compiled nature of Rust refactoring was pretty fast and error-prone.

Maybe what I did for FakeSFTP does not sound like the better practices, but I needed a program mainly for personal use, but the advantages I described may apply on many more cases.

In my experience Rust has prove being a very useful and solid language and I can wait the moment to work with it again.

If this post gave you curiosity about Rust you may read this official book which is the main resource I used while learning the language. https://doc.rust-lang.org/book/

Categories
Federation Free software Privacy

Keeping your privacy online is hard work.

You may find yourself happy online when you see the “we value your privacy” nearby to a link to the privacy statement of the webpage you are visiting or the app you just installed on your Android smartphone, but when you really read those privacy policies you will probably see they are very permissive about the information they are allowed to collect about you.

In order to achieve real privacy online you must study a lot and be very disciplinated.

For example Google Chrome is the most used web browser today it integrates tightly with Google services, company which has really bad reputation for collecting massive amounts of information about their users, you will probably need to choose other browser like Mozilla Firefox who cares more about your privacy.

Microsoft Windows also collects tons of data about their user base and encourages you a lot to get a Microsoft account, but what makes worse that operative system to your privacy is that it does not provide free as in freedom software repositories integrated with a free software package manager, encouraging you to download the programs you need from untrusted sites. This united to their choice to hide the extensions of downloaded files by default is a open door to malware and software which is not respectful with your privacy.

But it can get harder, if you do not understand how a webpage works you may miss concepts like cookies or the referrer header which some companies like Google and CDNs may use to know in what webpage have you been to show you advertising in the future or whatever they want.

Google is pretty permisive about the data an Android application may collect, for example many of them store the list of applications you have installed, as an alternative to Play Store I suggest the F-droid repository which only have free as in freedom Android Applications.

Gmail reads your mail to trace where you buy and send you personalized advertising so Tutanota or Posteo are better alternatives, although in my opinion is time for email based in SMTP and IMAP to pass away, since their federated nature have been destroyed by monopoly, antispam rules which disallow little actors to effectively setup a reputable instance since you are almost spam by default and the failure to provide widespread standard end to end encryption.

Many webpages encouraging (Sometimes by the force in order to use the webpage.) you to disable your adblocker are also getting benefits from the massive data mining because those ads are personalized to you, do not fell in the trick and search for an alternative webpage.

There are many things you can start doing today to improve your online privacy but long term solutions which can use everybody pass by free as in freedom software being the most used option by everybody, not only programmers, sysadmins and other tech guys and federated services which implement E2E encryption getting popular in the general public I recommend the usage of Matrix, XMPP or Briar as messaging apps and Mastodon, Pleroma and Peertube as federated social network which are also based on free software.

Categories
Javascript Perl

Doing common things for Perl developers on Javascript (II)

From Perl to Javascript relearning.

Perl allows us to bless any reference into any being an object of any class, this is not a good practice always, but can become handy on corner cases, here is how is done in Perl:

sub bless_into_class {
    my $class = shift;
    bless {}, $class;
}
my $object = bless_into_class( 'MY::Class' );

And the JS equivalent:

function create_object_of_class(input_class) {
    return Object.create(input_class.prototype);
}
let new_object = create_object_of_class(my_class);

Categories
Computers Life quality

If you work in front of a computer, take some exercise.

I know by experience being all the day in front of the computer can be an attractive option for people who do informatics, stream videogames, write content, etc.

But you should employ at least 1 hours or 2 to make some physical exercise to have a better life quality.

Here is somethings you could do:

  • Join a real sport. Basketball, martial arts, voley. Any thing that can help you to achieve a more active style of life, you do not need to become a professional, only do it for fun and health.
  • Take a walk. Walking can be a relaxing activity and can help you getting new ideas while keeping you active, avoid using the smartphone while doing so and enjoy the real world to achieve the best results.
  • Take your bike. Bike nowadays is a good transport media, but you can use it simply for fun without being in a hurry.
  • Do runnig with your friends. It may help you to retake real life relationships while improving your physical and mental health.

There are many more options, but this can give you a brief idea of what can you do to have a more active life.

Categories
GPL wordpress

About the WordPress success.

WordPress is the king of the web, for many people putting a webpage online is equal to deploying and adapting WordPress to the needs they have, but what does WordPress such an useful software for building almost any kind of webpage?

The work others did on building plugins and themes for WordPress and the GPLv2 or later license which helps them sharing that work.

You can find themes and plugins for almost any purpose making WordPress a Swiss Army Knife and the GPLv2 or later WordPress is licensed in states than those plugins and themes must be distributed under the license of WordPress itself without further restrictions.

This allow you to virtually adapt any theme or plugin which does not fit you completly to your needs in a complete way and then distribute your changes under the same license.

Does it apply to paid plugins/themes?

It may be possible a plugin or theme is not distributed under a GPLv2 or later compatible license but that would expose the author to be demanded by anyone who holds copyright on WordPress for violating their license.

But you can sell software copies GPLv2 or later programs so the most probable outcome is you being able to edit and further distribute any plugin or theme you buy created for their usage on WordPress.

I hope WordPress becomes everyday better and we can enjoy more years of this amazing software.

Categories
Uncategorized

Getting a job as a premium service.

About the moral dimension of the increasing tendency to offer services with premium paid features for people seeking for a job.

Due to my recent unmployment status I have registered a good bunch of job seeking platforms all of them share offering premium features for a prize to candidates.

I think this want to play with the need to get a job to get money from the unprivileged users who want a job, Linkedin itself is and promotes such services in some of the offers, many times you have no other option than register in one or more o those services to apply for a job.

“Premium users will appear before”, “Premium users are x% more likely to get a job” are some of the quotes you can find on those sites.

People seeking for a job on those platforms are tricked into paying without any warranty this will help them at all getting a job.

I get Linkedin offering premium features for recluiters since they are using Linkedin itself to get money, but I think doing the same with candidates is power abuse.

I think we should advocate for descentralization and submiting resumes without registration on sites to make a fair employment search system.

Categories
decentralization google

When your big tech company of preference becomes bad for bussiness on internet.

In this blog post I am going to talk about Google.

We all lived a time when Google was a “good” search engine in sense you searched for something and you were going to get what you searched.

I think these times are finished and Google is now a spam as search results platform which destroys all competence in internet that is not who pays more to Google to get promoted.

Tech guys and privacy concerned individuals are likely not get the same viewpoint of that unless they look at the search result of less tech savy users like probably their grandmothers or grandfathers.

I saw users where all the first page of results was only promoted content on searchs like “Duolingo”, spam of every kind, from competitors to phishing webpages, everything but what you searched for.

I think as users we should advocate for descentralization to avoid those situations arising again.

Searx is a good alternative since you can implement it “at home” or use a instance from a user you trust.

Categories
Perl

Perl Programming language and the “You are in your own” feeling.

The “You are in your own” phrase comes from the Archlinux initramfs, when you mess the booting it drops you to a rescue shell and gives you that phrase.

The feeling I describe is when you must solve something with little or none help.

When I first started programming Perl because I thought it would be the better language to make a web based mail client I did not know it would become the language which gave me my first job nor my favourite language.

But I fast knew a thing, searching fast responses on StackOverflow using DuckDuckGo or other search engine was not a trivial task.

It was not the community fault, simply there are less developers doing Perl than Javascript or other mainstream programming language.

I tried to do something to solve that situation and I joined StackOverflow to bring my questions and found answers, but that is other story…

Thanks I became used to this situation I got better reading proper documentation like Metacpan or Perldoc and the code of the involved library on my error or “don’t know how to do this”.

But I think it is a experience which can make some developer to forget trying to use Perl as the proper tool to do something if they can not longer develop as they are used to. (No more snippet copy from StackOverflow.)

I think every developer will or have got in one of those situations, but in Perl is more frecuent than in other languages.

I think as a community Perl developers as me should think what we can do today to improve the Perl learning curve.

That is all.