Wednesday, August 25, 2021

hibernate: java.lang.IllegalArgumentException: org.hibernate.QueryException: Unable to resolve path


 >PROBLEM


java.lang.IllegalArgumentException: org.hibernate.QueryException: Unable to resolve path [e.title], unexpected token [e] [select e from br.com.adr.model.entity.security.uni.RoleEntity WHERE e.title = :title]



>SOLUTION


Original code:

String sql = "select e from " + this.entityName + " WHERE e.title = :title";

Query query = em.createQuery(sql, RoleEntity.class);

query.setParameter("title", title);


Fixing the code:

Missing the 'e' entity alias:

String sql = "select e from " + this.entityName + " e WHERE e.title = :title";


>ENV

Windows 10
JSF 2.2
WildFly 21

Tuesday, August 24, 2021

JEE: Using JSF, Primefaces and p:growl the messages return duplicated (twice).

 

>PROBLEM

Using JSF, Primefaces and p:growl the messages return duplicated (twice).





This kind of issue may have alternative reasons.
On this post it is shown two of them:
- The simple case
and
- The modal case


>SOLUTION #1 - SIMPLE CASE

Find the p:grow element.

Switch the p:growl attribute from:

<p:growl id="growl" showDetail="true"/>

to:

<p:growl id="growl" showDetail="false"/>


Supposing the java code is something like this:

public String remove() {
FacesMessage success = null;
try {
bsn.delete(toEntity());
success = new FacesMessage(FacesMessage.SEVERITY_INFO, "SUCCESS: ID " + this.id + " removed", null);
FacesContext.getCurrentInstance().addMessage(null, success);
clean();
return ModelConfigSvc.SUCCESS;
} catch (BsnException e) {
success = new FacesMessage(FacesMessage.SEVERITY_ERROR, "deletion failed",null);
FacesContext.getCurrentInstance().addMessage(null, success);
return ModelConfigSvc.FAIL;
}
}


or
public String remove() {
FacesMessage success = null;
try {
bsn.delete(toEntity());
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "SUCCESS: ID " + this.id + " removed", null));
clean();
return ModelConfigSvc.SUCCESS;
} catch (BsnException e) {
success = new FacesMessage(FacesMessage.SEVERITY_ERROR, "deletion failed",null);
FacesContext.getCurrentInstance().addMessage(null, success);
return ModelConfigSvc.FAIL;
}
}






>SOLUTION #2 - MODAL CASE

Scenario:
There is a page that lists entities and it may trigger modal pages to update, delete, etc.
In such cases, the modal message may aggregate to the origin page's message, in this case the listing page.

A fast way to fix this leads us to switch the return value to keep the modal opened and not returning to the listing page, so the message doesn't accumulate twice, one from the modal (p:messages) and the other from the listing page (p:growl).

So, it is changed from:
return ModelConfigSvc.SUCCESS;

To:
return ModelConfigSvc.FAIL;

Below, it is shown the detailed information using the "deletion" to illustrate the example.






Issue to be fixed - doubled messages when the modal is closed after the deletion





THE CODE

faces-config.xhtml



roleList.xhtml





roleDeletion.xhtml exibted as modal







FIXING THE ISSUE


RoleDeletion.java







Return value switched to fix the issue

RoleDeletion.java 





Issue fixed






>ENV


Windows 10
JSF 2.2
WildFly 21





Saturday, August 21, 2021

JEE: Caused by: java.lang.IllegalArgumentException: UT010009: Servlet Faces Servlet of type class javax.faces.webapp.FacesServlet does not implement jakarta.servlet.Servlet

 

>PROBLEM


The application fails when deployed on the server (Wildfly/jBoss) return the following message:

  Caused by: java.lang.IllegalArgumentException: UT010009: Servlet Faces Servlet of type class javax.faces.webapp.FacesServlet does not implement jakarta.servlet.Servlet



>SOLUTION


Check the following configuration:

- JDK'S version

- Libraries' versions (Maven's dependencies, etc.)

If the configuration seems correct, try to downgrade (or maybe upgrade) the server's version of JBoss or Wildfly.

For instance, from v.23 to v.21 or lower.

