30 June 2020

Stop Netbeans downloading whole 1GB maven index

Netbeans for Java programming with Maven likes to download the Maven index that's over 1 GB in size.

There's basically three ways to stop that huge download for 3 different situations:

(1) Temporarily don't want auto updates

If you already downloaded the index, the updates are smaller but still sizable.  One way to to stop it re-downloading the updates is to go to:

Tools > Options > Java > Maven > Index > Index update frequency > set to never.

Then click "Index Now" in that window only whenever you want an update.

(2) Just don't want Maven at all

If you don't have the index downloaded yet (e.g. a new install) and basically never want to use Maven, then in that same window, you could instead check off:

Completely disable indexing

As it warns you, lots of features will be disabled, but if you're not using Maven, who cares?

(3) Want Maven index without the download

This is amazing, there's this plugin you should get and it'll solve this problem: Maven Remote Search plugin.

It's old and it says it's for Netbeans 8.2 (the super old Oracle version), but I tried it out and it works for the new Apache Netbeans 11 and 12!

It lets you search the Maven index online rather than downloading the whole index to your local disk (which is crazy).

The github repo for the plugin is active recently with a historical build, so hopefully it'll get its version bumped and put on the Apache Netbeans plugins web page (which I don't think exists yet...).


Bibliography:

21 June 2020

Migrating to Debian LXQt - great apps, tips and fixes

I like LXQt and use Lubuntu.  I'm trying out Debian LXQt because of... snap issues.  So here's the Debian LXQt edition of my previous Lubuntu productivity software to install and  migration notes.

TL;DR...

After installing the standard Debian testing distribution (currently bullseye), I like to:

# for building some kernel modules
sudo apt-get install build-essential dkms linux-headers-$(uname -r)

# enable contrib and non-free repos
sudo sed -ri 's/^(deb.*main)$/\1 contrib non-free/' /etc/apt/sources.list
sudo apt-get update
sudo apt-get upgrade

# productivity software I like
sudo apt-get install chrony file-roller xournal evince nomacs graphicsmagick ghostwriter emacs gimp gimp-plugin-registry gimp-gmic default-jdk gcc make ttf-mscorefonts-installer ruby vlc  libsecret-1-0 libsecret-1-dev keynav gedit restic

# enable libsecret for git
sudo make --directory=/usr/share/doc/git/contrib/credential/libsecret
git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret


# because where I am, it's hard to contact a time server except Apple's...
echo 'server time.apple.com iburst' >> /etc/chrony/chrony.conf

# make an icon for GraphicsMagic
cat > ~/.local/share/applications/GraphicsMagic\ display.desktop << EOM
[Desktop Entry]
Encoding=UTF-8
Name=GraphicsMagick display
Comment=GraphicsMagick display
Exec=/usr/bin/gm display %F
Icon=lximage-qt
Categories=Graphics;Viewer;RasterGraphics;2DGraphics;Photography;
Type=Application
MimeType=image/jpeg
Terminal=false
EOM

# install aws-cli 2 using curl,unzip,install, like this:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install


Note: ttf-mscorefonts-installer might require user interaction to install, so don't walk away from it overnight thinking everything will be done by morning.

Then install by hand VS Code, Chrome, Netbeans, and LibreOffice dictionaries and plugins etc.


Finally, also set up file-roller integration.


Software to Download and Install by Hand

The default package manager using the default Debian software sources (testing channel) are pretty good at keeping up with the versions.  I like doing that most of the time to reduce on maintenance.

Some things are worth the manual install though.

1. LibreOffice needs some extensions, dictionaries, and settings:
  • an extension I rely on a lot:  MultiFormatSave.  Let's you save a document to multiple formats at the same time, great for archival compatibility.

     
  • it needs a dictionary for spell checking!  For English, these dictionaries from LibreOffice are good.


  • this setting is essential to prevent previews of recent documents on the start screen, which is quite a privacy blunder:
    • Tools menu > Options > LibreOffice > Advanced > Open Expert Configuration > Search for RecentDocsThumbnail property > toggle to false.

