Sélectionner une page
LARAVEL erreur de migration SQLSTATE[42000]

LARAVEL erreur de migration SQLSTATE[42000]

Hello,

si lors de la création de votre nouveau projet Laravel, et notamment lorsque vous souhaitez créer les tables de votre base de données via artisan en ligne de commande, vous rencontrez le message suivant :

In Connection.php line 458:

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

C’est que vous êtes probablement sous MariaDB ou bien sous MySQL version inférieur à 5.7.7

Depuis la version 5.4 de Lavarel, le charset par défaut est utf8mb4 qui permet de stocker les emojis 💩

Pour résoudre ce soucis en conservant votre configuration serveur, la solution est toute simple :

Dans votre projet Lavarel, rendez-vous dans le fichier app/Providers/AppServiceProvider.php et ajoutez les deux lignes suivantes :

use Illuminate\Support\Facades\Schema;
au niveau de l’en-tête du fichier comme suit :
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
et
Schema::defaultStringLength(191);
dans la fonction public « boot » pour définir une longueur de caractère par défaut, comme suit :
public function boot()
{
//
Schema::defaultStringLength(191);
}
Et voilà ça marche !
migration artisan en ligne de commande
Résoudre « OSError: libespeak.so.1: cannot open shared object file: No such file or directory »

Résoudre « OSError: libespeak.so.1: cannot open shared object file: No such file or directory »

Que faire quand on programme avec Pyttsx et qu’on a un problème avec libespeak.so?

En travaillant sur un petit projet qui me permettrait de faire parler mon Rasberry Pi 3, je me suis penché ce que me permettait de faire python en la matière.

C’est grâce à la bibliothèque Pyttsx, que vous pouvez faire parler votre petit ordinateur.

Alors voici le code source du petit programme en question (à exécuter avec Python2 et non Python3) que j’ai récupéré depuis le net et modifié :

import pyttsx
engine = pyttsx.init()
engine.setProperty(‘rate’, 70)

voices = engine.getProperty(‘voices’)
for voice in voices:
print (« Using voice: », repr(voice))
engine.setProperty(‘voice’, voice.id)
engine.say(« Hey! Do you want to make music with you phone ? »)
engine.say(« so download Shyne in your iphone at GoShyne.com »)
engine.runAndWait()

Quant je lançais le code avec Python3 rien ne fonctionnait, normal: pyttsx n’a pas été porté sur la version 3 de python.

Donc en lançant le script avec Python2, j’ai eu le message d’erreur suivant :

OSError: libespeak.so.1: cannot open shared object file: No such file or directory

Le problème n’était pas résolu même en installant pyttsx avec pip, c’est donc après quelques recherches que j’ai pu trouver la solution à mon problème.

Pour résoudre le problème de bibliothèque partagée quand on souhaite utiliser pyttsx il suffit d’exécuter la commande suivante :

sudo apt-get install espeak

Donc voilà le fin mot du problème, pour faire de la synthèse vocale avec Python, il faut pyttsx mais en plus il vous faudra installer Espeak sur votre système.

J’espère que ça vous aidera, n’hésitez pas à partager !

 

 

Authentic life sources: podcasts, books, videos, articles

Authentic life sources: podcasts, books, videos, articles

To be authentic is, I guess, the best challenge in someone’s life. It’s not so easy to express yourself honestly. But it’s worth it, for you and for the world.

To do so, (in fact we can say when you are authentic you never do, you only be, and all the things you do is only a consequence of who you truly are), I have some great sources (Podcasts, blogs, books etc.)

I share with you some of them:

OutlierMagazine.co : It’s a great podcast about people (most of them are entrepreneurs) who decided to realize their dream, sometimes despite their fear, their doubts etc. They talk about their path, the choices they made, what they achieve professionally and personally. With each interview you have a takeaway. Even if you don’t like podcast, you can read the itws 😉

I recommend you the very inspiring interview of Ray Buttars: “Find permission to live

Because, if you want to be authentic, you cannot content yourself reading/listening to/watching mainstream media, trends and so on. You have to admit that your vision, like life itself, is constantly evolving, and your education and mainstream media cannot lead you to freedom. You must have other kind of information, this is why I personally recommend Collectiv Evolution, and the Mind Unleashed

I recommend CBS News Investigative Journalist Explains How Mainstream Media Brainwashes The Masses , 10 Movies That Could Change Your Understanding Of Life And Music is Medicine and More Effective Than Drugs at Managing Pain

Seth Godin sends you daily (very) short blog posts about personal thoughts and tips on life and work:

I recommend you his (for today) last post about empathy: http://sethgodin.typepad.com/seths_blog/2015/08/empathy.html
“… if you want to know why someone does what they do, start with what they know, what they believe and where they came from…”

Jiddu Krishnamurti, was …. well I don’t know how to qualify him (is it useful), I would say he is the most authentic person I know (ok I don’t know him personally and he past away).

Watch this video below (with french subtitles) and if you want to know more about him, a lot of books were publish based on his public talks.

I recommend you the book “Commentaries on Living
“Sorrow has to be understood and not ignored. To ignore it is to give continuity to suffering; to ignore it is to escape from suffering. To understand suffering needs an operational, experimental approach. To experiment is not to seek a definite result. If you seek a definite result, experiment is not possible. If you know what you want, the going after it is not experimentation. If you seek to get over suffering, which is to condemn it, then you do not understand its whole process; when you try to overcome suffering, your only concern is to avoid it. To understand suffering, there must be no positive action of the mind to justify or to overcome it: the mind must be entirely passive, silently watchful, so that it can follow without hesitation the unfolding of sorrow. Mind cannot follow the story of sorrow if it is tethered to any hope, conclusion or remembrance. To follow the swift movement of what is, the mind must be free; freedom is not to be had at the end, it must be there at the very beginning. « What is the meaning of all this sorrow?’’

Because to be able to understand this world and to take action you need a balance between the right information and silence, you need to meditate and there are a lot of ways to meditate : walk (just walk, without thinking, just observing what’s surrounding you), observe your thoughts or your breath, etc…

The key in meditation is observation. And you can say you don’t have time to meditate, but maybe you can consider meditation like an activity and you need to schedule in your todo list. That’s ok. But you can meditate everywhere, so personally, I meditate everyday when I lay down on my bed, and finally I fall asleep and that’s ok 🙂 Give it a try!

Of course, sometime I am too exhausted and I simply sleep and that’s fine, it’s not a competition and you don’t do it for anyone else but you. And remember, you need both, silence and information.

Too much information without practice is useless and it’ll increase thoughts in your brain and finally you won’t find balance and authenticity.

In the end of your life, when you’ll look back to see what happened, you’ll realize that the choices you made were the expression of who you were at this moment, and you won’t have regrets because you’ll understand that people (and you) do what they do along their understanding of the moment.

Understanding this fact, leads you to see life in a better way.

You’ll become wiser. You’ll be authentic. You’ll be your own master and your own student.

If you want to share some of your best sources you use in your journey, don’t be shy and share them in the comment section below!

Originally Posted on medium