The application server's JEE version must be compatible with the project's libraries versions.

        Check WildFly's JEE versions on its download page.



>ENV

JDK 8/11

Wildfly 21

Eclipse

Windows 10

Tuesday, August 17, 2021

iptables: No chain/target/match by that name.


>PROBLEM

When running a "iptables conntrack" command, for instance like this:
    iptables -A INPUT -p tcp --dport 8081 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
 
returns the error message:
  
  iptables: No chain/target/match by that name.


>SOLUTION

The solution may contemplate alternatives due different causes.
This post shows two of them.

>using linux on a openvz container

OpenVZ servers share a kernel with the host, and as a result, you cannot load any kernel modules, and do some other tasks.

Ask your service provider to turn on the NetFilter for the server.


>linux, but not a container

Check this link.


>ENV

OpenVz container


Wednesday, August 4, 2021

debian 10: nginx fails to install after system upgrade


 >PROBLEM


Scenario:

After performing an upgrade using:

apt update

apt upgrade


nginx returns installing issues and fails to start, returning an error message like this:


Aug 04 13:28:47 myserver.com systemd[1]: Failed to start A high performance web server and a reverse proxy server.

dpkg: error processing package nginx-full (--configure):

 installed nginx-full package post-installation script subprocess returned error exit status 1

dpkg: dependency problems prevent configuration of nginx:

 nginx depends on nginx-full (<< 1.14.2-2+deb10u4.1~) | nginx-light (<< 1.14.2-2+deb10u4.1~) | nginx-extras (<< 1.14.2-2+deb10u4.1~); however:

  Package nginx-full is not configured yet.

  Package nginx-light is not installed.

  Package nginx-extras is not installed.


>SOLUTION

1. Check the installed packages:

  dpkg -l nginx*

Returns:

||/ Name           Version          Architecture Description
+++-==============-================-============-=========================================================
iU  nginx          1.14.2-2+deb10u4 all          small, powerful, scalable web/proxy server
ii  nginx-common   1.14.2-2+deb10u4 all          small, powerful, scalable web/proxy server - common files
un  nginx-doc      <none>           <none>       (no description available)
un  nginx-extras   <none>           <none>       (no description available)
iF  nginx-full     1.14.2-2+deb10u4 amd64        nginx web/proxy server (standard version)
un  nginx-light    <none>           <none>       (no description available)
root@again4u:/opt# dpkg remove nginx-1.14.2


2. Purge the packages:

  apt purge nginx-common nginx-full


3. Testing the removal:

  dpkg -l nginx*
root@again4u:/opt# dpkg -l nginx*
dpkg-query: no packages found matching nginx*

Shall return "no packages found..."


4. Deactivate the firewall, temporarily.


5. Reinstall nginx.

  apt install -f nginx
  

6. If reinstallation fails returning the same previous issue, uninstall nginx again, repeating the steps above and reboot the server.

If using a remote server, use the provider's interface to reboot it.

Deactivate the firewall, temporarily, and install nginx again:

  apt install -f nginx



7. Test the installation.

  systemctl status nginx

If successful, return something like this:

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2021-08-04 13:54:48 EDT; 22min ago
     Docs: man:nginx(8)
 Main PID: 723 (nginx)
    Tasks: 3 (limit: 4915)
   Memory: 16.3M
   CGroup: /system.slice/nginx.service
           ├─723 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           ├─726 nginx: worker process
           └─727 nginx: worker process


8. Start the firewall.


>ENV

debian 10

Thursday, July 29, 2021

Eclipse issue: Could not write metadata for '/RemoteSystemsTempFiles' ... (Access is denied)

 

>PROBLEM


Eclipse throws the following message:

Could not write metadata for '/RemoteSystemsTempFiles' ... (Access is denied)
..\eclipse-jee-2021-03_revision\.metadata\.plugins\org.eclipse.core.resources\.projects\RemoteSystemsTempFiles\.markers.snap (Access is denied)






>SOLUTION

1. Most probable possibility is folder corruption.
Delete it and make it again.

Example (Windows, dos):
mkdir L:\portables_d\ide_home\eclipse-jee-2021-03_revision\.metadata\.plugins\org.eclipse.core.resources\.projects\RemoteSystemsTempFiles\.markers.snap