2. Google Chrome is self-updating.  I prefer Firefox, which is installed by default, but sometimes you need Chrome.


3. Apache NetBeans.  This requires as a dependency the Java JDK at least version 8.
  • So use muon to install the default-jdk because the default is version 11, which works fine so far.

  • And get the "Maven Remote Search" plugin before Netbeans starts downloading and extracting the maven index that's apparently more than 1 GB in size (froze my computer since I have very little disk space...).

4.  VS Code.

    Screen Saver Lock Screen Madness

    It's madness, there are at least 3 places to set the screen saver / lock screen / sleep settings:
    1. Preferences > LXQt Settings > Session Settings
    2. Preferences > LXQt Settings > Power Management
    3. Preferences > Screensaver
    They seem to interact with each other, and each has slightly different settings and uses.

    My default Screensaver sometimes ran the CPU real hot, so maybe set that to something less energy intensive first.  I used Deco with settings reducing the framerate.

    I'd suggest using each tool for orthogonal tasks:
    1. use Screensaver purely for setting the screensaver and when it turns on.

    2. Set when the screen locks using Power Management (Idle tab).

    3. Use the Session Settings to set whether the screen locks before suspending the OS (I think it defaults to locking after suspending).

    File compression tool

    For reasons, I like file-roller.  So just install file-roller via apt-get.

    The default file explorer PCManFM-Qt has a preferences option to integrate with file-roller instead as well for ease of use.




    Explanation of certain software choices


    Basic graphics editing

    The default graphics viewer LXImage is actually a bit of a pain to use, especially coming from Mac Preview, which really has a great mix of UI, UX, and editing features for graphics and PDFs...

    There's no equivalent to Apple's Preview, but for graphic files, nomacs Image Lounge is pretty good.  nomacs has a UI UX reminiscent of Preview, and has some basic graphics editing features too.


    Little more graphics editing features

    The default graphics viewer LXImage has some annotation tools, I guess, but nothing more.  nomacs has some more graphics editing features, but I sure miss the Mac Preview tool.

    Anyway, ImageMagick or the more updated GraphicsMagick fork is quite useful (but beware it has a very... historic?... dated?... GUI).  It can be installed via apt-get, but it doesn't seem to install a default app launcher icon --- well, it's meant to be used from the terminal, but I like to deal with the GUI.

    So I added a blank file to ~/.local/share/applications called "GraphicsMagic display.desktop" with the following text saved to it:

    [Desktop Entry]
    Encoding=UTF-8
    Name=GraphicsMagick display
    Comment=GraphicsMagick display
    Exec=/usr/bin/gm display %F
    Icon=lximage-qt
    Categories=Graphics;Viewer;RasterGraphics;2DGraphics;Photography;
    Type=Application
    MimeType=image/jpeg
    Terminal=false


    Now you can use it like LXImage (in fact, it uses the LXImage icon because, why not?).

    If I need more intensive graphics editing, I'll use GIMP.


    Time Clock Auto Update Synchronization Problem

    Debian looks to use timedatectl by default for setting time, including synchronization via NTP Network Time Protocol.  It doesn't allow me to force a sync though.

    You could instead use chrony.

    It lets you do things like chronyc sources to see the currently available and selected time sources.  Perhaps your network is blocking NTP updates?

    Or chronyc sourcestats to see your clock's time offset from the various NTP sources.

    You could do a single time offset check, without setting the time: sudo chronyd -Q

    Or manually force a time synchronization with: sudo chronyd -q

    Oh, and I like to add to /etc/chrony/chrony.conf  : server time.apple.com iburst because where I am it's hard to get to a time server except Apple's.



    Microsoft Fonts

    Install ttf-mscorefonts-installer.  Some instructions for this but it's straightforward from the package manager.  Just use sudo apt install ttf-mscorefonts-installer.



    Markdown editor

    I like Ghostwriter so far.


    Backup

    For file backup, restic looks great.  Some people like borg.


    Remember Git passwords securely

    Git is great.  Remember Git passwords securely is even better, but requires manual install though.


    Misc

    keynav  ---  Didn't have it in Lubuntu, but it exists for Debian!!!!

    skippy-xd  --- It hasn't been updated and doesn't work anymore for Lubuntu (OpenBox, LXQt).  Debian LXQt uses Xfwm though, so somewhat similar functionality is already built in!

    29 April 2020

    What is the best Linux terminal emulator?

    (Or: Why doesn't Lubuntu PCManFM-Qt's "Execute in Terminal" work?"

    Gnome-terminal is the best.

    Admittedly, the only other ones I've tried are Sakura, QTerminal, and XTerm.

    But hear me out.

    Gnome-terminal is the only one that handles executing command arguments with spaces properly, like XTerm does.

    I only say Gnome-terminal is better than XTerm because XTerm is a little too old school for me.


    The problem with QTerminal

    If you run:

    qterminal -e sh "/path/to/Folder Name With Spaces/do stuff.sh"

    QTerminal will screw up on the first space, splitting the string into multiple arguments.

    This is a known problem from 2017, so I'm not holding my breath for it to be fixed.  I don't know why, but QTerminal has other white space problems too.


    The problem with Sakura

    Sakura has the exact same problem.  If you run:

    sakura -e sh "/path/to/Folder Name With Spaces/do stuff.sh"

    Sakura will screw up, splitting the string into multiple arguments due to the spaces.

    Sakura is better than QTerminal in that it will work if you escape the double-quotes:

    sakura -e sh \"/path/to/Folder Name With Spaces/do stuff.sh\"

    Unfortunately, file managers like PCManFM-Qt does not escape the quotes when it opens a script for you in your terminal.


    XTerm and Gnome-terminal does it right

    Well, the -e option still doesn't work for Gnome-terminal but I guess it does for XTerm.  However, Gnome-terminal has the -- option which does work properly!

    This works!

    gnome-terminal -- sh "/path/to/Folder Name With Spaces/do stuff.sh"

    And file managers like PCManFM-Qt does work with it to properly open a script in gnome-terminal, even if the path to the script contains spaces.

    Now go check out how to change the default terminal in Lubuntu.

    28 April 2020

    Changing the default terminal in Lubuntu 20.04


    This is terrifically over-complicated.

    I used to just remove lxterminal and symlink gnome-terminal over.

    I'm testing out the "proper" way nowadays.  Here's 3 steps to do it:


    1. PCManFM-Qt

    Go to preferences > Advanced > change the Terminal emulator


    2. Change the global shortcut Ctrl-Alt-T

    The GUI way to do it (using LXQt Settings > Shortcut Keys) does NOT work.

    You have to change the ~/.config/openbox/lxqt-rc.xml config file (or lxde-rc.xml for older Lubuntu), replacing the default qterminal with gnome-terminal.


    3. Update-alternatives

    Also in terminal, select gnome-terminal as prompted after running:

    sudo update-alternatives --config x-terminal-emulator
    or
    sudo update-alternatives --set x-terminal-emulator /usr/bin/gnome-terminal.wrapper


    Bibliography
    Doing the above three things is the correct way* to do what's suggested here but which has documented the GUI global shortcut change method which doesn't work in Lubuntu 20.04 (and maybe even earlier versions).

    27 April 2020

    What did you not do? Finding motivation

    Leonardo da Vinci - Adorazione dei Magi - Google Art Project
    The adoration of the magi (unfinished), Leonardo Da Vinci.

    Yeah, Leo had trouble finishing things too.

    It's tough working from home. Independently. Socially distantly.

    But you have unique advantages too.

    You have youthful energy, ideas and goals.

    You have a great excuse in case of entrepreneurial failure: it's the 2020 economy!

    You've got the internet, the greatest global information distribution and marketing network in history, for free! You can learn anything, for free!

    But motivation is tough.

    Here's some productivity and motivation DO's and DON'Ts:


    1. DO: Just start!

    It's better to start creating something instead of just thinking about starting.

    Write some code, even if it's wrong. You can always fix it later. But if you don't code, there'd be nothing to fix.

    Creative ideas are just conversations you have with yourself. Productive creative action is something you do in reality. There's no way to account for reality without just starting.

    What is there to account for in reality? Reality might involve getting a computer screen tan; a need for great code to be wrapped by terrible code just to get it to work; hunger, tiredness; loneliness, boredom; a desire for better; impostor syndrome and self-doubt; not having everything "figured out"; a need to make dinner.

    Real success doesn't bypass reality; it goes right through it.


    2. DON'T: "I just need a better place to work!"

    Your energy spent on finding/creating a fantasy work space is better spent creating something of value.

    "If only I found the perfect work music... a better laptop... the weather wasn't so nice / terrible..."

    Let's hear from Stephen King (On Writing: A Memoir of the Craft):

    "For years I dreamed of having the sort of massive oak slab that would dominate a room --- no more child’s desk in a trailer laundry-closet... In 1981 I got the one I wanted and placed it in the middle of a spacious, skylighted study... For six years I sat behind that desk either drunk or wrecked out of my mind, like a ship’s captain in charge of a voyage to nowhere.

    "A year or two after I sobered up, I got rid of that monstrosity... got another desk... half the size of the T. rex desk. I put it at the far west end of the office, in a corner... I'm sitting under it now, a fifty-three-year-old man with bad eyes, a gimp leg, and no hangover...

    "It starts with this: put your desk in the corner, and every time you sit down there to write, remind yourself why it isn't in the middle of the room. Life isn't a support-system for art. It's the other way around."


    3. DO: Reduce distraction, and totally annihilate interruption

    Having Netflix on in the background might be distracting, but that's still better than being interrupted every minute by messages on messenger, FB, Discord, or ..., demanding you to reply, post, tell your powerful story in 280 character tweets, or express yourself in 60 second videos. Sometimes, you even interrupt yourself by checking Twitter, IG, whatever...

    A whole generation of computing scientists and software development engineers have gone into making web sites and apps ever more "engaging" (née addictive).

    Hundreds of millions of consumers post photos and videos on IG, youTube, etc. Guess who profited $18.5 billion USD in 2019? Facebook, owner of Instagram. BTW, Alphabet, owner of Google and YouTube, made $34.3 billion USD in 2019 profits.

    IG or profit aren't bad (e.g. if you own stock). And we're told we should seek "balance", and learn to "manage" the distractions/interruptions, but just remember: stopping you from productive action by interrupting you with engaging apps is literally driven by their ~50 billion dollar profit motive.

    It's "a strange game. The only winning move is not to play."

    Productive creation requires concentration and focus; Interruptions block it.

    And if you're very good at creating software, you too can join FB and GOOG.


    4. DO: You have to *decide* to finish things

    Finishing things can be scary.

    Not finishing means your options are still open, anything can still happen, you don't have to worry about having it assessed and judged.

    Remember that you are responsible for what you do. You are not responsible, and actually you have no control, over other's perception of it. So go ahead and just decide to start and finish things.

    Yes, you have to *decide* that it's finished and done. If you don't decide to finish, creative work can go on forever and unfinished. The work won't tell you it's finished either; *you* have to make the decision that it's done.

    Big projects can be tough to start, and even tougher to decide to finish. So break it down into small weekly/daily pieces with deliverable weekly/daily end-products that must exist in reality.

    That way you can *feel* the progress being made. And when you get a chain of everyday progress, then just "Don't break the chain" (Jerry Seinfeld).


    5. DON'T: "I just need to figure out what I want to do first / today / this week / with my life"

    Stop trying to "figure out" what you want to do, and just start doing something. If you don't understand this, see point 1.


    Bibliography
    The inspiration for this was written by someone who wanted to remain anonymous: their literary posts is amazing.  Un/Fortunately, this post must stand alone.