Seek Thermal Compact, Samsung a21s, micro USB to USB-C adapter

So you have your Seek Thermal Compact thermal USB camera with its micro USB type B male plug. As the time flies by, you buy a new smartphone, Samsung a21s it is, and it does have the new USB-C rotationally symmetrical connector socket. And you buy a micro USB to USB-C adapter, and you plug it all in, and it does not work.

Well.

It sucks, doesn’t it? But that type of thing happens. It is to be expected. Maybe the next adapter you buy will work. Or the next. Or the one after that. Right?

But!

It turns out that not all is lost yet. It turns out that the sequence of plugging in the components in matters! Who would have expected that, right?

What you do, is you plug in the adapter into the phone first, and only then you plug the camera into the adapter. Voila! Everything now works just fine!

You even can turn the micro USB to USB-C adapter around its axis by 180 degrees, plug it in, and you still have your Seek Thermal Compact camera working, even though it is looking in the opposite direction now. How nice is that?

Probably, as some people are suggesting, USB-C sockets of the new smartphones have current so weak, that it can’t wake up the camera if it has the bulk of the adapter already attached to it, so the camera remains undetected.

The particular adapter successfully tested was the small and neat Fusion Accessories Adapter Micro USB to USB Type-C Black, item code 695208 (whatever that means), priced around 3.00 EUR. It is OTG capable and it clearly says so on the packaging.

NB! Beware of the adapters and adapter cables neither labelled as OTG capable nor listed online as such. Not having OTG label plastered all over it does not necessarily mean that the adapter can’t do OTG, but it somewhat reduces the chances. And if in a situation like this it does not work, it will leave you guessing – was it the physical properties of the adapter that prevented it from working in the particular setup, or it indeed is just a dumb charging cable with no OTG capability whatsoever to begin with.


Make Postfix use /etc/hosts

To make Postfix use /etc/hosts file to find IP address of the SMTP server before it contacts any DNS servers, add two lines to the /etc/postfix/main.cf file:

  • lmtp_host_lookup = native
  • smtp_host_lookup = native

TCPDF ERROR: Could not include font definition file (SOLVED)

When using TCPDF_FONTS::addTTFfont(), everything seems all right, but you can’t get TCPDF to use the custom TTF fonts. You read online that the problem may be with the fonts directory, so you change permissions on all your TTF font directories, but nothing changes, you are still greeted with the message:

TCPDF ERROR: Could not include font definition file

Well. The problem actually is with the TCPDF fonts directory, not with the system TTF fonts directory

A quick and dirty, and probably not entirely safe solution to the problem is to grant write permissions to everyone on the TCPDF fonts directory, so that TCPDF can write the freshly generated font definition files to it:

  • sudo chmod ugo+w /usr/share/php/tcpdf/fonts

Apache Cordova – Android target: not installed (SOLVED)

You do the initial testing of your Apache Cordova installation by running command

  • cordova requirements

What you get is this message or similar (target version may vary):

Android target: not installed
Please install Android target / API level: “android-27”

To fix this, in Android Studio (you need to have it installed, obviously) you go to the menu Tools -> SDK Manager and add the respective SDK Platform (shown below in green).

IMPORTANT! Be aware, that what you need at this stage is the SDK Manager and not the AVD Manager! Because what you need to install to please Cordova is the development platform for the particular version of Android, and not the system image for emulator to run it on (shown below in yellow). That you can do as the next step.


Expand XML entities

You can process your Mapnik XML files with a xmllint command line tool to expand entities, in order to get rid of errors caused by removal of the built-in XML parser:

  • xmllint -noent in.xml > out.xml

MariaDB and phpmyadmin: Access denied for user ‘root’@’localhost

After installing MariaDB instead of MySQL 5.7 you lose the ability to log as root into phpmyadmin with the message “Access denied for user ‘root’@’localhost'”.

This is fine. Stricter security is in place. In order to be able to log in you simply create a new privileged user for use with phpmyadmin.

For example, log in from command line as root:

  • sudo mysql -u root -p mysql

and issue commands:

  • CREATE USER ‘phpmyadmin’@’localhost’ IDENTIFIED BY ‘mypassword’;
    GRANT ALL PRIVILEGES ON *.* TO ‘phpmyadmin’@’localhost’ WITH GRANT OPTION;
    FLUSH PRIVILEGES;

Then go back to phpmyadmin Web page and log in as phpmyadmin.


Unable to uninstall MySQL – broken packages

You mess up your MySQL and attempt to remove it completely, but the command

  • apt-get remove mysql-common

fails with the following output:

  • You might want to run ‘apt-get -f install’ to correct these:
    The following packages have unmet dependencies:
    mysql-client-5.7 : Depends: mysql-common (>= 5.5) but it is not going to be installed
    mysql-server : Depends: mysql-server-5.7 but it is not going to be installed

Whatever you do you are stuck and can’t go around this.

If none of the common suggestions works, try this:

  • cd /var/lib
  • mv mysql mysql-old
  • apt install -f

 

[Source] 

 

 


DataTables server side script returns nothing

You may experience a mysterious error when testing DataTables with your own data – the error message says “Invalid JSON response” and when you use Developer Tools of your browser you see that “This request has no response data available”. Still you test server_processing.php and see that data actually are acquired and then passed as a valid array to json_encode() function. But nothing ever is returned. Strange, isn’t it?

The problem actually may be caused by the fact that json_encode() does not work with non-UTF8 data and your database probably contains non-UTF8 characters.

One way to fix it is:

  • Edit ssp.class.php
  • Search for line:
    “mysql:host={$sql_details[‘host’]};dbname={$sql_details[‘db’]}”,
  • Replace it with line:
    “mysql:host={$sql_details[‘host’]};dbname={$sql_details[‘db’]};charset=UTF8”,

 


MySQL: GRANT for creating new user is deprecated

If you will attempt creation of a new user in MySQL with a single command as it used to be common,  you will see the message:

  • Using GRANT for creating new user is deprecated and will be removed in future release. Create new user with CREATE USER statement.

Do what it says. Use the new approach, e.g.:

  • CREATE USER ‘myuser’@’%%’ IDENTIFIED BY ‘mypassword’;
  • GRANT ALL PRIVILEGES ON my_database . * TO ‘myuser’@’%%’;
  • FLUSH PRIVILEGES;

 


MySQL throws import error with TYPE=MyISAM

So you are attempting to import SQL data from an ancient dump file and it fails with an error:

  • You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘TYPE=MyISAM’

This is due to an obsolete syntax. Fixing it may be quite easy. Just open the file in an appropriate text editor,  run search and replace, and save it:

  • search for: TYPE=MyISAM
  • replace with: ENGINE=MyISAM