2. Less probable is access permission.
If linux, check and use chmod.
If Windows, follow the figure:



>ENV

Windows 10
eclipse-jee-2021-03

Thursday, July 22, 2021

Eclipse: JSF: schema_reference.4: Failed to read schema document 'platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd'


>PROBLEM 

Eclipse returns on face-config.xml file the following message:

  schema_reference.4: Failed to read schema document 'platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd'


>SOLUTION

1. Test the URLs pointing them on the browse to make sure that they exist.

<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">

2. If all URLs points to a valid page, try to change something on the page and save again.
In this example, the "faces-config" element was rearranged like this:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">





>ENV


st03ajs
jsf2.2
java13
wildfly8

Friday, July 16, 2021

Git - Fix Corrupted Object Issue - Simple solution for: error: object file .git/objects ... fatal: loose object ...is corrupt


>PROBLEM

Git pull command fails returning error message of corrupted file:


git pull

error: object file .git/objects/dd/4b0b1a777609ba3f787823e566bfc989905319 is empty

fatal: loose object dd4b0b1a777609ba3f787823e566bfc989905319 (stored in .git/objects/dd/4b0b1a777609ba3f787823e566bfc989905319) is corrupt



>SOLUTION

1.. Copy the corrupted file from another local repository.
If there isn't another, you may clone one.


2. Issue the pull command again.


>ENV

windows 10


 







Wednesday, March 31, 2021

Maven: [ERROR] Child module..does not exist @


 >PROBLEM


mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=ejb-javaee7


Returns:

[ERROR] Child module..does not exist @



>SOLUTION

Check your pom.xml.

Also, check the mirror's configuration in the maven's settings.xml file.


Example: 

C:\Users\MYLOGIN\.m2\settings.xml


<mirrors>

<mirror>

<id>client-repo</id>

<mirrorOf>*</mirrorOf>

<url>http://xyz.core.cliente:8099/nexus/content/groups/my-group/</url>

</mirror>

</mirrors>


Comment, or remove the mirror that is not providing connection.

If it is a project mandatory resource, then report.


>ENV

Windows10

(Same for *nix or apple except the paths)


Friday, March 12, 2021

JavaScript: error NG8002: Can't bind to 'ngModel' since it isn't a known property of 'input'

>PROBLEM


After adding an implementation to bind using ngModel , for instance:

  <p>

    <label for="example-ngModel">[(ngModel)]:</label>

    <input [(ngModel)]="currentItem.name" id="example-ngModel">

  </p>


Return the error message:

  error NG8002: Can't bind to 'ngModel' since it isn't a known property of 'input'



>SOLUTION

@SEE: this issue may also be caused by other factors, check:
angular-ngform-error-ng8002-cant-bind.html


Make sure that the app.module.ts has the following configuration:


import { BrowserModule } from '@angular/platform-browser';

import { NgModule } from '@angular/core';

import { FormsModule } from '@angular/forms'; // <--- JavaScript import from Angular


@NgModule({

  declarations: [

    AppComponent,

// ...

  ],

  imports: [

    BrowserModule,

    FormsModule,

    AppRoutingModule

  ],

  providers: [],

  bootstrap: [AppComponent]

})

export class AppModule { }



In the app.component.ts (or whatever) file, check the import and make sure the constructor() and ngOnInit() are both declared:


import { Component,  OnInit } from '@angular/core';  // minimal

//import { Component,  OnInit, Output, Input, EventEmitter } from '@angular/core';  // usual 


  constructor() { }

  ngOnInit(): void {

  }


>MORE


>ENV

node.js 14.x.x

windows



Tuesday, March 9, 2021

JavaScript: TypeScript: This condition will always return 'true' since the types 'string' and 'EventEmitter' have no overlap.ts(2367)


 >PROBLEM


The code below returns the error message:

This condition will always return 'true' since the types 'string' and 'EventEmitter<string>' have no overlap.ts(2367)



*** BAD

  crossOffItem(event: EventEmitter<string>): void {

      const ritems = this.items.filter( it => it !== event);

      this.items = ritems;

  }




>SOLUTION


