This is one of those errors that are pretty much undocumented and can lead to a huge waste of time trying to figure it out why, so I’m going to tell you how I fix it and hope that helps you too.
I was trying to add binary data into the database using the save() method on the Model and it keep failing time after time saying:
InvalidArgumentException: Malformed UTF-8 characters, possibly incorrectly encoded in ../vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php
To fix this on Laravel you just need to make sure that you are inserting correctly the information, after a while I realize that I was inserting some truncated data on the table and the exception thrown by Eloquent was catched by the exception handler, and it contained some binary data that was being responded afterwards.
So this is just an error generated because the system was trying to report another previous error, now after the stress it’s gone, it’s kind of funny.
Recently the company that I work for change my Lenovo T440 with Ubuntu 16.04 for a MacBook Air with macOS and although I never really liked Mac (Too expensive for the specs provided) I loved the change but there are several differences that, when it comes to web development, I need to take in account, so I just installed a local Ubuntu 16.04 server with VirtualBox to test my work before to put it out.
To avoid having to pull the source code each time I just wanted to share the development folder with the guest machine and in order to do that we need to make the following steps
Install the VirtualBox Guest Additions in the guest
Sometimes you need to proxy your traffic over a server in order to pass certain firewall rules, and/or geographic restrictions on some websites, configuring SQUID on your own droplet it’s very useful to solve this kind of needs, and the installation it’s pretty straight forward
For some reason I always forget which parameters needs to be used in each one of those cases, so, I’m going to put this information in this post until it burns in my brain.
Extract a tar.bz2 file or a tar.bz
tar -xvjf your_file.tar.bz2
Extract a tar.gz
tar -xvzf your_file.tar.gz
There are several commands that you can use in order to know details of the network traffic of your server.
In order to use the fingerprint reader to login and to avoid password on sudo you just need to install the fprint library
sudo apt install libpam-fprintd
Then you just need to register your fingerprints with the command
For SQLite there is a table named SQLITE_SEQUENCE with all the auto incremental values of the tables, so you need to update the value.
UPDATE SQLITE_SEQUENCE SET seq = [starting_number] WHERE name = '[table_name]';
Just change [starting_number] for the desired initial auto increment and [table_name] for the name of the table to update