The Coder's Breakfast2022-11-22T14:44:11+01:00Olivier Croisierurn:md5:7bccc57fa40daaa0bbb47c16f3d66529DotclearNotes de révision Springurn:md5:e60b815379ba9978505a846fb12fe4342020-09-01T22:03:00+02:002020-09-01T22:03:00+02:00Olivier CroisierArticlesspring <p>J'ai retrouvé dans mes archives mes notes de révision pour la certification Spring Developer, et j'ai pensé que cela pourrait vous intéresser. Je vous mets le document en pièce jointe.
Certes, il s'agissait de Spring 2.5 à l'époque, mais tous les concepts sont encore valides, en particulier si vous intervenez sur un projet Spring "brut" (non-Boot).... <a href="http://thecodersbreakfast.net/index.php?post/2020/09/01/Notes-de-revision-certification-Spring"><em>Lire</em> Notes de révision Spring</a></p>http://thecodersbreakfast.net/index.php?post/2020/09/01/Notes-de-revision-certification-Spring#comment-formhttp://thecodersbreakfast.net/index.php?feed/atom/comments/368Book review : Learning Neo4j 3.xurn:md5:eb46f06ec01d9d298e18d29adaf10b5c2017-11-28T07:00:00+01:002017-11-28T09:43:03+01:00Olivier Croisierneo4j<p><img src="https://images-na.ssl-images-amazon.com/images/I/51b1QkSDv%2BL._SL500_AA130_.jpg" alt="" style="float:right; margin: 0 0 1em 1em;" />
Neo4j is a graph database. <br />
I never had the chance to actually use it, but it was on my watch list for a while, so <a href="https://www.amazon.com/Learning-Neo4j-3-x-Jerome-Baton/dp/1786466147">this book</a> by <a href="https://twitter.com/wadael">Jérôme Baton</a> came as an excellent opportunity to lean more about it.</p>
<p>You know that I read a lot of technical docs in general, and books in particular. I have lots of them. But I'm often left frustrated because they don't cover much more than the official docs, or only explain the hows instead of the whys.</p>
<p>But this one came as a good surprise, and I enjoyed it. <br />
Jérôme Baton, the main author, is obviously a very experienced Neo4j user. The book is technically dense, with lots of pragmatic tips and examples. Furthermore, I found it entertaining and easy to read, and I completed it in about a week of short studying sessions.</p>
<p>This said, retrospectively, the order of some chapters seemed quite illogical to me, so I'll group them by topic below, rather than book ordering.
Now let's start the review.</p>
<p><em>Disclaimer : a copy of this book was sent to me for review by the authors. But if you are a seasoned follower of this blog, you know that I say what I really think !</em></p> <p>Book review
Chapter 1 is the obligatory introduction to graph databases : historical examples, basics of graph theory, and comparison with others SQL or NoSQL databases.
Chapter 2 guides you in a very beginner-friendly way through the database installation process (with many screenshots), on Windows, Mac and Linux, and even on Docker if you... <a href="http://thecodersbreakfast.net/index.php?post/2017/11/28/Book-review-Learning-Neo4j"><em>Lire</em> Book review : Learning Neo4j 3.x</a></p>http://thecodersbreakfast.net/index.php?post/2017/11/28/Book-review-Learning-Neo4j#comment-formhttp://thecodersbreakfast.net/index.php?feed/atom/comments/367La SASU en chiffresurn:md5:3a884745ef700346e8354702dfaf9cf22017-08-08T16:32:00+02:002017-11-28T10:30:32+01:00Olivier CroisierDivers <p>Lorsque je dis que je travaille en indépendant, on me fait souvent remarquer que je dois mieux gagner ma vie que quand j'étais salarié.
Après tout, si on prend mon TJM, qu'on le multiplie par, mettons, 20 jours par mois, je retiens un et j'ajoute l'âge du capitaine... Je dois être millionnaire, non ?
Je me retrouve alors à expliquer les flux... <a href="http://thecodersbreakfast.net/index.php?post/2017/08/08/La-SASU-en-chiffres"><em>Lire</em> La SASU en chiffres</a></p>http://thecodersbreakfast.net/index.php?post/2017/08/08/La-SASU-en-chiffres#comment-formhttp://thecodersbreakfast.net/index.php?feed/atom/comments/366DevoxxFR 2017 - Twisted Javaurn:md5:66ee83e908b74cb57cc7c3edf427be292017-04-14T16:00:00+02:002017-05-12T09:19:21+02:00Olivier CroisierCommunauté <p>Voici en pièce jointe les slides de mon quickie "Twisted Java", qui a apparemment suscité beaucoup d'intérêt chez les développeurs désireux de troller leurs collègues soucieux d'améliorer la lisibilité de leur code.
Bonne lecture, et n'en abusez pas :)... <a href="http://thecodersbreakfast.net/index.php?post/2017/04/14/DevoxxFR-2017-Twisted-Java"><em>Lire</em> DevoxxFR 2017 - Twisted Java</a></p>http://thecodersbreakfast.net/index.php?post/2017/04/14/DevoxxFR-2017-Twisted-Java#comment-formhttp://thecodersbreakfast.net/index.php?feed/atom/comments/365DevoxxFR 2017 - Log me tenderurn:md5:95d8c911a982cc1898849fc60c46ef6f2017-04-11T07:00:00+02:002017-05-12T09:19:21+02:00Olivier CroisierCommunautéarchitecturecommunautéjava <p>Voici (en pièce jointe du billet) les slides de ma conférence "Log me tender", présentée à DevoxxFR 2017.
Gros succès du sujet (le grand amphi était plein), et beaucoup de questions après. Comme quoi, en 2017, le problème des logs n'est toujours pas résolu !
Bonne lecture !... <a href="http://thecodersbreakfast.net/index.php?post/2017/04/10/DevoxxFR-2017-Log-me-tender"><em>Lire</em> DevoxxFR 2017 - Log me tender</a></p>http://thecodersbreakfast.net/index.php?post/2017/04/10/DevoxxFR-2017-Log-me-tender#comment-formhttp://thecodersbreakfast.net/index.php?feed/atom/comments/364Spring MVC : Développer un convertisseur personnaliséurn:md5:f16d98f121f14de190f67cb9ba8252e12017-02-28T07:00:00+01:002017-03-07T22:27:40+01:00Olivier CroisierArticlesjavaspring<p>La modélisation d'une API REST permettant de gérer une ressource naturellement arborescente pose un problème technique intéressant.</p>
<p>Pour l'exemple, imaginons une API permettant de lire les métadonnées (taille, date d'accès...) d'un fichier sur disque, identifié par son chemin.<br />
Selon la logique RESTful, l'URI associée au fichier <code>foo/bar/baz.txt</code> doit être <code>http://<server:port>/file/foo/bar/baz.txt</code>, et le <em>endpoint</em> Spring MVC associé mappé comme ceci :</p>
<pre class="brush: java">@GetMapping("/file/{path}")
public HttpEntity<FileInfo> fileInfo(@PathVariable("path") String path) {
return filesystemDao.getFileInfo(path);
}</pre>
<p>Problème : Spring MVC ne sait pas capturer les fragments d'URL (@PathVariable) contenant des "slash" <a href="https://jira.spring.io/browse/SPR-12546" title="SPR-12546"></a>, même encodés en <code>%2F</code>.</p>
<p>En réfléchissant plus avant, on s'aperçoit que les "slash" ne sont pas les seuls caractères pouvant poser problème : les noms des répertoire et fichiers sont autorisés à contenir des caractères incompatibles avec les URLs. Il nous faut donc encoder tout le chemin, mais, à cause du bug indiqué plus haut, un simple "urlencode" ne suffit pas.<br />
We need a bigger boat.</p> <p>Encode all the things !
Un encodage qui élimine les caractères spéciaux et les slashes... et pourquoi pas Base64 ?
Le très problématique chemin foo/bar/baz.txt devient alors http://<server:port>/file/L2Zvby9iYXIvYmF6LnR4dA - plus de problèmes !
Côté client, Javascript fournit la méthode btoa, employée ci-dessous dans un service Angular... <a href="http://thecodersbreakfast.net/index.php?post/spring-mvc-developper-convertisseur-personnalise"><em>Lire</em> Spring MVC : Développer un convertisseur personnalisé</a></p>http://thecodersbreakfast.net/index.php?post/spring-mvc-developper-convertisseur-personnalise#comment-formhttp://thecodersbreakfast.net/index.php?feed/atom/comments/363ExceptionContext : trying to improve business exceptionsurn:md5:bf7e449251a501324ee821991de2c87a2016-08-08T07:00:00+02:002016-08-10T11:33:33+02:00Olivier CroisierArticlesjava<p>In "corporate" projects, exceptions are often categorized as <code>TechnicalExceptions</code> and <code>BusinessExceptions</code>.</p>
<p>As technical exceptions usually have a wide application range (eg. <code>DataAccessException</code>s), their stacktraces help finding out the exact technical context in which they occurred.</p>
<p>However, for business exceptions, which are often more specific (eg. <code>AuthenticationException</code>) and whose origin in the code is well known, stacktraces are usually useless - but still expensive to generate. What would be more interesting though, is the _business context_ in which they occurred ; for example, knowing that the system failed while processing order #42's payment as part of the daily book-keeping batch is an important information.</p> <p>How it works
To achieve this, a "business context stack" needs to be maintained, on which business-related informations can be pushed and popped as the business processes are respectively started and terminated. This is the role of the BusinessContext class, loosely inspired from Log4J's MDC and Spring Security's SecurityContextHolder.
public... <a href="http://thecodersbreakfast.net/index.php?post/2016/08/08/ExceptionContext-%3A-trying-to-improve-business-exceptions"><em>Lire</em> ExceptionContext : trying to improve business exceptions</a></p>http://thecodersbreakfast.net/index.php?post/2016/08/08/ExceptionContext-%3A-trying-to-improve-business-exceptions#comment-formhttp://thecodersbreakfast.net/index.php?feed/atom/comments/362Enigmatiques lambdasurn:md5:22db989193dab878d255b68369278ade2015-09-03T07:00:00+02:002015-09-15T00:19:43+02:00Olivier CroisierArticlesjava<p>Tout a commencé sur Twitter, lorsque Jean-Christophe Sirot (<a href="https://twitter.com/jcsirot">@jcsirot</a> / <a href="http://www.coding-stories.com/">Coding Stories)</a> m'apostrophe à propos d'un étrange problème de compilation d'une lambda.</p>
<p>Pourquoi ce code compile-t-il...</p>
<pre class="java code java" style="font-family:inherit"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Test <span style="color: #009900;">{</span>
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> s<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">public</span> Test<span style="color: #009900;">(</span><span style="color: #003399;">String</span> s<span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">s</span> <span style="color: #339933;">=</span> s<span style="color: #339933;">;</span>
<span style="color: #009900;">}</span>
<span style="color: #000000; font-weight: bold;">public</span> Consumer<span style="color: #339933;"><</span>String<span style="color: #339933;">></span> c <span style="color: #339933;">=</span>
<span style="color: #009900;">(</span>x<span style="color: #009900;">)</span> <span style="color: #339933;">-></span> <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">(</span>x <span style="color: #339933;">+</span> <span style="color: #0000ff;">"/"</span> <span style="color: #339933;">+</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">s</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="color: #009900;">}</span></pre>
<p>...alors que celui-là refuse ?</p>
<pre class="java code java" style="font-family:inherit"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Test <span style="color: #009900;">{</span>
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> s<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">public</span> Test<span style="color: #009900;">(</span><span style="color: #003399;">String</span> s<span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">s</span> <span style="color: #339933;">=</span> s<span style="color: #339933;">;</span>
<span style="color: #009900;">}</span>
<span style="color: #000000; font-weight: bold;">public</span> Consumer<span style="color: #339933;"><</span>String<span style="color: #339933;">></span> c <span style="color: #339933;">=</span>
<span style="color: #009900;">(</span>x<span style="color: #009900;">)</span> <span style="color: #339933;">-></span> <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">(</span>x <span style="color: #339933;">+</span> <span style="color: #0000ff;">"/"</span> <span style="color: #339933;">+</span> s<span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="color: #009900;">}</span></pre> <p>La différence semble subtile : l'un référence directement le champ "s", quand l'autre explicite l'accès via this.
Premiers tests
Rapidement, José Paumard (@JosePaumard) signale que le compilateur d'Eclipse réussit à compiler les deux classes.
Mais Eclipse utilise un compilateur maison, qui n'a pas forcément le même comportement que celui... <a href="http://thecodersbreakfast.net/index.php?post/2015/09/02/Enigmatiques-lambdas"><em>Lire</em> Enigmatiques lambdas</a></p>http://thecodersbreakfast.net/index.php?post/2015/09/02/Enigmatiques-lambdas#comment-formhttp://thecodersbreakfast.net/index.php?feed/atom/comments/360Conférence : Hashons peu, mais hashons bienurn:md5:2d015c21865c67e8b02d86b49bf4a7d72015-05-26T07:00:00+02:002015-05-26T07:00:00+02:00Olivier CroisierCommunautécommunautédevoxxjava <p>La vidéo de la conférence "Hashons peu, mais hashons bien" , que j'ai présentée à Devoxx France 2015 avec Olivier Bourgain, est désormais visible gratuitement sur Parleys !
En 40 minutes, découvrez ce que sont les fonctions de hachage, à quoi elle servent, et comment les Maps en tirent parti dans le JDK. Avec en bonus, des histoires de parkings,... <a href="http://thecodersbreakfast.net/index.php?post/2015/05/26/Conference-Hashons-peu-mais-hashons-bien"><em>Lire</em> Conférence : Hashons peu, mais hashons bien</a></p>http://thecodersbreakfast.net/index.php?post/2015/05/26/Conference-Hashons-peu-mais-hashons-bien#comment-formhttp://thecodersbreakfast.net/index.php?feed/atom/comments/359Dernières nouvelles du Front #1urn:md5:d6287ce494ed12f43b0feb5acaa2df542015-05-18T07:00:00+02:002015-05-18T07:00:00+02:00Hadrien PierartWebdevjavascript<h3>Préface</h3>
<p>Comme indiqué dans un précédent billet, je tente l'ouverture du blog à des auteurs externes, de jeunes développeurs brillants et sélectionnés avec soin.<br />
Ils apporteront leur expertise et un point de vue décalé sur des sujets que je ne traite pas habituellement.</p>
<p>Je vous présente aujourd'hui <a href="https://www.hopwork.com/profile/hadrienpierart">Hadrien Pierart</a>, freelance au parcours atypique, spécialisé dans le développement front (web et Android). <br />
Hadrien tiendra notamment une rubrique récurrente intitulée "Dernières nouvelles du Front", inspirée des célèbres Javascript Weekly et HTML5 Weekly, dont voici le premier numéro.</p>
<p>Bonne lecture !<br />
Olivier</p>
<h3>Dernières nouvelles du Front #1</h3>
<p>Quelques mots sur moi pour cette première édition : historiquement développeur Java Android, je me suis rapidement mis au développement web et plus particulièrement JavaScript. Comme on ne peut rarement tout faire, j'ai choisi de me concentrer principalement sur le web, les webperfs et le développement fullstack avec une nette préférence pour le front et une passion pour ce langage atypique qu'est le JS.</p>
<p>Je suis freelance comme Olivier et je travaille actuellement pour une startup nommée <a href="https://getonce.com/">Once</a>. <br />
Enfin je suis aussi Editor pour infoQ FR.</p>
<p>Pour résumer cette édition, je vais vous parler de plugins grunt, de nouveautés ou fonctionnalités cachées des DevTools de Chrome, de convention de code en CSS et un peu de JS bashing pour finir. (Ca fait toujours sourire, même pour un grand adepte comme moi)</p> <p>Outils et Process
grunt-ssh : Intégration de tâches SSH et SFTP dans le build grunt.
grunt-autoprefixer : Ecrivez votre SCSS/LESS/CSS sans vous soucier des préfixes.(Basé sur Can I Use)
grunt-babel : Codez en Ecmascript 6, il compile en ES5 pour vous. Output très propre !
grunt-spritesmith : Génère vos sprites d'images et le CSS pour y accéder.... <a href="http://thecodersbreakfast.net/index.php?post/2015/05/18/Dernieres-nouvelles-du-front-1"><em>Lire</em> Dernières nouvelles du Front #1</a></p>http://thecodersbreakfast.net/index.php?post/2015/05/18/Dernieres-nouvelles-du-front-1#comment-formhttp://thecodersbreakfast.net/index.php?feed/atom/comments/357