TypeScript complains that the types are not explicitly equivalent or comparable.


*** OK

  crossOffItem(event: EventEmitter<string>): void {

      const ritems = this.items.filter( it => it !== event.toString());

      this.items = ritems;

  }



POOR SOLUTION


  crossOffItem(event: EventEmitter<string>): void {

      const val = event.toString();

      const ritems = this.items.filter( it => it !== val);

      this.items = ritems;

  }


>ENV

Node.js v.14.15.4

Wednesday, March 3, 2021

Oracle Cloud: Linux VM denies access returning "oracle cloud public key WARNING: UNPROTECTED PRIVATE KEY FILE" message

>PROBLEM

You are using Windows and the procedures suggested by Oracle's documentations to connect the Oracle Cloud Linux VM fail returning the message:

oracle cloud Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

>SOLUTION

Faster than "fighting" for an ideal solution via Windows, perform the procedure on Linux environment using a Docker container or a virtual machine (VirtualBox, VMware, etc.). 


>ENV

Oracle Cloud Linux VM
Windows 10
Debian 10/VMware

Tuesday, March 2, 2021

legacy: Netbeans v.6.7.1 Installation - JDK not found issue

 

>PROBLEM

Attempt to execute the installer fails returning message that JDK was not found.


>SOLUTION

This procedure avoids messing with the configuration of your system.

Java installers usually use the following default paths:
C:\Program Files\Java
C:\Program Files (x86)\Common Files\Oracle\Java\javapath

The Netbeans v6.7.1 installer uses by default this:
C:\ProgramData\Oracle\Java\javapath

To avoid changing the System's configuration, the installation may be done as below.

1. Java setup for Netbeans v.6.7.1 

Netbeans v6.7.1 searches "java.exe" by default under the following path:
  C:\ProgramData\Oracle\Java\javapath\java.exe
Check if it is present on the system.

If present, check the java's version:
  C:\ProgramData\Oracle\Java\javapath\java.exe java -version
The Netbeans 6.7.1 accepts Java 8 version.

If not, copy from another folder on the system the "java.exe" for Java 8.
Try the usual default places referred above.
Copy the java executables to the netbean's default path (better all of them, just in case):
java.exe
javaw.exe
javaws.exe

2. Extracts the bundle from the Netbeans executable.
netbeans-6.7.1-ml-windows.exe --extract

3. Run the bundle extrated to start the installer.
java -jar bundle.jar





Saturday, February 20, 2021

Git: FAILURE DUE TO CORRUPTED FILE: remote: error: inflate: data stream error ... remote: error: unable to unpack ... remote: fatal: loose object ... error: remote unpack failed:

 

>PROBLEM

An attempt to update the local repository using pull and push fails returning the following message:

...
! [remote rejected] master -> master (unpacker error)
remote: error: inflate: data stream error (unknown compression method)
remote: error: unable to unpack a798a0e5cdf6ab498ea641c3d8d7b5763dc901d0 header
remote: fatal: loose object a798a0e5cdf6ab498ea641c3d8d7b5763dc901d0 (stored in //10.0.0.7/j/git/code/objects/a7/98a0e5cdf6ab498ea641c3d8d7b5763dc901d0) is corrupt
error: remote unpack failed: unpack-objects abnormal exit


$git checkout -f HEAD
error: unable to read sha1 file of css_grid.diff (a798a0e5cdf6ab498ea641c3d8d7b5763dc901d0)
error: inflate: data stream error (invalid distance too far back)
error: corrupt loose object '8711ded8021f5a4f59db8899e25c30655e80e803'
fatal: loose object 8711ded8021f5a4f59db8899e25c30655e80e803 (stored in .git/objects/87/11ded8021f5a4f59db8899e25c30655e80e803) is corrupt

Another attempt to clone the repository also fails, returning:

git clone \\10.0.0.7\j\git\code
Cloning into 'code'...
done.
error: unable to read sha1 file of css_grid.diff (a798a0e5cdf6ab498ea641c3d8d7b5763dc901d0)
error: inflate: data stream error (invalid distance too far back)
error: corrupt loose object '8711ded8021f5a4f59db8899e25c30655e80e803'
fatal: loose object 8711ded8021f5a4f59db8899e25c30655e80e803 (stored in L:/transp/1___downloads/code/.git/objects/87/11ded8021f5a4f59db8899e25c30655e80e803) is corrupt
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'


>SOLUTION

The attempt to clone was used to make sure that the corruption happened on remote repository.
After some research, the best documentation to fix this was "Recovering from repository corruption" but also comments that against corruption the best alternative is a backup.
Although having backups, it didn't help in this case because the backups also had exactly the same issue since a backup is a copy. Because it is not an incremental copy, the backup was useless.

SAVING THE PAST


Faster than trying to fix it for the sake of time saving, the corrupted remote repository was renamed from "code" to "code_corrupted_200220" and saved its copy.

ren code code_corrupted_200220
or
mv code code_corrupted_200220 (linux)

This backup may be used to get some previous commit, or even an attempt to fix it if really necessary just because it is required an old version of a file. Since "clone" command was able to clone to local repository although the warning, this corrupted remote repository is still useful to recover old stuff.

GOING AHEAD WITH THE FUTURE

It was created a new remote repository:
mkdir clone
cd clone
git init --bare

A new remote repository with a new log  history.
The old one is preserved in the backup mentioned above, just in case.

Next step is to push the local repositories.
The procedure was usual except that it is required to set upstream, resembling the procedure when a remote repository is switched (git remote remove origin, git remote add origin new_path).

git add *
git commit -am "MACHINE_NAME: corrupted remote repository switching"
git pull origin master
git push --set-upstream origin master

The same procedure was repeated to all local clients.

One day, if fixing the corruption is worthy, we may try the "Recovering from repository corruption" instructions, but till there, maybe Git will bring redundancy option to duplicate the tree.
In such cases it would be useful to have two files in different positions on the disk, in order to recover the information from a particular damaged disk position. This should be really an option because it would double the resources' requirement, but sometimes it is a desirable option if hardware has the power to supply this redundancy without being noticeable and disk space is not a restriction.

The full disk was checked successfully. No errors found, except this occurrence.

Murphy's day.  :-)


>ENV


Windows 10
git v.2.30.1.windows.1


Monday, February 15, 2021

How to use VS Code with Multiple Configurations with Backup


>PROBLEM


You need to work with different environments and workspaces for different purposes when working with different programming languages or different contexts.

For each context or environment, you've installed the desired extensions.

Also, it is interesting to keep a backup of the environment to save time.


What does happen next?

If you have just one configuration setup and many needs, the VS Code configuration begins growing, eventually getting heavy, slow, and taking too much memory.

Also, the extensions' default shortcuts begin to conflict with each other.


>SOLUTION

There are at least three approaches:

1. Versioning control using branches, or

2. Separate configuration folders, or

3. Option 1 plus option 2.


Versioning control using branches

The VS Code default folder that holds its configuration setup is under

      "C:\Users\YOUR_LOGIN\.vscode" folder.

Create a git repository there.

For each kind of environment desired, create a specific branch.

The master branch would aggregate everything, but in this case, there is no use unless you do want to keep a backup of just one setup.



Separate configuration folders

It is possible to switch environments using commands.
To do this, it is necessary to create a symbolic link to the current default extensions folder used by VS Code by default.

The default folder is at:

%USERPROFILE%\.vscode\extensions

Before creating the symbolic link, move the default extension folder to the new place desired, then create it:

mklink /D %USERPROFILE%\.vscode\extensions "NEW_PATH_DESIRED\extensions"

Ex.:
mklink /D C:\Users\YOUR_USER\.vscode\extensions "D:\ide_home\vscode\Code\extensions"



Option 1 plus option 2

You may combine the two options above, but better if the branches keep a keyword to avoid losing control.

The best of all is that you never lose your env, never need to reconfigure, and may switch fast the environments preserving then VS Code app from getting messed and slow.



ATTEMPT FAILURE NOTE


The attempt using "--user-data-dir" and/or  "--extensions-folder" flags (options) was not successful by the time I've tried using VS Code  v.1.53.2.





Wednesday, February 3, 2021

Blue Screen with one of the following messages: windows system error STATUS_WAIT_2 0x80070002 or windows system error STATUS_WAIT_3 0x80070003

>PROBLEM


When rebooting the machine, returned blue screen with the following message:

  windows system error STATUS_WAIT_3 0x80070003


Another attempt, returned another message:

  windows system error STATUS_WAIT_2 0x80070002

  

>SCENARIO



The machine was very, very slow, and once in a while appeared "bad clusters". This situation took several weeks. During all this time, the checklist below passed:



HD fragmentation: OK

HD S.M.A.R.T. status and test: OK

Scandisk: no errors, OK

Antivirus: disabled during the tests.

Unexpected processes consuming CPU's resources: none

Internet connection: disabled

All programs closed, just the usual services were turned on.

Hardware temperature: OK

Windows Registry: OK



Suddenly, when a reboot is done, the blue screen with the messages.


All attempts possible were performed — all "Windows Recovery" options failed, returning messages like "not possible", "done but failed", and things like that. Fixing reboot, cloning a new reboot partition from a backup HD, attempt to restore an image or restore the system from a "restore point" and etc. had failed.




>SOLUTION


The HD was removed from the slot and inserted back twice.


An intermittent bad contact caused maybe by slight oxidation, dust, vibration, etc. was causing the unexpected "bad blocks".

In this scenario, the Windows system made an automatic update that was not able to get to the end.

Considering the two problems together plus interrupted update procedure, the mess was complete.


The solution came, after solving the contact issue, let Windows finishes the update. Long and twice, but the issue was solved but the system was inconsistent, missing several DLLs, requiring more one more solution.


This time at least was possible to restore to a previous point before the unlucky Windows update and perform again that required update.



When rare events happen to get together at the same time, just Murphy explains!  :-)


Eventually, the system was up and running again!

Well done Windows!!! Wow!!!


>ENV

Windows 10

Saturday, January 23, 2021

Git: Updates were rejected because a pushed branch tip is behind its remote counterpart

 

>PROBLEM


Git push fails returning "Updates were rejected because a pushed branch tip is behind its remote counterpart...".


 ! [rejected]        master -> master (non-fast-forward)

error: failed to push some refs to .. SOME DIR PATH

hint: Updates were rejected because a pushed branch tip is behind its remote

hint: counterpart. Check out this branch and integrate the remote changes

hint: (e.g. 'git pull ...') before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.



>SOLUTION


Following the hint suggested in the output:

  git push --help


The --force option solves:

  git push --force origin master

  

Because it was behind the counterpart, it may cause some side effect on log.

When performed the command, everything was fine, no issues, but another client had to push with --force flag too, but no further issues.



>ENV

Windows 10

Git version 2.19.1.windows.1


Tuesday, January 19, 2021

Slow Machine? Warn Up - Check this before it is too late


 >PROBLEM


Defragmentation is OK, there is no strange process taking the CPU for itself, no virus, but the desktop or notebook is very slow, much more than usual and, it seems that it get worse every month.

Also, you have noticed that the system requires HD fixes, leading to scans to fix block references, more frequently than usual.


>SOLUTION


"Your HD, in this case is very fond of you!"  :-)

It probably has been trying to warn you that it is supposed to end its life soon.

Time to make backup of all your stuff to an external HD or to make a revision of your data's backup routines to make sure everything is up to date.

Consider making a clone of your HD to be used when the current one is dead, or to replace it.

There are good apps for this, free or paid:

Free: HD Clone, Disk Genius
Paid: DriveClone, EaseUS Partition Master

TIP

If you have a big number of files, not qualitatively but quantitatively, not big files in size but numerous files, this condition stress the HD. That way, if the HD is old, having many hours of intense activities (working during the day and scheduled backups during the night), bad blocks are generated more frequently, leading to the required scans asked by the system.

If you have split your HD into two partitions, for instance, "C:" for Windows and "D:" for data, you get a better chance to solve this issue and gain more time until the HD replacement by moving your data on "D:" partition to another disk and deleting D:.
In this case, the HD will be less required and the issue may slow down, giving you an extra time before the HD substitution, something that may save you time, money and opportunity.

I've solved recently an issue like this just deleting the data partition. The HD got half work to do, so the situation became bearable. On the remaining free space, I cloned the "C:", getting to "C:" partitions on the same disk, but one of them disable at a time. If the HD's initial boot is preserved, when the active "C:" partition is gone, you may switch to the other just activating it. After you finish your work, you may clone the active "C:" partition to replace the defective one.
This saved me many hours during an urgent work that I couldn't stop for long maintenance and enabled me to deliver the task on time.

Always consider using different partitions for the system and the data, even if working with other S.O. different of Windows.





>ENV

Windows 10

Git rebase fails to continue

 

>PROBLEM


You perform "git rebase":
git pull --rebase

And returns:

First, rewinding head to replay your work on top of it...
Applying: room1 branch by room1
.git/rebase-apply/patch:23: new blank line at EOF.
+
warning: 1 line adds whitespace errors.
Using index info to reconstruct a base tree...
M       about.diff
Falling back to patching base and 3-way merge...
Auto-merging about.diff
CONFLICT (content): Merge conflict in about.diff
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0001 room1 branch by room1
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".

Next, you solve the conflict.
Details here

After, you try to continue the rebase, but the git refuses still requiring merging.


>SOLUTION

If the conflict was already solved, you may use skip option, as shown in the message above returned by git:
git rebase --skip

If you've performed this operation over master branch, may have consequences as information loss.

Check details here.


>ENV

Windows 10

Monday, January 18, 2021

git: 'credential-cache' is not a git command. See 'git --help'.

 

>PROBLEM


git: 'credential-cache' is not a git command. See 'git --help'.


>SOLUTION


Edit .git\config fille and remove:


[credential]

helper = cache







>ENV

Windows 10


Tuesday, December 15, 2020

MariaDB: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


>PROBLEM


This procedure resets the MariaDB root password when it is not possible to access the database returning:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)





 

>SOLUTION


- Stop database:
sudo systemctl stop mariadb


- Test:
sudo systemctl status mariadb

You shall get;
Status: "MariaDB server is down"
To return to console, use Ctrl+C


- This command shall return empty:
sudo pgrep mysqld


- Starting the database using safe mode:
sudo mysqld_safe --skip-grant-tables --skip-networking &
or
sudo mysqld_safe --skip-grant-tables &

"Enter" to return to prompt.


USING A TEMPORARY PASSWORD

- Entering the database prompt without user or password:

mysql -u root

use mysql;
flush privileges;
update user SET PASSWORD=PASSWORD('secret') WHERE USER='root';
GRANT ALL PRIVILEGES ON root.* TO 'root'@'localhost' WITH GRANT OPTION;
flush privileges;
quit


- kill all mysqld processes
sudo pgrep mysqld


- Kill by the PID numbers returned, for example:
sudo kill -9 1234
sudo kill -9 4567

- Start the database:
sudo systemctl start mariadb



WHEN THE DATABASE FAILS TO START
 
During the start, if it hangs, it is necessary to kill all processes. 
It happens when some process is left behind, not being killed.
Unfortunately, sometimes when killing the processes doesn't work because another new process starts just after, I just got solution rebooting the machine even though using killall, etc.
 

- To check:
sudo systemctl status mariadb




TESTING AND SWITCHING TO DEFINITIVE PASSWORD

 

- Access the database again to test the "secret" temporary password and also to change to the definitive password:

mysql -u root -p
pass: secret

use mysql;
flush privileges;
UPDATE mysql.user SET authentication_string = PASSWORD('MY_DEFINITIVE_PASSWORD') WHERE User = 'root' AND Host = 'localhost';
GRANT ALL PRIVILEGES ON root.* TO 'root'@'localhost' WITH GRANT OPTION;
GRANT RELOAD ON *.* TO 'root'@'localhost';
flush privileges;
quit

 

- Access the database again to test the definitive password:
mysql -u root -p
pass: MY_DEFINITIVE_PASSWORD


***NOTE:

If after switching to the definitive password, the problem comes back denying access, it is because the characters used in the password caused the issue.
Avoid password like this:
Abc1234#-_ (the -_ didn't work during my attempts)
For sure, use a password with just numbers and letters.
To get confidence, repeat the procedure.
If you desire to use special chars, you may try after making sure that you got success at least once, that way you may discover which special char to avoid in your password.

 

>ENV

debian 10/9
10.x , 10.3.27-MariaDB



DIFFERENT BEHAVIORS DUE TO ENVIRONMENT DIFFERENCES

This procedure was executed several times successfully, but you may get some issue with some command shown above.
Below, there are some alternatives, not all of them of course, that you may try if some command fails.

set password for 'root'@'localhost' = password('secret');
- or
ALTER USER 'root'@'localhost' IDENTIFIED BY 'secret';

 

ADDITIONAL SOURCES

www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password

robbinespu.github.io/eng/2018/03/29/Reset_mariadb_root_password.html

 

ALTERNATIVE SITE

alsdias.blogspot.com/2020/12/mariadb-error-1045-28000-access-denied.html

 

@SYSREF:

y;reset root password<memo<mariadb;. 

 

Monday, December 14, 2020

Wi-Fi modem/router fails to connect via wi-fi or RJ-45

 

>PROBLEM


The "ZTE MF253L LTE Wireless" Wi-Fi modem/router sometimes fails to accept Wi-Fi connections and comes with issues when using RJ-45.

A very odd defect that occurred after some years of usage.


>SOLUTION


Sometimes it is interesting to improve a modem/router that it is not that good than buying a new one.

ZTE MF253L has not a wide signal range but works well.

Instead of buying another modem/router, I decided to use a tp-link Wireless N 450Mbps router, model TL-WR940N, connected to the ZTE's internet output, using the RJ-45 cable.

The TL-WR940N model has a good signal range.

Now, I connect the notebooks direct to the tp-link router, instead of to the ZTE's, solving the connection issues. No more problems, at all.

Sometimes, when the ZTE's direct connection is not failing, it is possible to use it without the tp-link, but it is not an advantage at all, but remains as an alternative in case of a casual tp-link failure. 

When the provider's connection fails, the Window's wi-fi connections keeps the tp-link router active waiting and as soon as the connection is on again and nothing is changed on the notebooks connected to the tp-link.

This saves time when the failures are short.

If not, you may connect to the tp-link another modem/router using another number, a second option when you have it, without changing clients' configurations. If you have many machines, it helps a lot.

For some reason, sometimes Windows fails to reconnect the Wi-Fi, forcing to do a reboot.
This workaround also avoids this reboot.







Thursday, November 26, 2020

Git: ! [remote rejected] master -> master (unable to migrate objects to permanent storage) error: failed to push some refs to 'ssh://REPOSITORY_PATH_HERE'

>PROBLEM

Attempt to push to git repository fails, returning the following message:

git push

Returns:

 ! [remote rejected] master -> master (unable to migrate objects to permanent storage)

error: failed to push some refs to 'ssh://REPOSITORY_PATH_HERE'


>SOLUTION

Check permissions on the remote server's repository.
For instance, supposing:

/home/git/myProject


Test, using the following command:

chmod -R 777 /home/git/myProject


Then, go to the client and try to push again.
If the issue is gone, set the proper permissions of remote server's repository

>ENV

Linux (remote git repository)
Windows (client)

Sunday, September 27, 2020

Online Tool to Convert Text to HTML with Pre-defined Tags And Selectors

>PROBLEM


You want to copy a code snippet and paste into an HTML page that has its own CSS selectors.

For example, you are working on Eclipse, VSCode, Atom, Sublime, etc. and you wish to copy and paste the snippet below to your post in HTML.

server {
	server_name marketing.example.com marketing.example.org marketing.
	example.net;
	rewrite ^ http://www.example.com/marketing/application.do permanent;
}
server {
	server_name communication.example.com communication.example.org
	communication.example.net;
	rewrite ^ http://www.example.com/comms/index.cgi permanent;
}
server {
	server_name www.example.org www.example.net;
	rewrite ^ http://www.example.com$request_uri permanent;
}


>SOLUTION


You need a Text to HTML converter that enables to use your CSS selector.

You may try ultering.com/it4us/converter, a free online tool, that offers fast shortcuts. For instance, paste the text in the box and try CTRL+.







eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...