<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Posts on Laïla Atrmouh</title>
        <link>/en/posts/</link>
        <description>Recent content in Posts on Laïla Atrmouh</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language>
        <copyright>&lt;a href=&#34;https://creativecommons.org/licenses/by-nc/4.0/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;CC BY-NC 4.0&lt;/a&gt;</copyright>
        <lastBuildDate>Wed, 25 Mar 2026 10:14:15 +0000</lastBuildDate>
        <atom:link href="/en/posts/index.xml" rel="self" type="application/rss+xml" />
        
        <item>
            <title>Migrating from Chakra v2 to Chakra v3</title>
            <link>/en/posts/2026/03/migrating-from-chakra-v2-to-chakra-v3/</link>
            <pubDate>Wed, 25 Mar 2026 10:14:15 +0000</pubDate>
            
            <guid>/en/posts/2026/03/migrating-from-chakra-v2-to-chakra-v3/</guid>
            <description>Migrating to Chakra v3 turned out to be a pretty substantial upgrade.</description>
            <content type="html"><![CDATA[<h2 id="context">Context</h2>
<p>Chakra is a React component library with a strong focus on accessibility.</p>
<p>I&rsquo;ve been using it since 2022 for <em>Acupio</em>, my side project for managing patients for acupuncturists, which I already talked about <a href="https://leiluspocus.netlify.app/fr/posts/2025/05/retour-dexp%C3%A9rience-migration-vers-vite-et-suppression-de-create-react-app/">here</a>.</p>
<p>All patients followed by a practitioner were displayed on a single page, with the ability to filter by name. When no input was provided, all patients were shown.</p>
<p>I recently passed the 500-patient mark for one practitioner in the app&hellip; Performance was starting to become a real concern.</p>
<p>That’s when I discovered a <a href="https://chakra-ui.com/docs/components/pagination">Chakra pagination component</a>, which was perfect for this use case.</p>
<p>Problem: it was only available in Chakra v3. It was definitely time to tackle this upgrade.</p>
<h2 id="what-does-chakra-v3-bring">What does Chakra v3 bring?</h2>
<p>The <a href="https://www.chakra-ui.com/docs/get-started/migration#improvements">official migration guide</a> is very comprehensive, a lot has changed.</p>
<ul>
<li>Improved rendering performance thanks to a new styling system</li>
<li>Better TypeScript type inference</li>
<li>Polymorphism improvements with the <code>asChild</code> pattern</li>
</ul>
<p>In this article, I&rsquo;ll focus on what was the most challenging for me: adopting the <em>Compound Pattern</em>.</p>
<h2 id="paradigm-shift--compound-pattern">Paradigm shift – Compound Pattern</h2>
<p>Chakra v3 generalizes the use of the <a href="https://www.patterns.dev/react/compound-pattern/">Compound Pattern</a> across many components, which forced me to rewrite most of my components.</p>
<blockquote>
<p>In an application, some components are inherently tied together. For example, a <code>&lt;DialogContent&gt;</code> component is meant to be used inside a <code>&lt;Dialog&gt;</code>. These are separate components, but they are closely related. The Compound Pattern allows you to structure them as independent yet strongly connected pieces.</p>
</blockquote>
<p>I was using components like Drawer, Modal, and tables - all of which were impacted by this shift. I had to refactor them accordingly.</p>
<p><img alt="Git Diff on a table" src="/img/git-diff-table-chakra-v2-v3.png">
<em>Before / after on a table. A Td is becoming a Table.Cell, a Tr is becoming a Table.Row</em></p>
<p>It&rsquo;s not that complex, but the impact is on every component of my app. I naturally thought about using AI to help with this boring task. Isn’t that exactly the kind of use case AI is supposed to help with?</p>
<p><img alt="Sweet summer child GIF" src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExZXc3cnJ4NTRzaGhzOWp6N3k1NmYwbmY2aTM4dWR3Y2EwMHRpNjZ0ciZlcD12MV9naWZzX3NlYXJjaCZjdD1n/D2kFkQwMzFcVq/giphy.gif"></p>
<h2 id="using-ai-for-refactoring">Using AI for refactoring</h2>
<p>My relationship with AI is&hellip; cautious.</p>
<p>Back in 2023, I used ChatGPT like many people - I looked into how it worked, but didn’t go much further in integrating it into my daily workflow.</p>
<h3 id="refactoring-with-ai-the-wrong-way-switching-between-ide-and-llms">Refactoring with AI the wrong way: switching between IDE and LLMs</h3>
<p>I first tried copy-pasting one of my templates into a Claude conversation and asked it to migrate the component to Chakra v3.</p>
<p>The suggestions didn&rsquo;t compile, which makes sense since it didn’t have access to my full codebase.</p>
<p>I discussed this on the Ladies of Code Paris Slack, and one of our members (hi Sara!) suggested starting with smaller components instead of full pages.</p>
<p>Since I use an Atomic Design approach, this was easy to apply. It gave me more control over the changes.</p>
<p>It worked better, but constantly switching between my browser (Claude) and my IDE was frustrating. I often forgot to provide necessary files.</p>
<h3 id="using-cursor-agents-for-refactoring">Using Cursor agents for refactoring</h3>
<p>Agents make those back-and-forths obsolete.</p>
<p>They can directly apply changes within your IDE through a chat interface — even on the free plan.</p>
<p>For example, I had several views with date filters across different pages.</p>
<p><img alt="Period Picker Component" src="/img/period-picker.png"></p>
<p>Instead of duplicating that logic, I decided to extract it into a reusable component using a Cursor agent with this prompt:</p>
<blockquote>
<p>I want you to extract this date filter into a component called PeriodPicker. Place it in the components &gt; organisms folder. The PeriodPicker component should allow selecting a given time period. It should be used in the StatsScreen and UrssafDeclaration components. Thanks.</p>
</blockquote>
<p>The advantage of using an agent is that you can review the changes like a pull request from a teammate.</p>
<p>Being precise in your prompt is key. Taking an atomic approach helps avoid overly complex changes that are hard to debug later.</p>
<h2 id="how-long-does-a-chakra-v2-to-chakra-v3-migration-take">How long does a Chakra v2 to Chakra v3 migration take?</h2>
<p>This migration went more smoothly than I expected.</p>
<p>It only took me a few days, whereas I initially thought it would take several weeks.</p>
<p>I even considered switching libraries altogether, given the expected effort.</p>
<p>I only started using AI agents towards the end. In hindsight, I think I could have saved time by using them earlier — starting with the smallest components.</p>
<p>From what I’ve seen on <a href="https://www.reddit.com/r/reactjs/comments/1j2f1i0/is_chakra_ui_v3_still_relevant_migration_from/">Reddit</a>, many developers have stopped using Chakra because of this major upgrade.</p>
<h2 id="preparing-your-migration-to-chakra-v3">Preparing your migration to Chakra v3</h2>
<p>Structuring my project with Atomic Design principles was extremely helpful once again.</p>
<p>I was able to start with the smallest building blocks and gradually move up to larger components and screens.</p>
<p>In the end, the migration only took a few days.</p>
<p>If I had to give advice to someone considering this upgrade:</p>
<ul>
<li>Review the migration guide to identify removed components and estimate the workload</li>
<li>If possible, don’t do it alone</li>
<li>Use AI agents to assist you : start small, then scale up progressively</li>
</ul>
<p>Good luck :)</p>
]]></content>
        </item>
        
        <item>
            <title>TIL 1</title>
            <link>/en/posts/2020/05/til-1/</link>
            <pubDate>Tue, 26 May 2020 20:14:34 +0200</pubDate>
            
            <guid>/en/posts/2020/05/til-1/</guid>
            <description>&lt;p&gt;I redesigned my blog. Again.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve been blogging for 8 years so far and boy, this blog has travelled.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Simple HTML files hosted in a French server (Free) 👵🏼&lt;/li&gt;
&lt;li&gt;Wordpress hosted by 1&amp;amp;1&lt;/li&gt;
&lt;li&gt;Jekyll hosted on Github Pages&lt;/li&gt;
&lt;li&gt;Gatsby hosted on Github Pages&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Today, this blog is powered by Hugo and hosted by Netlify. And, of course, even though I played with plenty of cool tools, I didn&amp;rsquo;t write articles.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<p>I redesigned my blog. Again.</p>
<p>I&rsquo;ve been blogging for 8 years so far and boy, this blog has travelled.</p>
<ul>
<li>Simple HTML files hosted in a French server (Free) 👵🏼</li>
<li>Wordpress hosted by 1&amp;1</li>
<li>Jekyll hosted on Github Pages</li>
<li>Gatsby hosted on Github Pages</li>
</ul>
<p>Today, this blog is powered by Hugo and hosted by Netlify. And, of course, even though I played with plenty of cool tools, I didn&rsquo;t write articles.</p>
<figure><img src="https://media.giphy.com/media/b55x0VFpFKm7S/giphy.gif?center">
</figure>

<p>Inspired by a popular series of articles in my previous company <a href="https://www.madmoizelle.com/rubriques/pour-rire/trouvailles-dinternet-pour-bien-commencer-la-semaine">trouvailles de madmoiZelle</a>, I decided to write an article every month, listing all the discoveries I made. And also some random stuff that makes me laugh online.</p>
<p>Why ?</p>
<ol>
<li>Easier to find links on my blog than on my twitter feed</li>
<li>Keeps me motivated to write</li>
<li>Helps me improve my english</li>
</ol>
<p>TIL stands for Things I&rsquo;ve Learned by the way.</p>
<p>Let&rsquo;s go !</p>
<h2 id="front">Front</h2>
<p>During the coronavirus confinement, I decided to help the nonprofil Descodeuses as a mentor. I helped women who want to become web developers and it made me do more frontend development than usual, and discover stuff I didn&rsquo;t know.</p>
<p>IntersectionObserver API provides a way to detect collision of two DOM elements. Its performance is better than having to play with scroll / onResize. Here&rsquo;s a codepen I played with: <a href="https://codepen.io/leiluspocus/pen/oNjExNg">https://codepen.io/leiluspocus/pen/oNjExNg</a>.</p>
<p>This demo with Rachelle McAndrews helped me preparing my livecoding about CSS Grids with the members of Descodeuses.


    
    <div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
      <iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="allowfullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/g1osnSY9mSU?autoplay=0&controls=1&end=0&loop=0&mute=0&start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"
      ></iframe>
    </div>
</p>
<p>This CSS library can make your HTML document look like a beautiful LateX file <a href="https://latex.now.sh/">https://latex.now.sh/</a></p>
<p>Some &ldquo;no-class&rdquo; CSS frameworks like <a href="https://watercss.kognise.dev/">Water</a> are appearing. Can be useful for MVPs ?</p>
<p>David Walsh made me discover <a href="https://davidwalsh.name/cancel-fetch"><code>AbortController</code> Interface</a> to cancel fetch requests in Javascript.</p>
<h2 id="hugo">Hugo</h2>
<p>As I said earlier, I redesigned my blog using <a href="https://gohugo.io/">Hugo</a> and I love it.
The things I enjoy the most:</p>
<ul>
<li>How <em>fast</em> is the local environement !</li>
<li>Shortcodes you can use in Markdown to integrate tweets, gits, youtube videos&hellip;</li>
<li>How easy you can override the theme</li>
</ul>
<h2 id="devtools">DevTools</h2>
<p>I feel like I&rsquo;m always discovering cool stuff on the Chrome Devtools.</p>
<ul>
<li>
<p>Copy/Paste CSS from the DOM element (Elements panel).
<blockquote class="twitter-tweet"><p lang="en" dir="ltr"><a href="https://x.com/hashtag/DevTools?src=hash&amp;ref_src=twsrc%5Etfw">#DevTools</a> Tip ⚡️ Copy and extract all the CSS for an element on the page<br><br>Right click element &gt; Copy &gt; Copy Styles<br><br>Useful as styles can often be scattered across many selectors! ⭐️ <a href="https://t.co/YHmdxoj9fh">pic.twitter.com/YHmdxoj9fh</a></p>&mdash; Umar Hansa (@umaar) <a href="https://x.com/umaar/status/1263418649286754304?ref_src=twsrc%5Etfw">May 21, 2020</a></blockquote>
<script async src="https://platform.x.com/widgets.js" charset="utf-8"></script>

</p>
</li>
<li>
<p>View dependencies between requests on Network panel
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Tip: In <a href="https://x.com/ChromeDevTools?ref_src=twsrc%5Etfw">@ChromeDevTools</a>, hold shift while hovering over a request and it will highlight the initiator in green and dependencies in red. <a href="https://t.co/Xd9l2BCoC9">pic.twitter.com/Xd9l2BCoC9</a></p>&mdash; Addy Osmani (@addyosmani) <a href="https://x.com/addyosmani/status/1260479896888975362?ref_src=twsrc%5Etfw">May 13, 2020</a></blockquote>
<script async src="https://platform.x.com/widgets.js" charset="utf-8"></script>

</p>
</li>
</ul>
<h2 id="community">Community</h2>
<p>Paola made me discover <a href="https://streamyard.com/">Streamyard</a>, an web app to create livestreams. You can see the result on a meetup with <a href="https://www.youtube.com/watch?v=QGM_kT0KWXA&t=5s">Ladies of Code</a>.</p>
<h2 id="autres">Autres</h2>
<ul>
<li>
<p><a href="https://www.youtube.com/channel/UCFKE7WVJfvaHW5q283SxchA">Yoga With Adrienne</a>
Do I really have to introduce her ? I did the &ldquo;Home&rdquo; challenge, it helped me get through quarantine. I hope keeping the Yoga pace after confinement.</p>
</li>
<li>
<p>FlightRadar24
A flight tracker. Pretty impressive during quarantine !</p>
</li>
</ul>
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Meanwhile at London Heathrow Airport... <a href="https://t.co/yNFtksYEJg">pic.twitter.com/yNFtksYEJg</a></p>&mdash; Flightradar24 (@flightradar24) <a href="https://x.com/flightradar24/status/1266431804803878918?ref_src=twsrc%5Etfw">May 29, 2020</a></blockquote>
<script async src="https://platform.x.com/widgets.js" charset="utf-8"></script>


<p>That&rsquo;s it for May ! Thank you for reading me so far, feel free to share with me your discoveries 🙏</p>
]]></content>
        </item>
        
        <item>
            <title>Docker Cheatsheet</title>
            <link>/en/posts/2018/08/docker-cheatsheet/</link>
            <pubDate>Sat, 25 Aug 2018 19:23:42 +0000</pubDate>
            
            <guid>/en/posts/2018/08/docker-cheatsheet/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Petit article mémo sur Docker&lt;/p&gt;
&lt;h1 id=&#34;getting-started&#34;&gt;Getting Started&lt;/h1&gt;
&lt;p&gt;make sure that client can talk to engine + current version
docker version&lt;/p&gt;
&lt;p&gt;An image is the application we want to run.
A container is an instance of the image running as a process.&lt;/p&gt;
&lt;h1 id=&#34;containers&#34;&gt;Containers&lt;/h1&gt;
&lt;p&gt;docker container run &amp;ndash;publish 80:80 nginx
Left number == Host port. Make sure it&amp;rsquo;s not already used (otherwise bind error)&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>Petit article mémo sur Docker</p>
<h1 id="getting-started">Getting Started</h1>
<p>make sure that client can talk to engine + current version
docker version</p>
<p>An image is the application we want to run.
A container is an instance of the image running as a process.</p>
<h1 id="containers">Containers</h1>
<p>docker container run &ndash;publish 80:80 nginx
Left number == Host port. Make sure it&rsquo;s not already used (otherwise bind error)</p>
<ol>
<li>Pull down &ldquo;nginx&rdquo; image from Docker Hub</li>
<li>Started a new container accessible from that image.</li>
<li>Opened port 80 on the host IP</li>
<li>Routes that traffic to the container IP port 80.</li>
</ol>
<p>Option &ndash;detach =&gt; Run in the background.
docker container run &ndash;detach &ndash;publish 80:80 nginx</p>
<h3 id="list-all-running-containers">List all running containers</h3>
<p>docker container ls == docker ps</p>
<h3 id="nommer-un-container">Nommer un container</h3>
<p>docker container run &ndash;detach &ndash;name LENOM &ndash;publish 13370:80 nginx</p>
<h3 id="voir-les-derniers-logs-dun-container">Voir les derniers logs d&rsquo;un container</h3>
<p>docker container logs nom_container</p>
<h3 id="voir-les-processus-sexécutant-dans-un-container">Voir les processus s&rsquo;exécutant dans un container</h3>
<p>docker container top nom_container</p>
<h1 id="ce-qui-se-passe-quand-on-run-un-container">Ce qui se passe quand on run un container</h1>
<p>Changing the defaults :</p>
<ul>
<li>The listening port on the host</li>
<li>Change version of the image</li>
<li>Change CMD executed when the container runs on start</li>
</ul>
<p>A container is a process running on your host environment system.</p>
<h1 id="run-multiple-containers">Run multiple containers</h1>
<p>docker container run &ndash;detach &ndash;name nginx &ndash;publish 80:80 nginx
docker container run &ndash;detach &ndash;name mysql &ndash;env MYSQL_RANDOM_ROOT_PASSWORD=yes &ndash;publish 3306:3306 mysql
docker container run &ndash;detach &ndash;name httpd &ndash;publish 8080:80 httpd</p>
<h1 id="see-whats-going-on-in-containers">See what&rsquo;s going on in containers</h1>
<p>Process list in one container
docker container top container_name</p>
<h3 id="details-of-one-container-config">Details of one container config</h3>
<p>docker container inspect container_name</p>
<h3 id="performance-stats-for-all-containers">Performance stats for all containers</h3>
<p>docker container stats container_name</p>
<h1 id="getting-a-shell-inside-container">Getting a shell inside container</h1>
<p>docker container run -it
Start new container interactively
T for terminal
I to keep the session open</p>
<p>docker container exec -it
Run additionnal command in a running container</p>
<p>Alpine is smaller than Ubuntu.</p>
<p>Publishing ports is always in HOST:CONTAINER format.</p>
<p>docker container run <!-- raw HTML omitted --> nginx
use nginx:alpine instead !</p>
<h1 id="assignment---cli-app-testing">Assignment - CLI App Testing</h1>
<p>docker container run &ndash;rm -it &ndash;name centos centos:7 bash
curl 7.29</p>
<p>docker container run &ndash;rm -it &ndash;name ubuntu ubuntu:14.04 bash
curl 7.35</p>
<p>docker container run &ndash;detach -it &ndash;name centos centos:7 bash</p>
<h1 id="assignment---round-robin">Assignment - Round Robin</h1>
<p>docker network create round_robin_network</p>
<p>docker container run &ndash;detach &ndash;network round_robin_network &ndash;net-alias search elasticsearch:2</p>
<p>docker container run &ndash;rm &ndash;net round_robin_network alpine nslookup search</p>
<p>docker container run &ndash;rm &ndash;net round_robin_network centos curl -s search:9200</p>
<h1 id="container-images">Container Images</h1>
<p>An image is made of app binaries and dependencies. Metadata about the image data and how to run the image.
Not a complete OS. No kernel, kernel modules. Small as one file (app binary) like golang.
Big as Ubuntu with apt, apache, PHP and more installed.</p>
<h1 id="docker-hub">Docker Hub</h1>
<p>docker pull nginx
docker pull nginx:1.10.11
Always use a specific version to prevent software from updating automatically using latest tag.
Docker Hub = The apt package system for containers
Alpine =&gt; Smaller than counterparts OS.</p>
<h1 id="docker-image-layers">Docker Image Layers</h1>
<p>docker history mysql
View changes on the image.
When we download an image, we start with one layer.
In a dockerfile, we can add more stuff using apt-get or env variables : it adds a new layer everytime.
Each layer is uniquely identified and only stored once on a host. Save storage space.</p>
<p>#Image Tagging and Pushing to Docker Hub.
Images don&rsquo;t have name. We refer to them using repository, tag.
Tag =&gt; Pointer to a specific image commit.</p>
<p>Add tag to existing image: docker image tag SOURCE_IMAGE:TAG TARGET_IMAGE:TAG</p>
<p>docker image push bretfisher/nginx.</p>
<h1 id="dockerfile-basics">Dockerfile basics</h1>
<p>&amp;&amp; =&gt; Make sure these commands are run for one layer.
CMD =&gt; final command that will be run after container is launched or restarted.</p>
<h1 id="running-docker-builds">Running Docker Builds</h1>
<p>At the top =&gt; things that change the least
At the bottom =&gt; things that change the most</p>
<h1 id="extending-official-images">Extending official images</h1>
<p>WORKDIR =&gt; cd pour se placer dans un répertoire.</p>
<h1 id="assignment-build-your-own-image-with-a-dockerfile">Assignment: Build Your Own Image with a Dockerfile</h1>
<p>Dockerfile are part process workflow and part art.
docker image build -t node-app .
docker container run -p 3000:80 &ndash;rm node-app</p>
<h1 id="container-lifetime-and-persistent-data">Container Lifetime and Persistent Data</h1>
<p>Containers are usually immutable and ephemeral. Temporary and disposable.
Volumes need manual deletion.</p>
<p>Use friendly name for volumes to see which volumes is attached to which container.
docker container run -d &ndash;name mysql -e MYSQL_ALLOW_EMPTY_ROOT_PASSWORD=true -v mysql-database:/var/lib/mysql mysql</p>
<p>If we need to specify the driver, we need to create the volume ahead of container creation.</p>
<p>Partager dossier courant pour live modifs
docker container run -d &ndash;name nginx -p 80:80 -v $(pwd):/usr/share/nginx/html nginx</p>
<h2 id="assignment---named-volumes">Assignment - Named Volumes</h2>
<p>docker container run -d &ndash;name postgres -v pgsql-data:/var/lib/postgresql/data postgres:9.6.1</p>
<p>docker container logs postgres</p>
<p>docker container stop postgres</p>
<p>docker container run -d &ndash;name postgres2 -v pgsql-data:/var/lib/postgresql/data postgres:9.6.2</p>
<h2 id="assignment---bind-mounts">Assignment - Bind Mounts</h2>
<p>Super cool for local development.</p>
<p>docker run -p 80:4000 -v $(pwd):/site bretfisher/jekyll-serve</p>
<h1 id="docker-compose">Docker Compose</h1>
<p>Configure relationships between containers
Save our docker container run settings in easy-to-read file. Create one-liner developer environment startups.</p>
<p>We specify in that file the containers we need to run &hellip;</p>
<h2 id="docker-composeyml">docker-compose.yml</h2>
<p>depends_on : explique les dépendances entre containers au yaml</p>
<p>docker-compose up # setup volumes networks and start all containers</p>
<p>docker-compose down # stop all containers and remove containers / volumes / networks</p>
<p>docker-compose logs to see logs, -d detach to run in background.</p>
<p>docker-compose ps , top, down.</p>
<h1 id="assignment---writing-a-compose-file">Assignment - Writing a compose file</h1>
<p>use the service name as the DNS name. localhost won&rsquo;t work. use name.
Volumes are never removed automatically.</p>
]]></content>
        </item>
        
        <item>
            <title>rm Argument list too long</title>
            <link>/en/posts/2018/08/rm-argument-list-too-long/</link>
            <pubDate>Wed, 01 Aug 2018 16:22:48 +0000</pubDate>
            
            <guid>/en/posts/2018/08/rm-argument-list-too-long/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You can use this command :&lt;/p&gt;
&lt;p&gt;&lt;code&gt;find . -name &amp;quot;*.log&amp;quot; -exec rm {} \;&lt;/code&gt;&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>You can use this command :</p>
<p><code>find . -name &quot;*.log&quot; -exec rm {} \;</code></p>
]]></content>
        </item>
        
        <item>
            <title>WordPress Curl on page returns 200 but browser returns 404</title>
            <link>/en/posts/2018/03/wordpress-curl-on-page-returns-200-but-browser-returns-404/</link>
            <pubDate>Tue, 13 Mar 2018 17:37:20 +0000</pubDate>
            
            <guid>/en/posts/2018/03/wordpress-curl-on-page-returns-200-but-browser-returns-404/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had a weird issue on a PHP script. I was returning an error 404 on a WordPress page the following way :&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// At the beginning of a template page
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;global&lt;/span&gt; $wp_query;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; ( $posts_query&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;amp;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;gt&lt;/span&gt;;&lt;span style=&#34;color:#a6e22e&#34;&gt;post_count&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; ) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    $wp_query&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;amp;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;gt&lt;/span&gt;;&lt;span style=&#34;color:#a6e22e&#34;&gt;set_404&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;status_header&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;404&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;get_template_part&lt;/span&gt;( &lt;span style=&#34;color:#ae81ff&#34;&gt;404&lt;/span&gt; ); &lt;span style=&#34;color:#66d9ef&#34;&gt;die&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When I was accessing the error page on the browser, It worked well, I had a 404 error page displayed + the correct status code when I inspected the page (Network tab).&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>I had a weird issue on a PHP script. I was returning an error 404 on a WordPress page the following way :</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#75715e">// At the beginning of a template page
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#66d9ef">global</span> $wp_query;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">if</span> ( $posts_query<span style="color:#f92672">-&amp;</span><span style="color:#a6e22e">gt</span>;<span style="color:#a6e22e">post_count</span> <span style="color:#f92672">==</span> <span style="color:#ae81ff">0</span> ) {
</span></span><span style="display:flex;"><span>    $wp_query<span style="color:#f92672">-&amp;</span><span style="color:#a6e22e">gt</span>;<span style="color:#a6e22e">set_404</span>();
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">status_header</span>(<span style="color:#ae81ff">404</span>);
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">get_template_part</span>( <span style="color:#ae81ff">404</span> ); <span style="color:#66d9ef">die</span>();
</span></span><span style="display:flex;"><span>  }
</span></span></code></pre></div><p>When I was accessing the error page on the browser, It worked well, I had a 404 error page displayed + the correct status code when I inspected the page (Network tab).</p>
<p>However, when I was « curl-ing » the same error page, it didn’t work. It didn’t work in the shell, or in the PHP script.</p>
<p>The Shell command I did :</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>$ curl -I http://myerrorpage.dev 
</span></span><span style="display:flex;"><span>HTTP/1.1 <span style="color:#ae81ff">200</span> OK
</span></span><span style="display:flex;"><span>Date: Tue, <span style="color:#ae81ff">13</span> Mar <span style="color:#ae81ff">2018</span> 16:24:08 GMT
</span></span><span style="display:flex;"><span>Server: Apache/2.4.7 <span style="color:#f92672">(</span>Ubuntu<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>X-Powered-By: PHP/5.5.9-1ubuntu4.22
</span></span><span style="display:flex;"><span>Expires: Thu, <span style="color:#ae81ff">19</span> Nov <span style="color:#ae81ff">2018</span> 08:52:00 GMT
</span></span><span style="display:flex;"><span>Cache-control: max-age<span style="color:#f92672">=</span>0, no-store
</span></span><span style="display:flex;"><span>Set-Cookie: wordpress_fd4fa864532af79923254c1877e41f25<span style="color:#f92672">=</span>+; expires<span style="color:#f92672">=</span>Mon, 13-Mar-2017 16:24:09 GMT; Max-Age<span style="color:#f92672">=</span>-31536000;
</span></span></code></pre></div><p>The buggy PHP Script</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span>$ch <span style="color:#f92672">=</span> <span style="color:#a6e22e">curl_init</span>();
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">curl_setopt</span>($ch, <span style="color:#a6e22e">CURLOPT_URL</span>,            $url);
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">curl_setopt</span>($ch, <span style="color:#a6e22e">CURLOPT_HEADER</span>,         <span style="color:#66d9ef">true</span>);
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">curl_setopt</span>($ch, <span style="color:#a6e22e">CURLOPT_NOBODY</span>,         <span style="color:#66d9ef">true</span>);
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">curl_setopt</span>($ch, <span style="color:#a6e22e">CURLOPT_RETURNTRANSFER</span>, <span style="color:#66d9ef">true</span>);
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">curl_setopt</span>($ch, <span style="color:#a6e22e">CURLOPT_TIMEOUT</span>,        <span style="color:#ae81ff">1</span>);
</span></span><span style="display:flex;"><span>$headers[] <span style="color:#f92672">=</span> <span style="color:#a6e22e">curl_exec</span>($ch);
</span></span><span style="display:flex;"><span>$status <span style="color:#f92672">=</span> <span style="color:#a6e22e">curl_getinfo</span>($ch, <span style="color:#a6e22e">CURLINFO_HTTP_CODE</span>);
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">var_dump</span>($status)
</span></span></code></pre></div><h2 id="solution">Solution</h2>
<p>I had to remove the « CURLOPT_NOBODY » to get the correct status code.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span>$ch <span style="color:#f92672">=</span> <span style="color:#a6e22e">curl_init</span>();
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">curl_setopt</span>($ch, <span style="color:#a6e22e">CURLOPT_URL</span>,            $url);
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">curl_setopt</span>($ch, <span style="color:#a6e22e">CURLOPT_HEADER</span>,         <span style="color:#66d9ef">true</span>);
</span></span><span style="display:flex;"><span><span style="color:#75715e">// curl_setopt($ch, CURLOPT_NOBODY,         true);
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span><span style="color:#a6e22e">curl_setopt</span>($ch, <span style="color:#a6e22e">CURLOPT_RETURNTRANSFER</span>, <span style="color:#66d9ef">true</span>);
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">curl_setopt</span>($ch, <span style="color:#a6e22e">CURLOPT_TIMEOUT</span>,        <span style="color:#ae81ff">1</span>);
</span></span><span style="display:flex;"><span>$headers[] <span style="color:#f92672">=</span> <span style="color:#a6e22e">curl_exec</span>($ch);
</span></span><span style="display:flex;"><span>$status <span style="color:#f92672">=</span> <span style="color:#a6e22e">curl_getinfo</span>($ch, <span style="color:#a6e22e">CURLINFO_HTTP_CODE</span>);
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">var_dump</span>($status);
</span></span></code></pre></div>]]></content>
        </item>
        
        <item>
            <title>Permission issue with npm while installing react-devtools</title>
            <link>/en/posts/2018/02/permission-issue-with-npm-while-installing-react-devtools/</link>
            <pubDate>Tue, 27 Feb 2018 17:14:15 +0000</pubDate>
            
            <guid>/en/posts/2018/02/permission-issue-with-npm-while-installing-react-devtools/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had this error once while trying to install the npm package react-devtools.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;leiluspocus$ npm i -g react-devtools
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm ERR! path /usr/local/lib/node_modules
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm ERR! code EACCES
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm ERR! errno -13
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm ERR! syscall access
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm ERR! Error: EACCES: permission denied, access &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/usr/local/lib/node_modules&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm ERR!  &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt; Error: EACCES: permission denied, access &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/usr/local/lib/node_modules&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm ERR!   stack: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Error: EACCES: permission denied, access \&amp;#39;&lt;/span&gt;/usr/local/lib/node_modules&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;npm ERR!   errno: -13,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;npm ERR!   code: &amp;#39;&lt;/span&gt;EACCES&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;npm ERR!   syscall: &amp;#39;&lt;/span&gt;access&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;npm ERR!   path: &amp;#39;&lt;/span&gt;/usr/local/lib/node_modules&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm ERR!
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm ERR! Please try running this command again as root/Administrator.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm ERR! A complete log of this run can be found in:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm ERR!     /Users/leiluspocus/.npm/_logs/2018-02-27T13_52_59_313Z-debug.log
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The issue was that I was previously installing npm packages using the root user.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>I had this error once while trying to install the npm package react-devtools.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>leiluspocus$ npm i -g react-devtools
</span></span><span style="display:flex;"><span>npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
</span></span><span style="display:flex;"><span>npm ERR! path /usr/local/lib/node_modules
</span></span><span style="display:flex;"><span>npm ERR! code EACCES
</span></span><span style="display:flex;"><span>npm ERR! errno -13
</span></span><span style="display:flex;"><span>npm ERR! syscall access
</span></span><span style="display:flex;"><span>npm ERR! Error: EACCES: permission denied, access <span style="color:#e6db74">&#39;/usr/local/lib/node_modules&#39;</span>
</span></span><span style="display:flex;"><span>npm ERR!  <span style="color:#f92672">{</span> Error: EACCES: permission denied, access <span style="color:#e6db74">&#39;/usr/local/lib/node_modules&#39;</span>
</span></span><span style="display:flex;"><span>npm ERR!   stack: <span style="color:#e6db74">&#39;Error: EACCES: permission denied, access \&#39;</span>/usr/local/lib/node_modules<span style="color:#ae81ff">\&#39;</span><span style="color:#e6db74">&#39;,
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">npm ERR!   errno: -13,
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">npm ERR!   code: &#39;</span>EACCES<span style="color:#e6db74">&#39;,
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">npm ERR!   syscall: &#39;</span>access<span style="color:#e6db74">&#39;,
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">npm ERR!   path: &#39;</span>/usr/local/lib/node_modules<span style="color:#960050;background-color:#1e0010">&#39;</span> <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>npm ERR!
</span></span><span style="display:flex;"><span>npm ERR! Please try running this command again as root/Administrator.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>npm ERR! A complete log of this run can be found in:
</span></span><span style="display:flex;"><span>npm ERR!     /Users/leiluspocus/.npm/_logs/2018-02-27T13_52_59_313Z-debug.log
</span></span></code></pre></div><p>The issue was that I was previously installing npm packages using the root user.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>leiluspocus:lib$ ls -l
</span></span><span style="display:flex;"><span>total <span style="color:#ae81ff">120</span> 
</span></span><span style="display:flex;"><span><span style="color:#f92672">(</span>...<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>drwxr-xr-x  <span style="color:#ae81ff">11</span> root            wheel  <span style="color:#ae81ff">374</span> <span style="color:#ae81ff">27</span> fév 14:52 node_modules
</span></span></code></pre></div><p>It’s a mess afterwards and it’s easier to handle when the owner is your current user. So, I changed the owner of my folder node_modules using the following command :</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>sudo chown -R $USER /usr/local/lib/node_modules/
</span></span></code></pre></div><p>And it worked like a charm !</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>leiluspocus:lib$ ls -l
</span></span><span style="display:flex;"><span>total <span style="color:#ae81ff">120</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">(</span>...<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>drwxr-xr-x  <span style="color:#ae81ff">11</span> leiluspocus  wheel  <span style="color:#ae81ff">374</span> <span style="color:#ae81ff">27</span> fév 14:52 node_modules 
</span></span><span style="display:flex;"><span>leiluspocus:lib$ npm i -g react-devtools
</span></span><span style="display:flex;"><span>/usr/local/bin/react-devtools -&amp;gt; /usr/local/lib/node_modules/react-devtools/bin.js
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>&amp;gt; electron@1.8.2 postinstall /usr/local/lib/node_modules/react-devtools/node_modules/electron
</span></span><span style="display:flex;"><span>&amp;gt; node install.js
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Downloading SHASUMS256.txt
</span></span><span style="display:flex;"><span><span style="color:#f92672">[============================================</span>&amp;gt;<span style="color:#f92672">]</span> 100.0% of 3.43 kB <span style="color:#f92672">(</span>3.43 kB/s<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>+ react-devtools@3.1.0
</span></span><span style="display:flex;"><span>added <span style="color:#ae81ff">239</span> packages in 37.236s
</span></span></code></pre></div>]]></content>
        </item>
        
        <item>
            <title>Getting started with React Native</title>
            <link>/en/posts/2017/09/getting-started-with-react-native/</link>
            <pubDate>Sat, 02 Sep 2017 17:31:47 +0000</pubDate>
            
            <guid>/en/posts/2017/09/getting-started-with-react-native/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It’s pretty impressive how we can simply set up a development environment without XCode using Expo.&lt;/p&gt;
&lt;p&gt;Make sure you’re using the right Node and NPM versions and double check that there are no missing packages while doing the npm install.&lt;/p&gt;
&lt;p&gt;I had to run these commands before running npm start on my app (created through create-react-native-app ):&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>It’s pretty impressive how we can simply set up a development environment without XCode using Expo.</p>
<p>Make sure you’re using the right Node and NPM versions and double check that there are no missing packages while doing the npm install.</p>
<p>I had to run these commands before running npm start on my app (created through create-react-native-app ):</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>sudo sysctl -w kern.maxfiles<span style="color:#f92672">=</span><span style="color:#ae81ff">5242880</span>
</span></span><span style="display:flex;"><span>sudo sysctl -w kern.maxfilesperproc<span style="color:#f92672">=</span><span style="color:#ae81ff">524288</span>
</span></span></code></pre></div><p> </p>
<p>While you edit your project files (using any IDEA like Atom or Sublime Text), Expo provides live reloading so that you can directly test your application very quickly.</p>
<p>I made a very simple app that only embed a webview. IT can be found here: https://github.com/leiluspocus/react-test</p>
<p> </p>
<h3 id="resources">Resources</h3>
<ul>
<li>Basic tutorial to get started with React Native: <a href="https://facebook.github.io/react-native/docs/tutorial.html">https://facebook.github.io/react-native/docs/tutorial.html</a></li>
<li>Packages explorer for React: https://js.coach/react-native/</li>
</ul>
<p> </p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
]]></content>
        </item>
        
        <item>
            <title>Getting started with Magento</title>
            <link>/en/posts/2017/08/getting-started-with-magento/</link>
            <pubDate>Thu, 17 Aug 2017 23:36:15 +0000</pubDate>
            
            <guid>/en/posts/2017/08/getting-started-with-magento/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;When I started working with Magento 1, I was frightened by the quantity of files and modules. The clients I worked for had several modules and a lot of things needed to be refactored, both projects were on Magento 1.&lt;/p&gt;
&lt;p&gt;Here are some « baby steps » I followed when I began with Magento 1. I would like to remember them when I will get started on a Magento 2 project 🙂&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>When I started working with Magento 1, I was frightened by the quantity of files and modules. The clients I worked for had several modules and a lot of things needed to be refactored, both projects were on Magento 1.</p>
<p>Here are some « baby steps » I followed when I began with Magento 1. I would like to remember them when I will get started on a Magento 2 project 🙂</p>
<h2 id="identify-the-business-rules">Identify the business rules</h2>
<p>Each client has its own challenges, one client might have to do something an other client won’t have to do. I once worked for a client who had 3 stocks options: « In stock », « Out of stock », « Likely to be out of stock » which was unthinkable for my last client 😀</p>
<p><strong>The more you know about the business of your client, the more you will deliver features that fits his expectations.</strong></p>
<h2 id="setup-a-way-to-debug-efficiently">Setup a way to debug efficiently</h2>
<p>It takes a little bit of time to setup Xdebug but it is – oh sooo – valuable. With XDebug, you will be able to debug any line you want in your Magento project by simply adding a breakpoint. You will be able to view the content of your variables, the stack…</p>
<p>Setup Xdebug on your Magento project and install the xdebug extension on Chrome. For front-end development, I used to love Firebug but now, I’m using the native console of Chrome because this is my favorite browser 🙂</p>
<h2 id="identify-the-controllers--models-behind-basic-actions">Identify the controllers / models behind basic actions</h2>
<p>It’s important to understand how are these actions handled in the code logic to be able to develop features around these actions. Besides the code logic, visualizing where is the data stored in the database (which tables, how to get the data quickly with MySQL queries for example) can be useful for quick business reports generation.</p>
<p><em>Basic views</em></p>
<ul>
<li>Product view (images, variants, product description)</li>
<li>Cart view</li>
<li>Checkout view</li>
<li>Orders view</li>
</ul>
<p><em>Tricky e-commerce logic</em></p>
<ul>
<li>The logic of promotions (how is a discount applied to a product?)</li>
<li>Logic of cart rules (how is a discount applied to a shopping cart?)</li>
</ul>
<h2 id="develop-a-hello-world-module">Develop a « Hello World » module</h2>
<p>It will make you understand the « frightening » architecture through a very simple example for both front-end and back-end. For example, you can develop a module that adds a « Hello world » on product pages.</p>
<h2 id="understand-the-caching-process">Understand the caching process</h2>
<p>Last but not least, maybe one of the most difficult points to me: fully understand how a page is cached with Magento. Time speed is critical for your website conversion, the browsing experience must be as fast as possible. It’s however tricky for e-commerce because stocks can be evolving quickly: how can you cache data that can be modified frequently? Here are some answers you will need to find the answer to :</p>
<ul>
<li>What are the sections cached in the website and how are they cached ?</li>
<li>Is the project using a reverse proxy ? (Varnish)</li>
<li>Is there a CDN for static files ? (images, CSS, Javascripts)</li>
</ul>
<p>Once you will understand the caching process, you will be able to optimize the pagespeed and understand some bugs you will face.</p>
<h2 id="create-a-list-of-technical-references">Create a list of technical references</h2>
<p>Magento has an extremely large community, which is awesome. I used to try to remember the most active people. They can be « trusted » even though you always have to test / fully understand the solutions you find online of course. I learned a lot about Magento 1 through reading the blogs / responses on StackOverflow of the people from this list</p>
<ul>
<li><!-- raw HTML omitted -->Inchoo<!-- raw HTML omitted --></li>
<li><!-- raw HTML omitted -->Alan Storm<!-- raw HTML omitted --></li>
<li><!-- raw HTML omitted -->Fabrizio Branca<!-- raw HTML omitted --></li>
<li><!-- raw HTML omitted -->Anna Völkl<!-- raw HTML omitted --></li>
<li><!-- raw HTML omitted -->Vinai Kopp<!-- raw HTML omitted --></li>
</ul>
<p>If you have a tip to give on how to get started with Magento 2, don’t hesitate to leave a comment, I will be happy to read !</p>
<p><strong>Extra links :</strong></p>
<p><a href="https://magentotherightway.com/">Magento the right way – A Cheatsheet about Magento’s best practices https://magentotherightway.com/</a></p>
<p>Magento Compiler Mode <a href="http://alanstorm.com/magento">http://alanstorm.com/magento</a>_compiler_path</p>
<p><a href="http://info2.magento.com/rs/magentosoftware/images/Conquer">http://info2.magento.com/rs/magentosoftware/images/Conquer</a>_the_5_Most_Common_Magento_Coding_Issues_to_Optimize_Your_Site_for_Performance.pdf</p>
<p><!-- raw HTML omitted --> <!-- raw HTML omitted -->Making Magento flying like a rocket! (A set of valuable tips for developers)<!-- raw HTML omitted --> <!-- raw HTML omitted --> from <!-- raw HTML omitted --><!-- raw HTML omitted -->Ivan Chepurnyi<!-- raw HTML omitted --><!-- raw HTML omitted --></p>
]]></content>
        </item>
        
        <item>
            <title>Symfony3 Importing JS / CSS assets from a bundle in your custom templates</title>
            <link>/en/posts/2017/06/symfony3-importing-js-/-css-assets-from-a-bundle-in-your-custom-templates/</link>
            <pubDate>Fri, 30 Jun 2017 11:50:44 +0000</pubDate>
            
            <guid>/en/posts/2017/06/symfony3-importing-js-/-css-assets-from-a-bundle-in-your-custom-templates/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;While implementing the PrestaImage bundle in a Symfony 3 project, I had to include the assets of the bundle in my custom template file. I had first copy / paste manually the files but I thought it was not an easy / clean way to maintain these files.&lt;/p&gt;
&lt;h3 id=&#34;install-the-assets-in-the-public-web-folder&#34;&gt;Install the assets in the public web folder&lt;/h3&gt;
&lt;p&gt;I used the magnificient CLI of Symfony :&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>While implementing the PrestaImage bundle in a Symfony 3 project, I had to include the assets of the bundle in my custom template file. I had first copy / paste manually the files but I thought it was not an easy / clean way to maintain these files.</p>
<h3 id="install-the-assets-in-the-public-web-folder">Install the assets in the public web folder</h3>
<p>I used the magnificient CLI of Symfony :</p>
<p><code>php bin/console assets:install web</code></p>
<p>This command will :</p>
<ol>
<li>Copy the assets files – placed under vendor/YOUR_BUNDLE/Resources/public/js or vendor/YOUR_BUNDLE/Resources/public/css</li>
<li>Create two folders for JS and CSS assets under web/bundles/&lt;your_bundle&gt;/</li>
</ol>
<h3 id="calling-the-assets-in-the-template">Calling the assets in the template</h3>
<p>Then you will be able to call the assets in your custom twig template using :</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-html" data-lang="html"><span style="display:flex;"><span>&lt;<span style="color:#f92672">link</span> <span style="color:#a6e22e">rel</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;stylesheet&#34;</span> <span style="color:#a6e22e">href</span><span style="color:#f92672">=</span><span style="color:#e6db74">&#34;{{ asset(&#39;bundles/YOUR_BUNDLE/css/YOUR_ASSET_NAME.css&#39;) }}&#34;</span> /&gt;
</span></span></code></pre></div><p>I was surprised that there were no way to directly call the files without copying them, it would save some time and disk space.</p>
]]></content>
        </item>
        
        <item>
            <title>Git Workflow Cheatsheet</title>
            <link>/en/posts/2017/06/git-workflow-cheatsheet/</link>
            <pubDate>Sun, 18 Jun 2017 16:55:42 +0000</pubDate>
            
            <guid>/en/posts/2017/06/git-workflow-cheatsheet/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I follow a pretty regular git workflow on my projects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All my features are derived from a master branch&lt;/li&gt;
&lt;li&gt;I merge my feature with master only after a code review (If I work with several people on the project, I ask them. Even If I’m alone on the project, I still use Github’s Pull Requests to review myself).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;my-git-cheatsheet&#34;&gt;My Git Cheatsheet&lt;/h2&gt;
&lt;h3 id=&#34;delete-a-local--remote-branch&#34;&gt;Delete a local / remote branch&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;git branch -D branch_name #locally
git push origin --delete branch_name    #remote
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;create-a-branch-from-a-commit&#34;&gt;Create a branch from a commit&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;git checkout -b branch_name a9c146a09505837ec03b&lt;/code&gt;&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>I follow a pretty regular git workflow on my projects:</p>
<ul>
<li>All my features are derived from a master branch</li>
<li>I merge my feature with master only after a code review (If I work with several people on the project, I ask them. Even If I’m alone on the project, I still use Github’s Pull Requests to review myself).</li>
</ul>
<h2 id="my-git-cheatsheet">My Git Cheatsheet</h2>
<h3 id="delete-a-local--remote-branch">Delete a local / remote branch</h3>
<pre tabindex="0"><code>git branch -D branch_name #locally
git push origin --delete branch_name    #remote
</code></pre><h3 id="create-a-branch-from-a-commit">Create a branch from a commit</h3>
<p><code>git checkout -b branch_name a9c146a09505837ec03b</code></p>
<h3 id="copy-the-changes-from-a-certain-commit">Copy the changes from a certain commit</h3>
<p>git cherry-pick can be a life savior if well used (ex: when you merge a feature A, a feature B after and you want to revert feature A).</p>
<p><code>git cherry-pick commit_hash</code></p>
<h3 id="know-which-files-you-edited">Know which files you edited</h3>
<p><code>git status</code></p>
<h3 id="add-a-file">Add a file</h3>
<p><code>git add filename</code></p>
<h3 id="reset-your-working-tree">Reset your working tree</h3>
<p>(careful with this command, you’ll loose all your local changes)</p>
<p><code>git checkout *</code></p>
<h3 id="save-your-local-changes-without-commiting-them">Save your local changes without commiting them</h3>
<p>Stashs are very convenient specially when you switch a lot between multiples branches (features).</p>
<p><code>git stash save my_changes_name</code></p>
<h3 id="view-my-saved-stashs">View my saved stashs</h3>
<p><code>git stash list</code></p>
<h3 id="apply-a-saved-stash">Apply a saved stash</h3>
<p><code>git stash apply my_changes_name</code></p>
<h2 id="other-git-tips">Other Git tips</h2>
<ul>
<li>Do your best to commit only working stuff. It’s easy to handle in case of reverts afterwards.</li>
<li>Avoid the command git add . Be aware of the changes you’re pushing from your working tree.</li>
<li><!-- raw HTML omitted --><!-- raw HTML omitted -->Never force-quit (CTRL + C) while doing git checkout<!-- raw HTML omitted --><!-- raw HTML omitted -->. I did it once because I was impatient and it was taking couple of seconds. If it takes a long time, it means there are a lot of files being fetches. If you do so, your working tree will be a mess.</li>
</ul>
]]></content>
        </item>
        
        <item>
            <title>PHP Customize excerpt in a WordPress post</title>
            <link>/en/posts/2016/11/php-customize-excerpt-in-a-wordpress-post/</link>
            <pubDate>Fri, 25 Nov 2016 09:05:28 +0000</pubDate>
            
            <guid>/en/posts/2016/11/php-customize-excerpt-in-a-wordpress-post/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;add_filter&lt;/span&gt;( &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;get_the_excerpt&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;my_new_excerpt&amp;#39;&lt;/span&gt; );
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;my_new_excerpt&lt;/span&gt;( $format )
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    $format &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;__&lt;/span&gt;( &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; Blabla&amp;#39;&lt;/span&gt; ); &lt;span style=&#34;color:#75715e&#34;&gt;// Modify this to your needs!
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; $format;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Enjoy !&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#a6e22e">add_filter</span>( <span style="color:#e6db74">&#39;get_the_excerpt&#39;</span>, <span style="color:#e6db74">&#39;my_new_excerpt&#39;</span> );
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">my_new_excerpt</span>( $format )
</span></span><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>    $format <span style="color:#f92672">=</span> <span style="color:#a6e22e">__</span>( <span style="color:#e6db74">&#39; Blabla&#39;</span> ); <span style="color:#75715e">// Modify this to your needs!
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>    <span style="color:#66d9ef">return</span> $format;
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>Enjoy !</p>
]]></content>
        </item>
        
        <item>
            <title>Pentaho - FieldHelper cannot be cast to java.lang.String</title>
            <link>/en/posts/2016/09/pentaho-fieldhelper-cannot-be-cast-to-java.lang.string/</link>
            <pubDate>Thu, 01 Sep 2016 13:11:20 +0000</pubDate>
            
            <guid>/en/posts/2016/09/pentaho-fieldhelper-cannot-be-cast-to-java.lang.string/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had the following error in a « User Defined Java Class » step on Pentaho Data Integration.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;FieldHelper cannot be cast to java.lang.String
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Indeed, you have to use the getRow() method to convert the field you’re getting into a String or any other variable type.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;boolean&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;processRow&lt;/span&gt;(StepMetaInterface smi, StepDataInterface sdi) &lt;span style=&#34;color:#66d9ef&#34;&gt;throws&lt;/span&gt; KettleException, Exception
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Object&lt;span style=&#34;color:#f92672&#34;&gt;[]&lt;/span&gt; r &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; getRow();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (r &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;null&lt;/span&gt;) { &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;false&lt;/span&gt;; }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        String myString &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; get(Fields.&lt;span style=&#34;color:#a6e22e&#34;&gt;In&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;FeedSubmissionId&amp;#34;&lt;/span&gt;).&lt;span style=&#34;color:#a6e22e&#34;&gt;getString&lt;/span&gt;(r);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>I had the following error in a « User Defined Java Class » step on Pentaho Data Integration.</p>
<pre tabindex="0"><code>FieldHelper cannot be cast to java.lang.String
</code></pre><p>Indeed, you have to use the getRow() method to convert the field you’re getting into a String or any other variable type.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-java" data-lang="java"><span style="display:flex;"><span><span style="color:#66d9ef">public</span> <span style="color:#66d9ef">boolean</span> <span style="color:#a6e22e">processRow</span>(StepMetaInterface smi, StepDataInterface sdi) <span style="color:#66d9ef">throws</span> KettleException, Exception
</span></span><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  Object<span style="color:#f92672">[]</span> r <span style="color:#f92672">=</span> getRow();
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">if</span> (r <span style="color:#f92672">==</span> <span style="color:#66d9ef">null</span>) { <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">false</span>; }
</span></span><span style="display:flex;"><span>        String myString <span style="color:#f92672">=</span> get(Fields.<span style="color:#a6e22e">In</span>, <span style="color:#e6db74">&#34;FeedSubmissionId&#34;</span>).<span style="color:#a6e22e">getString</span>(r);
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div>]]></content>
        </item>
        
        <item>
            <title>Can&#39;t login to Heroku from my mac</title>
            <link>/en/posts/2016/08/cant-login-to-heroku-from-my-mac/</link>
            <pubDate>Wed, 10 Aug 2016 18:42:11 +0000</pubDate>
            
            <guid>/en/posts/2016/08/cant-login-to-heroku-from-my-mac/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Problem of the day : I wasn’t able to connect to Heroku from my mac. The process was blocked on the message « Installing CLI… » like if it couldn’t connect to Heroku.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;MacBook-Air-de-Laila:shredder leiluspocus$ heroku login
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;heroku-cli: Installing CLI...
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Error: getaddrinfo: nodename nor servname provided, or not known &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;SocketError&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/socket.rb:100:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;getaddrinfo&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/socket.rb:100:in `connect&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/ssl_socket.rb:146:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;connect&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/socket.rb:28:in `initialize&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/ssl_socket.rb:8:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;initialize&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/connection.rb:404:in `new&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/connection.rb:404:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;socket&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/connection.rb:106:in `request_call&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/middlewares/mock.rb:47:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;request_call&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/middlewares/instrumentor.rb:25:in `request_call&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/middlewares/base.rb:15:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;request_call&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/middlewares/base.rb:15:in `request_call&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/middlewares/base.rb:15:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;request_call&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/connection.rb:250:in `request&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon.rb:238:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;get&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/usr/local/heroku/lib/heroku/jsplugin.rb:246:in `manifest&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/local/heroku/lib/heroku/jsplugin.rb:259:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;url&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/usr/local/heroku/lib/heroku/jsplugin.rb:149:in `block (2 levels) in setup&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/local/heroku/lib/heroku/jsplugin.rb:137:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;open&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/usr/local/heroku/lib/heroku/jsplugin.rb:137:in `block in setup&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/local/heroku/ruby/lib/ruby/1.9.1/tmpdir.rb:83:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;mktmpdir&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/usr/local/heroku/lib/heroku/jsplugin.rb:135:in `setup&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/local/heroku/lib/heroku/cli.rb:27:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;start&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/usr/local/bin/heroku:24:in `&amp;lt;main&amp;gt;&amp;lt;/main&amp;gt;&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I noticed my Bluetooth was active. It worked after I disabled it.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>Problem of the day : I wasn’t able to connect to Heroku from my mac. The process was blocked on the message « Installing CLI… » like if it couldn’t connect to Heroku.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>MacBook-Air-de-Laila:shredder leiluspocus$ heroku login
</span></span><span style="display:flex;"><span>heroku-cli: Installing CLI...
</span></span><span style="display:flex;"><span>Error: getaddrinfo: nodename nor servname provided, or not known <span style="color:#f92672">(</span>SocketError<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/socket.rb:100:in <span style="color:#e6db74">`</span>getaddrinfo<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/socket.rb:100:in `connect&#39;</span>
</span></span><span style="display:flex;"><span>/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/ssl_socket.rb:146:in <span style="color:#e6db74">`</span>connect<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/socket.rb:28:in `initialize&#39;</span>
</span></span><span style="display:flex;"><span>/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/ssl_socket.rb:8:in <span style="color:#e6db74">`</span>initialize<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/connection.rb:404:in `new&#39;</span>
</span></span><span style="display:flex;"><span>/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/connection.rb:404:in <span style="color:#e6db74">`</span>socket<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/connection.rb:106:in `request_call&#39;</span>
</span></span><span style="display:flex;"><span>/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/middlewares/mock.rb:47:in <span style="color:#e6db74">`</span>request_call<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/middlewares/instrumentor.rb:25:in `request_call&#39;</span>
</span></span><span style="display:flex;"><span>/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/middlewares/base.rb:15:in <span style="color:#e6db74">`</span>request_call<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/middlewares/base.rb:15:in `request_call&#39;</span>
</span></span><span style="display:flex;"><span>/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/middlewares/base.rb:15:in <span style="color:#e6db74">`</span>request_call<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon/connection.rb:250:in `request&#39;</span>
</span></span><span style="display:flex;"><span>/usr/local/heroku/vendor/gems/excon-0.51.0/lib/excon.rb:238:in <span style="color:#e6db74">`</span>get<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">/usr/local/heroku/lib/heroku/jsplugin.rb:246:in `manifest&#39;</span>
</span></span><span style="display:flex;"><span>/usr/local/heroku/lib/heroku/jsplugin.rb:259:in <span style="color:#e6db74">`</span>url<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">/usr/local/heroku/lib/heroku/jsplugin.rb:149:in `block (2 levels) in setup&#39;</span>
</span></span><span style="display:flex;"><span>/usr/local/heroku/lib/heroku/jsplugin.rb:137:in <span style="color:#e6db74">`</span>open<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">/usr/local/heroku/lib/heroku/jsplugin.rb:137:in `block in setup&#39;</span>
</span></span><span style="display:flex;"><span>/usr/local/heroku/ruby/lib/ruby/1.9.1/tmpdir.rb:83:in <span style="color:#e6db74">`</span>mktmpdir<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">/usr/local/heroku/lib/heroku/jsplugin.rb:135:in `setup&#39;</span>
</span></span><span style="display:flex;"><span>/usr/local/heroku/lib/heroku/cli.rb:27:in <span style="color:#e6db74">`</span>start<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">/usr/local/bin/heroku:24:in `&lt;main&gt;&lt;/main&gt;&#39;</span>
</span></span></code></pre></div><p>I noticed my Bluetooth was active. It worked after I disabled it.</p>
]]></content>
        </item>
        
        <item>
            <title>Get XML Data won&#39;t parse XML object Pentaho</title>
            <link>/en/posts/2016/08/get-xml-data-wont-parse-xml-object-pentaho/</link>
            <pubDate>Mon, 01 Aug 2016 17:20:40 +0000</pubDate>
            
            <guid>/en/posts/2016/08/get-xml-data-wont-parse-xml-object-pentaho/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had an issue with Pentaho today. It wasn’t able to simply parse this XML that I was fetching from Amazon Marketplace Webservice.&lt;/p&gt;
&lt;p&gt;Here’s the data I got :&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;SubmitFeedResponse xmlns=&amp;#34;http://mws.amazonaws.com/doc/2009-01-01/&amp;#34;&amp;gt;
&amp;lt;SubmitFeedResult&amp;gt;
&amp;lt;FeedSubmissionInfo&amp;gt;
&amp;lt;FeedSubmissionId&amp;gt;MY_FEED_ID&amp;lt;/FeedSubmissionId&amp;gt;
&amp;lt;FeedType&amp;gt;_POST_INVENTORY_AVAILABILITY_DATA_&amp;lt;/FeedType&amp;gt;
&amp;lt;SubmittedDate&amp;gt;2016-08-01T19:28:30+00:00&amp;lt;/SubmittedDate&amp;gt;
&amp;lt;FeedProcessingStatus&amp;gt;_SUBMITTED_&amp;lt;/FeedProcessingStatus&amp;gt;
&amp;lt;/FeedSubmissionInfo&amp;gt;
&amp;lt;/SubmitFeedResult&amp;gt;
&amp;lt;ResponseMetadata&amp;gt;
&amp;lt;RequestId&amp;gt;MY_REQUEST_ID&amp;lt;/RequestId&amp;gt;
&amp;lt;/ResponseMetadata&amp;gt;
&amp;lt;/SubmitFeedResponse&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The step « Get XML Data » couldn’t parse it because of the xmlns attribute tag. So I had to add a step « Replace in string » that would delete this attribute.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>I had an issue with Pentaho today. It wasn’t able to simply parse this XML that I was fetching from Amazon Marketplace Webservice.</p>
<p>Here’s the data I got :</p>
<pre tabindex="0"><code>&lt;SubmitFeedResponse xmlns=&#34;http://mws.amazonaws.com/doc/2009-01-01/&#34;&gt;
&lt;SubmitFeedResult&gt;
&lt;FeedSubmissionInfo&gt;
&lt;FeedSubmissionId&gt;MY_FEED_ID&lt;/FeedSubmissionId&gt;
&lt;FeedType&gt;_POST_INVENTORY_AVAILABILITY_DATA_&lt;/FeedType&gt;
&lt;SubmittedDate&gt;2016-08-01T19:28:30+00:00&lt;/SubmittedDate&gt;
&lt;FeedProcessingStatus&gt;_SUBMITTED_&lt;/FeedProcessingStatus&gt;
&lt;/FeedSubmissionInfo&gt;
&lt;/SubmitFeedResult&gt;
&lt;ResponseMetadata&gt;
&lt;RequestId&gt;MY_REQUEST_ID&lt;/RequestId&gt;
&lt;/ResponseMetadata&gt;
&lt;/SubmitFeedResponse&gt;
</code></pre><p>The step « Get XML Data » couldn’t parse it because of the xmlns attribute tag. So I had to add a step « Replace in string » that would delete this attribute.</p>
]]></content>
        </item>
        
        <item>
            <title>Write a new task using Capistrano</title>
            <link>/en/posts/2016/07/write-a-new-task-using-capistrano/</link>
            <pubDate>Mon, 18 Jul 2016 16:31:43 +0000</pubDate>
            
            <guid>/en/posts/2016/07/write-a-new-task-using-capistrano/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Capistrano can be a great tool to run a task on several servers. It can be a task like uploading a maintenance page or deleting some logs :&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-ruby&#34; data-lang=&#34;ruby&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;task &lt;span style=&#34;color:#e6db74&#34;&gt;:NAME_OF_YOUR_TASK&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;desc &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;lt;&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;lt;&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;DESC&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;This&lt;/span&gt; is my awesome task&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Description&lt;/span&gt; appears &lt;span style=&#34;color:#66d9ef&#34;&gt;in&lt;/span&gt; help so write it carefully&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;DESC&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;run &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;rm -rf &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;#{&lt;/span&gt;logs_folder&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;run &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;mkdir &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;#{&lt;/span&gt;destination_folder&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;top&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;upload(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;index.html&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;#{&lt;/span&gt;destination_folder&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/index.html&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;end&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can read more about writing Capistrano tasks &lt;a href=&#34;http://vladigleba.com/blog/2014/04/10/deploying-rails-apps-part-6-writing-capistrano-tasks/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>Capistrano can be a great tool to run a task on several servers. It can be a task like uploading a maintenance page or deleting some logs :</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-ruby" data-lang="ruby"><span style="display:flex;"><span>task <span style="color:#e6db74">:NAME_OF_YOUR_TASK</span> <span style="color:#66d9ef">do</span>
</span></span><span style="display:flex;"><span>desc <span style="color:#f92672">&amp;</span>lt;<span style="color:#f92672">&amp;</span>lt;<span style="color:#f92672">-</span><span style="color:#66d9ef">DESC</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">This</span> is my awesome task<span style="color:#f92672">.</span> <span style="color:#66d9ef">Description</span> appears <span style="color:#66d9ef">in</span> help so write it carefully<span style="color:#f92672">.</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">DESC</span>
</span></span><span style="display:flex;"><span>run <span style="color:#e6db74">&#34;rm -rf </span><span style="color:#e6db74">#{</span>logs_folder<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span>
</span></span><span style="display:flex;"><span>run <span style="color:#e6db74">&#34;mkdir </span><span style="color:#e6db74">#{</span>destination_folder<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span>
</span></span><span style="display:flex;"><span>top<span style="color:#f92672">.</span>upload(<span style="color:#e6db74">&#34;index.html&#34;</span>, <span style="color:#e6db74">&#34;</span><span style="color:#e6db74">#{</span>destination_folder<span style="color:#e6db74">}</span><span style="color:#e6db74">/index.html&#34;</span>)
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">end</span>
</span></span></code></pre></div><p>You can read more about writing Capistrano tasks <a href="http://vladigleba.com/blog/2014/04/10/deploying-rails-apps-part-6-writing-capistrano-tasks/">here</a>.</p>
]]></content>
        </item>
        
        <item>
            <title>Quickbooks SDK - Authentification failed error (Web connector)</title>
            <link>/en/posts/2016/07/quickbooks-sdk-authentification-failed-error-web-connector/</link>
            <pubDate>Sat, 09 Jul 2016 12:32:38 +0000</pubDate>
            
            <guid>/en/posts/2016/07/quickbooks-sdk-authentification-failed-error-web-connector/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I used &lt;a href=&#34;https://github.com/consolibyte/quickbooks-php&#34;&gt;this SDK&lt;/a&gt; to develop an API that connects directly to Quickbooks.&lt;/p&gt;
&lt;p&gt;I had this error once: Authentification failed when I tried to fetch data from the API. My identifiers were correct.&lt;/p&gt;
&lt;p&gt;The problem came from some warnings I had in my program.&lt;/p&gt;
&lt;p&gt;It may sound obvious but make sure you have no PHP errors or warning in your application. Otherwise, the web connector of Quickbooks won’t be able to read data from your API.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>I used <a href="https://github.com/consolibyte/quickbooks-php">this SDK</a> to develop an API that connects directly to Quickbooks.</p>
<p>I had this error once: Authentification failed when I tried to fetch data from the API. My identifiers were correct.</p>
<p>The problem came from some warnings I had in my program.</p>
<p>It may sound obvious but make sure you have no PHP errors or warning in your application. Otherwise, the web connector of Quickbooks won’t be able to read data from your API.</p>
<p><!-- raw HTML omitted -->2017 update<!-- raw HTML omitted --></p>
<p>Seems like <a href="https://github.com/intuit/QuickBooks-V3-PHP-SDK">Quickbooks developed its own SDK.</a> It might be a better option to use for your APIs ?</p>
]]></content>
        </item>
        
        <item>
            <title>Using observers in Magento 1.13 can lead to slow loading issues</title>
            <link>/en/posts/2016/06/using-observers-in-magento-1.13-can-lead-to-slow-loading-issues/</link>
            <pubDate>Sat, 18 Jun 2016 16:02:24 +0000</pubDate>
            
            <guid>/en/posts/2016/06/using-observers-in-magento-1.13-can-lead-to-slow-loading-issues/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For one of the Magento projects I worked on, I had to implement a new action in the dropdown list of actions in the back-end.&lt;/p&gt;
&lt;p&gt;I tried the Observer option described in this tutorial:
&lt;!-- raw HTML omitted --&gt;Adding new mass action to admin grid in Magento&lt;!-- raw HTML omitted --&gt;&lt;/p&gt;
&lt;p&gt;However, it slowed down the application because the event I was observing core_block_abstract_prepare_layout_before was triggered too many times. The Sales admin page could take around 5 to 10 seconds to load. I finally opted for the Block override option, much more elegant.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>For one of the Magento projects I worked on, I had to implement a new action in the dropdown list of actions in the back-end.</p>
<p>I tried the Observer option described in this tutorial:
<!-- raw HTML omitted -->Adding new mass action to admin grid in Magento<!-- raw HTML omitted --></p>
<p>However, it slowed down the application because the event I was observing core_block_abstract_prepare_layout_before was triggered too many times. The Sales admin page could take around 5 to 10 seconds to load. I finally opted for the Block override option, much more elegant.</p>
<p>Lesson learned from this experience ? Be careful with the events you’re overriding with Magento and profile your dev environment. The plugin <a href="https://github.com/AOEpeople/Aoe_Profiler/">AOE_Profiler</a> helped me a lot noticing this issue.</p>
]]></content>
        </item>
        
        <item>
            <title>Create a copy of a Vagrant machine</title>
            <link>/en/posts/2016/06/create-a-copy-of-a-vagrant-machine/</link>
            <pubDate>Thu, 02 Jun 2016 18:09:22 +0000</pubDate>
            
            <guid>/en/posts/2016/06/create-a-copy-of-a-vagrant-machine/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ol&gt;
&lt;li&gt;Stop your vagrant machine&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vagrant halt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;Create the copy (it can take sometime)&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vagrant package --base name_of_your_machine  --output path/to/newly/created/package
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The machine name is on Virtual Box 🙂&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<ol>
<li>Stop your vagrant machine</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>vagrant halt
</span></span></code></pre></div><ol start="2">
<li>Create the copy (it can take sometime)</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>vagrant package --base name_of_your_machine  --output path/to/newly/created/package
</span></span></code></pre></div><p>The machine name is on Virtual Box 🙂</p>
]]></content>
        </item>
        
        <item>
            <title>Prototype Cheat Sheet</title>
            <link>/en/posts/2016/05/prototype-cheat-sheet/</link>
            <pubDate>Fri, 13 May 2016 20:37:49 +0000</pubDate>
            
            <guid>/en/posts/2016/05/prototype-cheat-sheet/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had to deal with Prototype while working with Magento. Here’s a little cheat sheet of some very simple stuff I had to do.&lt;/p&gt;
&lt;h2 id=&#34;make-an-ajax-requestwithparameters&#34;&gt;Make an Ajax Request with parameters&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Ajax&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;Request&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;url&lt;/span&gt;, {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                   &lt;span style=&#34;color:#a6e22e&#34;&gt;method&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;get&amp;#39;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                   &lt;span style=&#34;color:#a6e22e&#34;&gt;params&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;data1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;myParam&amp;#39;&lt;/span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                   &lt;span style=&#34;color:#a6e22e&#34;&gt;onSuccess&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;xhr&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                    &lt;span style=&#34;color:#a6e22e&#34;&gt;console&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;log&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;xhr&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;responseText&lt;/span&gt;); 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                    &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;json&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;JSON&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;parse&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;transport&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;responseText&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;});
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;change-value-of-an-input&#34;&gt;Change value of an input&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;$&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;ID OF THE ELEMENT&amp;#39;&lt;/span&gt;).&lt;span style=&#34;color:#a6e22e&#34;&gt;setValue&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;The new value&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;change-data-within-a-span-tag&#34;&gt;Change data within a span tag&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;$&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;ID OF THE ELEMENT&amp;#39;&lt;/span&gt;).&lt;span style=&#34;color:#a6e22e&#34;&gt;update&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Your new data&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>I had to deal with Prototype while working with Magento. Here’s a little cheat sheet of some very simple stuff I had to do.</p>
<h2 id="make-an-ajax-requestwithparameters">Make an Ajax Request with parameters</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">new</span> <span style="color:#a6e22e">Ajax</span>.<span style="color:#a6e22e">Request</span>(<span style="color:#a6e22e">url</span>, {
</span></span><span style="display:flex;"><span>                   <span style="color:#a6e22e">method</span><span style="color:#f92672">:</span><span style="color:#e6db74">&#39;get&#39;</span>,
</span></span><span style="display:flex;"><span>                   <span style="color:#a6e22e">params</span> <span style="color:#f92672">:</span> { <span style="color:#a6e22e">data1</span> <span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;myParam&#39;</span> }
</span></span><span style="display:flex;"><span>                   <span style="color:#a6e22e">onSuccess</span><span style="color:#f92672">:</span> <span style="color:#66d9ef">function</span>(<span style="color:#a6e22e">xhr</span>){
</span></span><span style="display:flex;"><span>                    <span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">log</span>(<span style="color:#a6e22e">xhr</span>.<span style="color:#a6e22e">responseText</span>); 
</span></span><span style="display:flex;"><span>                    <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">json</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">JSON</span>.<span style="color:#a6e22e">parse</span>(<span style="color:#a6e22e">transport</span>.<span style="color:#a6e22e">responseText</span>);
</span></span><span style="display:flex;"><span>                    }
</span></span><span style="display:flex;"><span>});
</span></span></code></pre></div><h2 id="change-value-of-an-input">Change value of an input</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;ID OF THE ELEMENT&#39;</span>).<span style="color:#a6e22e">setValue</span>(<span style="color:#e6db74">&#39;The new value&#39;</span>);
</span></span></code></pre></div><h2 id="change-data-within-a-span-tag">Change data within a span tag</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;ID OF THE ELEMENT&#39;</span>).<span style="color:#a6e22e">update</span>(<span style="color:#e6db74">&#39;Your new data&#39;</span>);
</span></span></code></pre></div>]]></content>
        </item>
        
        <item>
            <title>Magento Custom routing</title>
            <link>/en/posts/2016/05/magento-custom-routing/</link>
            <pubDate>Sun, 08 May 2016 19:58:55 +0000</pubDate>
            
            <guid>/en/posts/2016/05/magento-custom-routing/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If you implemented several store views in your Magento shop (let’s say for French and English), if you implement a new router, he will be associated to this views.&lt;/p&gt;
&lt;p&gt;&lt;!-- raw HTML omitted --&gt;Ex&lt;!-- raw HTML omitted --&gt;: In Magento’s default behavior,&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;your-store.com/my_router &lt;span style=&#34;color:#75715e&#34;&gt;# KO &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;your-store.com/fr/my_router &lt;span style=&#34;color:#75715e&#34;&gt;# OK &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;your-store.com/en/my_router &lt;span style=&#34;color:#75715e&#34;&gt;# OK&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The solution to this problem is to implement &lt;strong&gt;custom routing&lt;/strong&gt;. &lt;a href=&#34;http://inchoo.net/magento/custom-router-in-magento/&#34;&gt;Inchoo wrote an awesome article about it&lt;/a&gt;.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>If you implemented several store views in your Magento shop (let’s say for French and English), if you implement a new router, he will be associated to this views.</p>
<p><!-- raw HTML omitted -->Ex<!-- raw HTML omitted -->: In Magento’s default behavior,</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>your-store.com/my_router <span style="color:#75715e"># KO </span>
</span></span><span style="display:flex;"><span>your-store.com/fr/my_router <span style="color:#75715e"># OK </span>
</span></span><span style="display:flex;"><span>your-store.com/en/my_router <span style="color:#75715e"># OK</span>
</span></span></code></pre></div><p>The solution to this problem is to implement <strong>custom routing</strong>. <a href="http://inchoo.net/magento/custom-router-in-magento/">Inchoo wrote an awesome article about it</a>.</p>
]]></content>
        </item>
        
        <item>
            <title>Use Meld as an external viewer for git diff on Ubuntu</title>
            <link>/en/posts/2016/04/use-meld-as-an-external-viewer-for-git-diff-on-ubuntu/</link>
            <pubDate>Wed, 20 Apr 2016 16:50:53 +0000</pubDate>
            
            <guid>/en/posts/2016/04/use-meld-as-an-external-viewer-for-git-diff-on-ubuntu/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href=&#34;https://nathanhoad.net/how-to-meld-for-git-diffs-in-ubuntu-hardy&#34;&gt;This article&lt;/a&gt; explains very well how to use Meld as an external viewer for « git diff » on Ubuntu. Once done, you won’t have any valid excuses to escape code reviews 😉&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p><a href="https://nathanhoad.net/how-to-meld-for-git-diffs-in-ubuntu-hardy">This article</a> explains very well how to use Meld as an external viewer for « git diff » on Ubuntu. Once done, you won’t have any valid excuses to escape code reviews 😉</p>
]]></content>
        </item>
        
        <item>
            <title>Increase security on a WordPress site</title>
            <link>/en/posts/2016/04/increase-security-on-a-wordpress-site/</link>
            <pubDate>Mon, 18 Apr 2016 16:34:14 +0000</pubDate>
            
            <guid>/en/posts/2016/04/increase-security-on-a-wordpress-site/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;WordPress is an extremely popular framework, which makes it easier to hack. Here are couple of ways to increase the security of your WordPress installation :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hide your admin back-end to a list of whitelisted IPs through server rules on Apache / Nginx&lt;/li&gt;
&lt;li&gt;Change the path to your admin back-end&lt;/li&gt;
&lt;li&gt;Protect the wp-login.php script&lt;/li&gt;
&lt;li&gt;Change the prefix of your tables&lt;/li&gt;
&lt;li&gt;Use complicated passwords and change them often&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For people who are not necessarily developers, the plugin « iThemes Security » does some of the steps I mentioned pretty well.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>WordPress is an extremely popular framework, which makes it easier to hack. Here are couple of ways to increase the security of your WordPress installation :</p>
<ul>
<li>Hide your admin back-end to a list of whitelisted IPs through server rules on Apache / Nginx</li>
<li>Change the path to your admin back-end</li>
<li>Protect the wp-login.php script</li>
<li>Change the prefix of your tables</li>
<li>Use complicated passwords and change them often</li>
</ul>
<p>For people who are not necessarily developers, the plugin « iThemes Security » does some of the steps I mentioned pretty well.</p>
]]></content>
        </item>
        
        <item>
            <title>NoMethodError /Ruby/Gems/2.0.0/gems/sass-3.4.8/lib/sass/plugin/compiler.rb Undefined method start</title>
            <link>/en/posts/2016/04/nomethoderror-/ruby/gems/2.0.0/gems/sass-3.4.8/lib/sass/plugin/compiler.rb-undefined-method-start/</link>
            <pubDate>Sat, 09 Apr 2016 16:15:08 +0000</pubDate>
            
            <guid>/en/posts/2016/04/nomethoderror-/ruby/gems/2.0.0/gems/sass-3.4.8/lib/sass/plugin/compiler.rb-undefined-method-start/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had the weirdest issue when initializing my compass project for Greenie.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;gt;&amp;gt;&amp;gt; Compass is watching &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; changes. Press Ctrl-C to Stop.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;NoMethodError on line &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;402&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; of /Library/Ruby/Gems/2.0.0/gems/sass-3.4.8/lib/sass/plugin/compiler.rb: undefined method &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;start&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; for #&amp;lt;Thread:0x007f90d1afd098 sleep&amp;gt;&amp;lt;/Thread:0x007f90d1afd098&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  /Library/Ruby/Gems/2.0.0/gems/sass-3.4.8/lib/sass/plugin/compiler.rb:402:in `map&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  /Library/Ruby/Gems/2.0.0/gems/sass-3.4.8/lib/sass/plugin/compiler.rb:402:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;listen_to&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  /Library/Ruby/Gems/2.0.0/gems/sass-3.4.8/lib/sass/plugin/compiler.rb:338:in `watch&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/lib/compass/sass_compiler.rb:46:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;watch!&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/lib/compass/commands/watch_project.rb:41:in `perform&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/lib/compass/commands/base.rb:18:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;execute&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/lib/compass/commands/project_base.rb:19:in `execute&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/lib/compass/exec/sub_command_ui.rb:43:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;perform!&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/lib/compass/exec/sub_command_ui.rb:15:in `run!&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/bin/compass:30:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;block in &amp;lt;top &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;required&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&amp;gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/bin/compass:44:in `call&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/bin/compass:44:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;&amp;lt;top &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;required&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&amp;gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  /usr/local/bin/compass:23:in `load&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  /usr/local/bin/compass:23:in &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;&amp;lt;main&amp;gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I solved it &lt;a href=&#34;http://code.tutsplus.com/tutorials/how-to-install-ruby-on-a-mac--net-21664&#34;&gt;by using a more recent version of Ruby using RVM&lt;/a&gt;. RVM is pretty cool because you can switch your Ruby versions very easily. Note that I had to re-install compass afterwards.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>I had the weirdest issue when initializing my compass project for Greenie.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>&gt;&gt;&gt; Compass is watching <span style="color:#66d9ef">for</span> changes. Press Ctrl-C to Stop.
</span></span><span style="display:flex;"><span>NoMethodError on line <span style="color:#f92672">[</span><span style="color:#e6db74">&#34;402&#34;</span><span style="color:#f92672">]</span> of /Library/Ruby/Gems/2.0.0/gems/sass-3.4.8/lib/sass/plugin/compiler.rb: undefined method <span style="color:#e6db74">`</span>start<span style="color:#e6db74">&#39; for #&lt;Thread:0x007f90d1afd098 sleep&gt;&lt;/Thread:0x007f90d1afd098&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">  /Library/Ruby/Gems/2.0.0/gems/sass-3.4.8/lib/sass/plugin/compiler.rb:402:in `map&#39;</span>
</span></span><span style="display:flex;"><span>  /Library/Ruby/Gems/2.0.0/gems/sass-3.4.8/lib/sass/plugin/compiler.rb:402:in <span style="color:#e6db74">`</span>listen_to<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">  /Library/Ruby/Gems/2.0.0/gems/sass-3.4.8/lib/sass/plugin/compiler.rb:338:in `watch&#39;</span>
</span></span><span style="display:flex;"><span>  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/lib/compass/sass_compiler.rb:46:in <span style="color:#e6db74">`</span>watch!<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/lib/compass/commands/watch_project.rb:41:in `perform&#39;</span>
</span></span><span style="display:flex;"><span>  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/lib/compass/commands/base.rb:18:in <span style="color:#e6db74">`</span>execute<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/lib/compass/commands/project_base.rb:19:in `execute&#39;</span>
</span></span><span style="display:flex;"><span>  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/lib/compass/exec/sub_command_ui.rb:43:in <span style="color:#e6db74">`</span>perform!<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/lib/compass/exec/sub_command_ui.rb:15:in `run!&#39;</span>
</span></span><span style="display:flex;"><span>  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/bin/compass:30:in <span style="color:#e6db74">`</span>block in &lt;top <span style="color:#f92672">(</span>required<span style="color:#f92672">)</span>&gt;<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/bin/compass:44:in `call&#39;</span>
</span></span><span style="display:flex;"><span>  /Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/bin/compass:44:in <span style="color:#e6db74">`</span>&lt;top <span style="color:#f92672">(</span>required<span style="color:#f92672">)</span>&gt;<span style="color:#e6db74">&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">  /usr/local/bin/compass:23:in `load&#39;</span>
</span></span><span style="display:flex;"><span>  /usr/local/bin/compass:23:in <span style="color:#e6db74">`</span>&lt;main&gt;<span style="color:#960050;background-color:#1e0010">&#39;</span>
</span></span></code></pre></div><p>I solved it <a href="http://code.tutsplus.com/tutorials/how-to-install-ruby-on-a-mac--net-21664">by using a more recent version of Ruby using RVM</a>. RVM is pretty cool because you can switch your Ruby versions very easily. Note that I had to re-install compass afterwards.</p>
]]></content>
        </item>
        
        <item>
            <title>How to add a new stock option in Woocommerce</title>
            <link>/en/posts/2016/03/how-to-add-a-new-stock-option-in-woocommerce/</link>
            <pubDate>Tue, 22 Mar 2016 18:53:53 +0000</pubDate>
            
            <guid>/en/posts/2016/03/how-to-add-a-new-stock-option-in-woocommerce/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Sometimes, clients can come up with some pretty creative ways to handle their inventory … It was the case for me with a customer who was using WooCommerce.&lt;/p&gt;
&lt;p&gt;I had to add a third option but the stock options was not customizable. I ended up deleting the native dropdown of stock options and I implemented a custom field.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>Sometimes, clients can come up with some pretty creative ways to handle their inventory … It was the case for me with a customer who was using WooCommerce.</p>
<p>I had to add a third option but the stock options was not customizable. I ended up deleting the native dropdown of stock options and I implemented a custom field.</p>
<p>In functions.php</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#a6e22e">add_action</span>(<span style="color:#e6db74">&#39;woocommerce_product_options_stock_status&#39;</span>, <span style="color:#e6db74">&#39;add_custom_stock_type&#39;</span>);    
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> <span style="color:#a6e22e">add_custom_stock_type</span>() {
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">// Stock status - We remove the default one
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        <span style="color:#75715e">?&gt;</span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">        &lt;script type=&#34;text/javascript&#34;&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">            jQuery(&#39;_stock_status&#39;).remove();
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">        &lt;/script&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">        &lt;?php   
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">    }
</span></span></span></code></pre></div><p>And then I followed <a href="http://www.remicorson.com/mastering-woocommerce-products-custom-fields/">this tutorial</a> to create a custom field : <a href="http://www.remicorson.com/mastering-woocommerce-products-custom-fields/">http://www.remicorson.com/mastering-woocommerce-products-custom-fields/</a></p>
<p><a href="http://stackoverflow.com/questions/26912556/add-stock-option-in-woocommerce/26916930#26916930">Someone on SO</a> proposed an other solution based on my approach but my contract was already done with that client by the time he answered, didn’t get the chance to test it out.</p>
]]></content>
        </item>
        
        <item>
            <title>Look for a word in a group of div using only jQuery</title>
            <link>/en/posts/2016/03/look-for-a-word-in-a-group-of-div-using-only-jquery/</link>
            <pubDate>Tue, 22 Mar 2016 18:44:23 +0000</pubDate>
            
            <guid>/en/posts/2016/03/look-for-a-word-in-a-group-of-div-using-only-jquery/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For an old project, I had to implement a search tool in a static page. No option for me to use any server side language, I had to implement that search tool using Javascript / jQuery.&lt;/p&gt;
&lt;p&gt;The following function&amp;rsquo;s purpose is to :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Search amongst a group of divs that have the class qa-faqs if a word is present in the content&lt;/li&gt;
&lt;li&gt;Exclude stop-words in french and in english from the query entered by the user&lt;/li&gt;
&lt;li&gt;List of words to exclude is in the var words_to_exclude&lt;/li&gt;
&lt;li&gt;Order the divs by data-relevance (times the searched word appears in each div)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Please note that the following function uses the awesome plugin &lt;a href=&#34;http://bartaz.github.io/sandbox.js/jquery.highlight.html&#34;&gt;jQuery.highlight&lt;/a&gt;&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>For an old project, I had to implement a search tool in a static page. No option for me to use any server side language, I had to implement that search tool using Javascript / jQuery.</p>
<p>The following function&rsquo;s purpose is to :</p>
<ul>
<li>Search amongst a group of divs that have the class qa-faqs if a word is present in the content</li>
<li>Exclude stop-words in french and in english from the query entered by the user</li>
<li>List of words to exclude is in the var words_to_exclude</li>
<li>Order the divs by data-relevance (times the searched word appears in each div)</li>
</ul>
<p>Please note that the following function uses the awesome plugin <a href="http://bartaz.github.io/sandbox.js/jquery.highlight.html">jQuery.highlight</a></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#a6e22e">jQuery</span>.<span style="color:#a6e22e">extend</span>({
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">highlight</span><span style="color:#f92672">:</span> <span style="color:#66d9ef">function</span> (<span style="color:#a6e22e">node</span>, <span style="color:#a6e22e">re</span>, <span style="color:#a6e22e">nodeName</span>, <span style="color:#a6e22e">className</span>) {
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">node</span>.<span style="color:#a6e22e">nodeType</span> <span style="color:#f92672">===</span> <span style="color:#ae81ff">3</span>) {
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">match</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">node</span>.<span style="color:#a6e22e">data</span>.<span style="color:#a6e22e">match</span>(<span style="color:#a6e22e">re</span>);
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">match</span>) {
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">highlight</span> <span style="color:#f92672">=</span> document.<span style="color:#a6e22e">createElement</span>(<span style="color:#a6e22e">nodeName</span> <span style="color:#f92672">||</span> <span style="color:#e6db74">&#39;span&#39;</span>);
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">highlight</span>.<span style="color:#a6e22e">className</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">className</span> <span style="color:#f92672">||</span> <span style="color:#e6db74">&#39;highlight&#39;</span>;
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">wordNode</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">node</span>.<span style="color:#a6e22e">splitText</span>(<span style="color:#a6e22e">match</span>.<span style="color:#a6e22e">index</span>);
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">wordNode</span>.<span style="color:#a6e22e">splitText</span>(<span style="color:#a6e22e">match</span>[<span style="color:#ae81ff">0</span>].<span style="color:#a6e22e">length</span>);
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">wordClone</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">wordNode</span>.<span style="color:#a6e22e">cloneNode</span>(<span style="color:#66d9ef">true</span>);
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">highlight</span>.<span style="color:#a6e22e">appendChild</span>(<span style="color:#a6e22e">wordClone</span>);
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">wordNode</span>.<span style="color:#a6e22e">parentNode</span>.<span style="color:#a6e22e">replaceChild</span>(<span style="color:#a6e22e">highlight</span>, <span style="color:#a6e22e">wordNode</span>);
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">return</span> <span style="color:#ae81ff">1</span>; <span style="color:#75715e">//skip added node in parent
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>            }
</span></span><span style="display:flex;"><span>        } <span style="color:#66d9ef">else</span> <span style="color:#66d9ef">if</span> ((<span style="color:#a6e22e">node</span>.<span style="color:#a6e22e">nodeType</span> <span style="color:#f92672">===</span> <span style="color:#ae81ff">1</span> <span style="color:#f92672">&amp;&amp;</span> <span style="color:#a6e22e">node</span>.<span style="color:#a6e22e">childNodes</span>) <span style="color:#f92672">&amp;&amp;</span> <span style="color:#75715e">// only element nodes that have children
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                <span style="color:#f92672">!</span><span style="color:#e6db74">/(script|style)/i</span>.<span style="color:#a6e22e">test</span>(<span style="color:#a6e22e">node</span>.<span style="color:#a6e22e">tagName</span>) <span style="color:#f92672">&amp;&amp;</span> <span style="color:#75715e">// ignore script and style nodes
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>                <span style="color:#f92672">!</span>(<span style="color:#a6e22e">node</span>.<span style="color:#a6e22e">tagName</span> <span style="color:#f92672">===</span> <span style="color:#a6e22e">nodeName</span>.<span style="color:#a6e22e">toUpperCase</span>() <span style="color:#f92672">&amp;&amp;</span> <span style="color:#a6e22e">node</span>.<span style="color:#a6e22e">className</span> <span style="color:#f92672">===</span> <span style="color:#a6e22e">className</span>)) { <span style="color:#75715e">// skip if already highlighted
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>            <span style="color:#66d9ef">for</span> (<span style="color:#66d9ef">var</span> <span style="color:#a6e22e">i</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>; <span style="color:#a6e22e">i</span> <span style="color:#f92672">&amp;</span><span style="color:#a6e22e">lt</span>; <span style="color:#a6e22e">node</span>.<span style="color:#a6e22e">childNodes</span>.<span style="color:#a6e22e">length</span>; <span style="color:#a6e22e">i</span><span style="color:#f92672">++</span>) {
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">i</span> <span style="color:#f92672">+=</span> <span style="color:#a6e22e">jQuery</span>.<span style="color:#a6e22e">highlight</span>(<span style="color:#a6e22e">node</span>.<span style="color:#a6e22e">childNodes</span>[<span style="color:#a6e22e">i</span>], <span style="color:#a6e22e">re</span>, <span style="color:#a6e22e">nodeName</span>, <span style="color:#a6e22e">className</span>);
</span></span><span style="display:flex;"><span>            }
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">return</span> <span style="color:#ae81ff">0</span>;
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>});
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">jQuery</span>.<span style="color:#a6e22e">fn</span>.<span style="color:#a6e22e">unhighlight</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">function</span> (<span style="color:#a6e22e">options</span>) {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">settings</span> <span style="color:#f92672">=</span> { <span style="color:#a6e22e">className</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;highlight&#39;</span>, <span style="color:#a6e22e">element</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;span&#39;</span> };
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">jQuery</span>.<span style="color:#a6e22e">extend</span>(<span style="color:#a6e22e">settings</span>, <span style="color:#a6e22e">options</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">find</span>(<span style="color:#a6e22e">settings</span>.<span style="color:#a6e22e">element</span> <span style="color:#f92672">+</span> <span style="color:#e6db74">&#34;.&#34;</span> <span style="color:#f92672">+</span> <span style="color:#a6e22e">settings</span>.<span style="color:#a6e22e">className</span>).<span style="color:#a6e22e">each</span>(<span style="color:#66d9ef">function</span> () {
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">parent</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">parentNode</span>;
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">parent</span>.<span style="color:#a6e22e">replaceChild</span>(<span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">firstChild</span>, <span style="color:#66d9ef">this</span>);
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">parent</span>.<span style="color:#a6e22e">normalize</span>();
</span></span><span style="display:flex;"><span>    }).<span style="color:#a6e22e">end</span>();
</span></span><span style="display:flex;"><span>};
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">jQuery</span>.<span style="color:#a6e22e">fn</span>.<span style="color:#a6e22e">highlight</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">function</span> (<span style="color:#a6e22e">words</span>, <span style="color:#a6e22e">options</span>) {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">settings</span> <span style="color:#f92672">=</span> { <span style="color:#a6e22e">className</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;highlight&#39;</span>, <span style="color:#a6e22e">element</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;span&#39;</span>, <span style="color:#a6e22e">caseSensitive</span><span style="color:#f92672">:</span> <span style="color:#66d9ef">false</span>, <span style="color:#a6e22e">wordsOnly</span><span style="color:#f92672">:</span> <span style="color:#66d9ef">false</span> };
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">jQuery</span>.<span style="color:#a6e22e">extend</span>(<span style="color:#a6e22e">settings</span>, <span style="color:#a6e22e">options</span>);
</span></span><span style="display:flex;"><span>    
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">words</span>.<span style="color:#a6e22e">constructor</span> <span style="color:#f92672">===</span> String) {
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">words</span> <span style="color:#f92672">=</span> [<span style="color:#a6e22e">words</span>];
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">words</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">jQuery</span>.<span style="color:#a6e22e">grep</span>(<span style="color:#a6e22e">words</span>, <span style="color:#66d9ef">function</span>(<span style="color:#a6e22e">word</span>, <span style="color:#a6e22e">i</span>){
</span></span><span style="display:flex;"><span>      <span style="color:#66d9ef">return</span> <span style="color:#a6e22e">word</span> <span style="color:#f92672">!=</span> <span style="color:#e6db74">&#39;&#39;</span>;
</span></span><span style="display:flex;"><span>    });
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">words</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">jQuery</span>.<span style="color:#a6e22e">map</span>(<span style="color:#a6e22e">words</span>, <span style="color:#66d9ef">function</span>(<span style="color:#a6e22e">word</span>, <span style="color:#a6e22e">i</span>) {
</span></span><span style="display:flex;"><span>      <span style="color:#66d9ef">return</span> <span style="color:#a6e22e">word</span>.<span style="color:#a6e22e">replace</span>(<span style="color:#e6db74">/[-[\]{}()*+?.,\\^$|#\s]/g</span>, <span style="color:#e6db74">&#34;\\$&amp;&#34;</span>);
</span></span><span style="display:flex;"><span>    });
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">words</span>.<span style="color:#a6e22e">length</span> <span style="color:#f92672">==</span> <span style="color:#ae81ff">0</span>) { <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">this</span>; };
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">flag</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">settings</span>.<span style="color:#a6e22e">caseSensitive</span> <span style="color:#f92672">?</span> <span style="color:#e6db74">&#34;&#34;</span> <span style="color:#f92672">:</span> <span style="color:#e6db74">&#34;i&#34;</span>;
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">pattern</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;(&#34;</span> <span style="color:#f92672">+</span> <span style="color:#a6e22e">words</span>.<span style="color:#a6e22e">join</span>(<span style="color:#e6db74">&#34;|&#34;</span>) <span style="color:#f92672">+</span> <span style="color:#e6db74">&#34;)&#34;</span>;
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">settings</span>.<span style="color:#a6e22e">wordsOnly</span>) {
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">pattern</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;\\b&#34;</span> <span style="color:#f92672">+</span> <span style="color:#a6e22e">pattern</span> <span style="color:#f92672">+</span> <span style="color:#e6db74">&#34;\\b&#34;</span>;
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">re</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> RegExp(<span style="color:#a6e22e">pattern</span>, <span style="color:#a6e22e">flag</span>);
</span></span><span style="display:flex;"><span>    
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">each</span>(<span style="color:#66d9ef">function</span> () {
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">jQuery</span>.<span style="color:#a6e22e">highlight</span>(<span style="color:#66d9ef">this</span>, <span style="color:#a6e22e">re</span>, <span style="color:#a6e22e">settings</span>.<span style="color:#a6e22e">element</span>, <span style="color:#a6e22e">settings</span>.<span style="color:#a6e22e">className</span>);
</span></span><span style="display:flex;"><span>    });
</span></span><span style="display:flex;"><span>};
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">jQuery</span>(document).<span style="color:#a6e22e">ready</span>(<span style="color:#66d9ef">function</span>(<span style="color:#a6e22e">$</span>) {
</span></span><span style="display:flex;"><span>  
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#34;div[id^=qa-faq]&#34;</span>).<span style="color:#a6e22e">each</span>(<span style="color:#66d9ef">function</span> () {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">num</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">this</span>.<span style="color:#a6e22e">id</span>.<span style="color:#a6e22e">match</span>(<span style="color:#e6db74">/qa-faq(\d+)/</span>)[<span style="color:#ae81ff">1</span>];
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">faqContainer</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.qa-faqs&#39;</span>);
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">faq</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;#qa-faq&#39;</span> <span style="color:#f92672">+</span> <span style="color:#a6e22e">num</span>);
</span></span><span style="display:flex;"><span>    
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> ( <span style="color:#a6e22e">faqContainer</span>.<span style="color:#a6e22e">is</span>(<span style="color:#e6db74">&#39;.collapsible&#39;</span>) ) {
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>      <span style="color:#a6e22e">faq</span>.<span style="color:#a6e22e">find</span>(<span style="color:#e6db74">&#39;.qa-faq-anchor&#39;</span>).<span style="color:#a6e22e">bind</span>(<span style="color:#e6db74">&#34;click&#34;</span>, <span style="color:#66d9ef">function</span>() {
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">if</span> ( <span style="color:#a6e22e">faqContainer</span>.<span style="color:#a6e22e">is</span>(<span style="color:#e6db74">&#39;.accordion&#39;</span>) ) {
</span></span><span style="display:flex;"><span>          <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.qa-faq-answer&#39;</span>).<span style="color:#a6e22e">not</span>(<span style="color:#e6db74">&#39;#qa-faq&#39;</span> <span style="color:#f92672">+</span> <span style="color:#a6e22e">num</span> <span style="color:#f92672">+</span> <span style="color:#e6db74">&#39; .qa-faq-answer&#39;</span>).<span style="color:#a6e22e">hide</span>();
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">if</span> ( <span style="color:#a6e22e">faqContainer</span>.<span style="color:#a6e22e">is</span>(<span style="color:#e6db74">&#39;.animation-fade&#39;</span>) ) {
</span></span><span style="display:flex;"><span>          <span style="color:#a6e22e">faq</span>.<span style="color:#a6e22e">find</span>(<span style="color:#e6db74">&#39;.qa-faq-answer&#39;</span>).<span style="color:#a6e22e">fadeToggle</span>();
</span></span><span style="display:flex;"><span>        } <span style="color:#66d9ef">else</span> <span style="color:#66d9ef">if</span> ( <span style="color:#a6e22e">faqContainer</span>.<span style="color:#a6e22e">is</span>(<span style="color:#e6db74">&#39;.animation-slide&#39;</span>) ) {
</span></span><span style="display:flex;"><span>          <span style="color:#a6e22e">faq</span>.<span style="color:#a6e22e">find</span>(<span style="color:#e6db74">&#39;.qa-faq-answer&#39;</span>).<span style="color:#a6e22e">slideToggle</span>();
</span></span><span style="display:flex;"><span>        } <span style="color:#66d9ef">else</span>  <span style="color:#75715e">/* no animation */</span> {
</span></span><span style="display:flex;"><span>          <span style="color:#a6e22e">faq</span>.<span style="color:#a6e22e">find</span>(<span style="color:#e6db74">&#39;.qa-faq-answer&#39;</span>).<span style="color:#a6e22e">toggle</span>();
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">false</span>;
</span></span><span style="display:flex;"><span>      });
</span></span><span style="display:flex;"><span>    
</span></span><span style="display:flex;"><span>      <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.expand-all.expand&#39;</span>).<span style="color:#a6e22e">bind</span>(<span style="color:#e6db74">&#34;click&#34;</span>, <span style="color:#66d9ef">function</span>() {
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.expand-all.expand&#39;</span>).<span style="color:#a6e22e">hide</span>();
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.expand-all.collapse&#39;</span>).<span style="color:#a6e22e">show</span>();
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">if</span> ( <span style="color:#a6e22e">faqContainer</span>.<span style="color:#a6e22e">is</span>(<span style="color:#e6db74">&#39;.animation-fade&#39;</span>) ) {
</span></span><span style="display:flex;"><span>          <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.qa-faq-answer&#39;</span>).<span style="color:#a6e22e">fadeIn</span>(<span style="color:#ae81ff">400</span>);
</span></span><span style="display:flex;"><span>        } <span style="color:#66d9ef">else</span> <span style="color:#66d9ef">if</span> ( <span style="color:#a6e22e">faqContainer</span>.<span style="color:#a6e22e">is</span>(<span style="color:#e6db74">&#39;.animation-slide&#39;</span>) ) {
</span></span><span style="display:flex;"><span>          <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.qa-faq-answer&#39;</span>).<span style="color:#a6e22e">slideDown</span>();
</span></span><span style="display:flex;"><span>        } <span style="color:#66d9ef">else</span>  <span style="color:#75715e">/* no animation */</span> {
</span></span><span style="display:flex;"><span>          <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.qa-faq-answer&#39;</span>).<span style="color:#a6e22e">show</span>();
</span></span><span style="display:flex;"><span>        }	
</span></span><span style="display:flex;"><span>      });
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>      <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.expand-all.collapse&#39;</span>).<span style="color:#a6e22e">bind</span>(<span style="color:#e6db74">&#34;click&#34;</span>, <span style="color:#66d9ef">function</span>() {
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.expand-all.collapse&#39;</span>).<span style="color:#a6e22e">hide</span>();
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.expand-all.expand&#39;</span>).<span style="color:#a6e22e">show</span>();
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">if</span> ( <span style="color:#a6e22e">faqContainer</span>.<span style="color:#a6e22e">is</span>(<span style="color:#e6db74">&#39;.animation-fade&#39;</span>) ) {
</span></span><span style="display:flex;"><span>          <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.qa-faq-answer&#39;</span>).<span style="color:#a6e22e">fadeOut</span>(<span style="color:#ae81ff">400</span>);
</span></span><span style="display:flex;"><span>        } <span style="color:#66d9ef">else</span> <span style="color:#66d9ef">if</span> ( <span style="color:#a6e22e">faqContainer</span>.<span style="color:#a6e22e">is</span>(<span style="color:#e6db74">&#39;.animation-slide&#39;</span>) ) {
</span></span><span style="display:flex;"><span>          <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.qa-faq-answer&#39;</span>).<span style="color:#a6e22e">slideUp</span>();
</span></span><span style="display:flex;"><span>        } <span style="color:#66d9ef">else</span>  <span style="color:#75715e">/* no animation */</span> {
</span></span><span style="display:flex;"><span>          <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.qa-faq-answer&#39;</span>).<span style="color:#a6e22e">hide</span>();
</span></span><span style="display:flex;"><span>        }	
</span></span><span style="display:flex;"><span>      });
</span></span><span style="display:flex;"><span>      
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>  });
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.qasubmission&#39;</span>).<span style="color:#a6e22e">bind</span>(<span style="color:#e6db74">&#34;click&#34;</span>, <span style="color:#66d9ef">function</span>() {
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;#postbox&#39;</span>).<span style="color:#a6e22e">fadeToggle</span>();
</span></span><span style="display:flex;"><span>  });
</span></span><span style="display:flex;"><span>  
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;#qaplus_searchform&#39;</span>).<span style="color:#a6e22e">submit</span>(<span style="color:#66d9ef">function</span>() { 
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">query</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">$</span>(<span style="color:#66d9ef">this</span>).<span style="color:#a6e22e">find</span>(<span style="color:#e6db74">&#39;.qaplus_search&#39;</span>).<span style="color:#a6e22e">val</span>();
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">jQuery</span>(<span style="color:#e6db74">&#39;.no-results-found&#39;</span>).<span style="color:#a6e22e">hide</span>();
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">search</span>(<span style="color:#a6e22e">query</span>); 
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">false</span>;
</span></span><span style="display:flex;"><span>  });
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">function</span> <span style="color:#a6e22e">search</span>(<span style="color:#a6e22e">query</span>) { 
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">words_to_exclude</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;a,able,about,across,after,all,almost,also,am,among,an,and,any,are,as,at,be,because,been,but,by,can,cannot,could,dear,did,do,does,either,else,ever,every,for,from,get,got,had,has,have,he,her,hers,him,his,how,however,i,if,in,into,is,it,its,just,least,let,like,likely,may,me,might,most,must,my,neither,no,nor,not,of,off,often,on,only,or,other,our,own,rather,said,say,says,she,should,since,so,some,than,that,the,their,them,then,there,these,they,this,tis,to,too,twas,us,wants,was,we,were,what,when,where,which,while,who,whom,why,will,with,would,yet,you,your,alors,au,aucuns,aussi,autre,avant,avec,avoir,bon,car,ce,cela,ces,ceux,chaque,ci,comme,comment,dans,des,du,dedans,dehors,depuis,deux,devrait,doit,donc,dos,droite,début,elle,elles,en,encore,essai,est,et,eu,fait,faites,fois,font,force,haut,hors,ici,il,ils,je,juste,la,le,les,leur,là,ma,maintenant,mais,mes,mine,moins,mon,mot,même,ni,nommés,notre,nous,nouveaux,ou,où,par,parce,parole,pas,personnes,peut,peu,pièce,plupart,pour,pourquoi,quand,que,quel,quelle,quelles,quels,qui,sa,sans,ses,seulement,si,sien,son,sont,sous,soyez,sujet,sur,ta,tandis,tellement,tels,tes,ton,tous,tout,trop,très,tu,valeur,voie,voient,vont,votre,vous,vu,ça,étaient,état,étions,été,être&#39;</span>;
</span></span><span style="display:flex;"><span>    
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">query</span>.<span style="color:#a6e22e">replace</span>(<span style="color:#a6e22e">words_to_exclude</span>, <span style="color:#e6db74">&#39; &#39;</span>);
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> ( <span style="color:#a6e22e">query</span>.<span style="color:#a6e22e">length</span> <span style="color:#f92672">&amp;</span><span style="color:#a6e22e">gt</span>; <span style="color:#ae81ff">0</span> ) { 
</span></span><span style="display:flex;"><span>      <span style="color:#a6e22e">jQuery</span>(<span style="color:#e6db74">&#34;.qa-faqs&#34;</span>).<span style="color:#a6e22e">highlight</span>(<span style="color:#a6e22e">query</span>.<span style="color:#a6e22e">split</span>(<span style="color:#e6db74">&#34; &#34;</span>), {<span style="color:#a6e22e">className</span> <span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;showme&#39;</span>} );
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>      <span style="color:#66d9ef">if</span> ( <span style="color:#a6e22e">jQuery</span>(<span style="color:#e6db74">&#39;.showme&#39;</span>).<span style="color:#a6e22e">length</span> <span style="color:#f92672">==</span> <span style="color:#ae81ff">0</span> ) {
</span></span><span style="display:flex;"><span>        <span style="color:#75715e">// This search has no matching results
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>        <span style="color:#a6e22e">jQuery</span>(<span style="color:#e6db74">&#39;.no-results-found&#39;</span>).<span style="color:#a6e22e">show</span>();
</span></span><span style="display:flex;"><span>      } 
</span></span><span style="display:flex;"><span>      <span style="color:#75715e">// Update reference
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>      <span style="color:#a6e22e">jQuery</span>(<span style="color:#e6db74">&#34;.qa-faq&#34;</span>).<span style="color:#a6e22e">attr</span>(<span style="color:#e6db74">&#39;data-relevance&#39;</span>, <span style="color:#e6db74">&#39;0&#39;</span>).<span style="color:#a6e22e">hide</span>().<span style="color:#a6e22e">find</span>(<span style="color:#e6db74">&#34;span.showme&#34;</span>).<span style="color:#a6e22e">each</span>(<span style="color:#66d9ef">function</span>() {
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">incr</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">1</span>;
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">if</span> ( <span style="color:#a6e22e">jQuery</span>(<span style="color:#66d9ef">this</span>).<span style="color:#a6e22e">parent</span>().<span style="color:#a6e22e">hasClass</span>(<span style="color:#e6db74">&#39;qa-faq-anchor&#39;</span>) ) {
</span></span><span style="display:flex;"><span>          <span style="color:#a6e22e">incr</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">incr</span> <span style="color:#f92672">+</span> <span style="color:#ae81ff">2</span>;
</span></span><span style="display:flex;"><span>        }  
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">item</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">jQuery</span>(<span style="color:#66d9ef">this</span>).<span style="color:#a6e22e">removeClass</span>(<span style="color:#e6db74">&#39;showme&#39;</span>).<span style="color:#a6e22e">parents</span>(<span style="color:#e6db74">&#39;.qa-faq&#39;</span>);
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">item</span>.<span style="color:#a6e22e">attr</span>(<span style="color:#e6db74">&#39;data-relevance&#39;</span>, parseInt(<span style="color:#a6e22e">item</span>.<span style="color:#a6e22e">attr</span>(<span style="color:#e6db74">&#39;data-relevance&#39;</span>)) <span style="color:#f92672">+</span> <span style="color:#a6e22e">incr</span> ).<span style="color:#a6e22e">show</span>();
</span></span><span style="display:flex;"><span>      });
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>      <span style="color:#75715e">// Sort questions
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>      <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">$wrapper</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.qa-faqs&#39;</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>      <span style="color:#a6e22e">$wrapper</span>.<span style="color:#a6e22e">find</span>(<span style="color:#e6db74">&#39;.qa-faq&#39;</span>).<span style="color:#a6e22e">sort</span>(<span style="color:#66d9ef">function</span> (<span style="color:#a6e22e">a</span>, <span style="color:#a6e22e">b</span>) {
</span></span><span style="display:flex;"><span>          <span style="color:#66d9ef">return</span> <span style="color:#a6e22e">b</span>.<span style="color:#a6e22e">dataset</span>.<span style="color:#a6e22e">relevance</span> <span style="color:#f92672">-</span> <span style="color:#a6e22e">a</span>.<span style="color:#a6e22e">dataset</span>.<span style="color:#a6e22e">relevance</span>;
</span></span><span style="display:flex;"><span>      }).<span style="color:#a6e22e">appendTo</span>( <span style="color:#a6e22e">$wrapper</span> );	 
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">else</span> {
</span></span><span style="display:flex;"><span>      <span style="color:#66d9ef">var</span> <span style="color:#a6e22e">$wrapper</span> <span style="color:#f92672">=</span> <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.qa-faqs&#39;</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>      <span style="color:#a6e22e">$wrapper</span>.<span style="color:#a6e22e">find</span>(<span style="color:#e6db74">&#39;.qa-faq&#39;</span>).<span style="color:#a6e22e">show</span>().<span style="color:#a6e22e">sort</span>(<span style="color:#66d9ef">function</span> (<span style="color:#a6e22e">a</span>, <span style="color:#a6e22e">b</span>) {
</span></span><span style="display:flex;"><span>          <span style="color:#66d9ef">return</span> <span style="color:#a6e22e">b</span>.<span style="color:#a6e22e">dataset</span>.<span style="color:#a6e22e">origin</span> <span style="color:#f92672">-</span> <span style="color:#a6e22e">a</span>.<span style="color:#a6e22e">dataset</span>.<span style="color:#a6e22e">origin</span>;
</span></span><span style="display:flex;"><span>      }).<span style="color:#a6e22e">appendTo</span>( <span style="color:#a6e22e">$wrapper</span> );
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#34;html, body&#34;</span>).<span style="color:#a6e22e">animate</span>({ <span style="color:#a6e22e">scrollTop</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;.faq-container&#39;</span>).<span style="color:#a6e22e">offset</span>().<span style="color:#a6e22e">top</span> }, <span style="color:#ae81ff">500</span>, <span style="color:#e6db74">&#39;swing&#39;</span>);
</span></span><span style="display:flex;"><span> 
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> <span style="color:#66d9ef">false</span>;
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>});
</span></span></code></pre></div>]]></content>
        </item>
        
        <item>
            <title>VirtualBox CheatSheet</title>
            <link>/en/posts/2016/02/virtualbox-cheatsheet/</link>
            <pubDate>Thu, 18 Feb 2016 16:08:10 +0000</pubDate>
            
            <guid>/en/posts/2016/02/virtualbox-cheatsheet/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here is a couple of commands I’ve used in a previous life while trying to resize a Vagrant machine.&lt;/p&gt;
&lt;h4 id=&#34;list-the-virtual-disk-images-used-by-virtual-box&#34;&gt;List the virtual disk images used by Virtual Box&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;vboxmanage list hdds&lt;/code&gt;&lt;/p&gt;
&lt;h4 id=&#34;remove-a-hard-disk-from-a-virtual-box-registry&#34;&gt;Remove a hard disk from a Virtual Box registry&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;vboxmanage closemedium disk a5bad1ba-5ff7-4b83-87ff-adb18f05269a --delete&lt;/code&gt;&lt;/p&gt;
&lt;h4 id=&#34;how-to-resize-a-hard-disk-for-a-virtual-machine-8211-tutorialhttpsgistgithubcomchristopher-hopper9755310&#34;&gt;&lt;a href=&#34;https://gist.github.com/christopher-hopper/9755310&#34;&gt;How to resize a hard disk for a Virtual Machine – Tutorial&lt;/a&gt;&lt;/h4&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>Here is a couple of commands I’ve used in a previous life while trying to resize a Vagrant machine.</p>
<h4 id="list-the-virtual-disk-images-used-by-virtual-box">List the virtual disk images used by Virtual Box</h4>
<p><code>vboxmanage list hdds</code></p>
<h4 id="remove-a-hard-disk-from-a-virtual-box-registry">Remove a hard disk from a Virtual Box registry</h4>
<p><code>vboxmanage closemedium disk a5bad1ba-5ff7-4b83-87ff-adb18f05269a --delete</code></p>
<h4 id="how-to-resize-a-hard-disk-for-a-virtual-machine-8211-tutorialhttpsgistgithubcomchristopher-hopper9755310"><a href="https://gist.github.com/christopher-hopper/9755310">How to resize a hard disk for a Virtual Machine – Tutorial</a></h4>
]]></content>
        </item>
        
        <item>
            <title>Folders not appearing in the tree on the left panel - PHP Storm</title>
            <link>/en/posts/2016/01/folders-not-appearing-in-the-tree-on-the-left-panel-php-storm/</link>
            <pubDate>Tue, 12 Jan 2016 12:05:17 +0000</pubDate>
            
            <guid>/en/posts/2016/01/folders-not-appearing-in-the-tree-on-the-left-panel-php-storm/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;At some point, my folders were not appearing anymore in my Tree on the left Panel like this fellow below.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://devnet.jetbrains.com/message/5448105?tstart=0&#34;&gt;https://devnet.jetbrains.com/message/5448105?tstart=0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I ended up reading online that it occurs when you hit « Cancel » during the load of a project. I restarted PHPStorm and let it load all the components of the project and it worked.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>At some point, my folders were not appearing anymore in my Tree on the left Panel like this fellow below.</p>
<p><a href="https://devnet.jetbrains.com/message/5448105?tstart=0">https://devnet.jetbrains.com/message/5448105?tstart=0</a></p>
<p>I ended up reading online that it occurs when you hit « Cancel » during the load of a project. I restarted PHPStorm and let it load all the components of the project and it worked.</p>
]]></content>
        </item>
        
        <item>
            <title>How to indent a large XML file (Ubuntu)</title>
            <link>/en/posts/2016/01/how-to-indent-a-large-xml-file-ubuntu/</link>
            <pubDate>Mon, 11 Jan 2016 15:59:23 +0000</pubDate>
            
            <guid>/en/posts/2016/01/how-to-indent-a-large-xml-file-ubuntu/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had to indent an extremely large XML file today. I tried to use different IDE (PHPStorm, Sublime Text 3), however the file was way too large and it took a long time to process.&lt;/p&gt;
&lt;p&gt;Best way to do that is by using command line.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;xmllint --format input.xml -o indented-output.xml&lt;/code&gt;&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>I had to indent an extremely large XML file today. I tried to use different IDE (PHPStorm, Sublime Text 3), however the file was way too large and it took a long time to process.</p>
<p>Best way to do that is by using command line.</p>
<p><code>xmllint --format input.xml -o indented-output.xml</code></p>
]]></content>
        </item>
        
        <item>
            <title>Extract characters after the last dash of a String RegExp</title>
            <link>/en/posts/2016/01/extract-characters-after-the-last-dash-of-a-string-regexp/</link>
            <pubDate>Sun, 10 Jan 2016 16:51:21 +0000</pubDate>
            
            <guid>/en/posts/2016/01/extract-characters-after-the-last-dash-of-a-string-regexp/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I wanted to extract characters after the last dash of a string. Regular expression are such a powerful tool to use in these cases. Here’s the one I needed for my problem :&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(\w+)[^-]*$&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Please note that with PHP, you need to use the preg_match method and surround the regexp with slashes.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;preg_match&lt;/span&gt; (&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/(\w+)[^-]*$/&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;cgo3020-red-xs&amp;#39;&lt;/span&gt;, $results); &lt;span style=&#34;color:#75715e&#34;&gt;// returns xs in $results[0]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here’s a pretty convenient tool to test your regexp:  https://regex101.com/&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>I wanted to extract characters after the last dash of a string. Regular expression are such a powerful tool to use in these cases. Here’s the one I needed for my problem :</p>
<p><code>(\w+)[^-]*$</code></p>
<p>Please note that with PHP, you need to use the preg_match method and surround the regexp with slashes.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#a6e22e">preg_match</span> (<span style="color:#e6db74">&#39;/(\w+)[^-]*$/&#39;</span>, <span style="color:#e6db74">&#39;cgo3020-red-xs&#39;</span>, $results); <span style="color:#75715e">// returns xs in $results[0]
</span></span></span></code></pre></div><p>Here’s a pretty convenient tool to test your regexp:  https://regex101.com/</p>
]]></content>
        </item>
        
        <item>
            <title>PHP / Magento - Direct SQL Queries</title>
            <link>/en/posts/2015/12/php-/-magento-direct-sql-queries/</link>
            <pubDate>Tue, 22 Dec 2015 11:37:54 +0000</pubDate>
            
            <guid>/en/posts/2015/12/php-/-magento-direct-sql-queries/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Not the cleanest but here’s a quick solution to do a direct query on Magento. Might be faster than calling Magento’s objects ?&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;   * Get the resource model
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;   */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$resource &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Mage&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;getSingleton&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;core/resource&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  * Acccess to the database in read only
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$readConnection &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; $resource&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;amp;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;gt&lt;/span&gt;;&lt;span style=&#34;color:#a6e22e&#34;&gt;getConnection&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;core_read&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$query &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;SELECT * FROM &amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt; $resource&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;amp;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;gt&lt;/span&gt;;&lt;span style=&#34;color:#a6e22e&#34;&gt;getTableName&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;catalog/product&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; * Execute the query  
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$results &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; $readConnection&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;amp;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;gt&lt;/span&gt;;&lt;span style=&#34;color:#a6e22e&#34;&gt;fetchAll&lt;/span&gt;($query);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;a href=&#34;http://www.devproblems.com/magento-direct-sql-queries/&#34;&gt;Thank you DevProblems !&lt;/a&gt;&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>Not the cleanest but here’s a quick solution to do a direct query on Magento. Might be faster than calling Magento’s objects ?</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#e6db74">/**
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">   * Get the resource model
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">   */</span>
</span></span><span style="display:flex;"><span>$resource <span style="color:#f92672">=</span> <span style="color:#a6e22e">Mage</span><span style="color:#f92672">::</span><span style="color:#a6e22e">getSingleton</span>(<span style="color:#e6db74">&#39;core/resource&#39;</span>);
</span></span><span style="display:flex;"><span>     
</span></span><span style="display:flex;"><span> <span style="color:#e6db74">/**
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">  * Acccess to the database in read only
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">  */</span>
</span></span><span style="display:flex;"><span>$readConnection <span style="color:#f92672">=</span> $resource<span style="color:#f92672">-&amp;</span><span style="color:#a6e22e">gt</span>;<span style="color:#a6e22e">getConnection</span>(<span style="color:#e6db74">&#39;core_read&#39;</span>);
</span></span><span style="display:flex;"><span>     
</span></span><span style="display:flex;"><span>$query <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;SELECT * FROM &#39;</span> <span style="color:#f92672">.</span> $resource<span style="color:#f92672">-&amp;</span><span style="color:#a6e22e">gt</span>;<span style="color:#a6e22e">getTableName</span>(<span style="color:#e6db74">&#39;catalog/product&#39;</span>);
</span></span><span style="display:flex;"><span>     
</span></span><span style="display:flex;"><span><span style="color:#e6db74">/**
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> * Execute the query  
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74"> */</span>
</span></span><span style="display:flex;"><span>$results <span style="color:#f92672">=</span> $readConnection<span style="color:#f92672">-&amp;</span><span style="color:#a6e22e">gt</span>;<span style="color:#a6e22e">fetchAll</span>($query);
</span></span></code></pre></div><p><a href="http://www.devproblems.com/magento-direct-sql-queries/">Thank you DevProblems !</a></p>
]]></content>
        </item>
        
        <item>
            <title>SQL Magento - Get store credit balance</title>
            <link>/en/posts/2015/12/sql-magento-get-store-credit-balance/</link>
            <pubDate>Mon, 21 Dec 2015 17:48:06 +0000</pubDate>
            
            <guid>/en/posts/2015/12/sql-magento-get-store-credit-balance/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Valid for Magento EE 1 only. The feature of store credits isn’t native in CE edition.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-SQL&#34; data-lang=&#34;SQL&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;select&lt;/span&gt; amount 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;from&lt;/span&gt; enterprise_customerbalance 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;where&lt;/span&gt; customer_id &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;@&lt;/span&gt;customer_id ;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>Valid for Magento EE 1 only. The feature of store credits isn’t native in CE edition.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-SQL" data-lang="SQL"><span style="display:flex;"><span><span style="color:#66d9ef">select</span> amount 
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">from</span> enterprise_customerbalance 
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">where</span> customer_id <span style="color:#f92672">=</span> <span style="color:#f92672">@</span>customer_id ;
</span></span></code></pre></div>]]></content>
        </item>
        
        <item>
            <title>SQL Magento Get the list of SKUs that are in a catalog_price_rule</title>
            <link>/en/posts/2015/11/sql-magento-get-the-list-of-skus-that-are-in-a-catalog_price_rule/</link>
            <pubDate>Tue, 24 Nov 2015 12:16:55 +0000</pubDate>
            
            <guid>/en/posts/2015/11/sql-magento-get-the-list-of-skus-that-are-in-a-catalog_price_rule/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The parameter « rule_id » can be viewed in the URL when you are editing the catalog price rule.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-SQL&#34; data-lang=&#34;SQL&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;select&lt;/span&gt; sku
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;from&lt;/span&gt; catalog_product_entity
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;where&lt;/span&gt; entity_id &lt;span style=&#34;color:#66d9ef&#34;&gt;in&lt;/span&gt; (
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;SELECT&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;DISTINCT&lt;/span&gt; product_id 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;FROM&lt;/span&gt; catalogrule_product 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;WHERE&lt;/span&gt; rule_id&lt;span style=&#34;color:#f92672&#34;&gt;=&amp;amp;&lt;/span&gt;lt;rule_id&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>The parameter « rule_id » can be viewed in the URL when you are editing the catalog price rule.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-SQL" data-lang="SQL"><span style="display:flex;"><span><span style="color:#66d9ef">select</span> sku
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">from</span> catalog_product_entity
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">where</span> entity_id <span style="color:#66d9ef">in</span> (
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">SELECT</span> <span style="color:#66d9ef">DISTINCT</span> product_id 
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">FROM</span> catalogrule_product 
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">WHERE</span> rule_id<span style="color:#f92672">=&amp;</span>lt;rule_id<span style="color:#f92672">&amp;</span>gt;
</span></span><span style="display:flex;"><span>);
</span></span></code></pre></div>]]></content>
        </item>
        
        <item>
            <title>Couple of books to read for a developer</title>
            <link>/en/posts/2014/09/couple-of-books-to-read-for-a-developer/</link>
            <pubDate>Sun, 21 Sep 2014 18:14:45 +0000</pubDate>
            
            <guid>/en/posts/2014/09/couple-of-books-to-read-for-a-developer/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Some co-workers recommended me some development books. I added comments in the This list will be updated and feel free to add your suggestions in the comments 🙂&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://www.amazon.ca/Lean-In-Women-Work-Will/dp/0385349947&#34;&gt;Lean In – Women, Work, and the Will to Lead&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Life changing book for me. It’s a must read for every women working or not in IT. Men will be interested as well !&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://www.amazon.ca/Cracking-Coding-Interview-Programming-Questions/dp/098478280X&#34;&gt;Cracking the coding interview&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;I always prepare my interviews with this book ! It has pretty good soft-skills questions too.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>Some co-workers recommended me some development books. I added comments in the This list will be updated and feel free to add your suggestions in the comments 🙂</p>
<ul>
<li><a href="http://www.amazon.ca/Lean-In-Women-Work-Will/dp/0385349947">Lean In – Women, Work, and the Will to Lead</a>
<ul>
<li>Life changing book for me. It’s a must read for every women working or not in IT. Men will be interested as well !</li>
</ul>
</li>
<li><a href="http://www.amazon.ca/Cracking-Coding-Interview-Programming-Questions/dp/098478280X">Cracking the coding interview</a>
<ul>
<li>I always prepare my interviews with this book ! It has pretty good soft-skills questions too.</li>
</ul>
</li>
</ul>
<p> </p>
<ul>
<li><a href="http://www.amazon.ca/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882">Clean code: A Handbook of Agile Software Craftmanship</a></li>
<li><a href="http://www.amazon.ca/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215">Domain-Driven Design : Tackling complexity in the heart of the software</a></li>
<li><a href="http://www.amazon.ca/Things-Every-Programmer-Should-Know/dp/0596809484">97 Things Every Programmer Should Know: Collective Wisdom from the Experts</a></li>
<li><a href="http://www.amazon.ca/Effective-Java-Edition-Joshua-Bloch/dp/0321356683">Effective Java</a></li>
</ul>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
]]></content>
        </item>
        
        <item>
            <title>Django Cheat Sheet</title>
            <link>/en/posts/2013/12/django-cheat-sheet/</link>
            <pubDate>Sun, 22 Dec 2013 23:28:23 +0000</pubDate>
            
            <guid>/en/posts/2013/12/django-cheat-sheet/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here are couple of useful commands / tutorials (in french sorry!) to get started easily with Django.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Create a project&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;python django-admin.py startproject project_name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Manually create a subfolder for HTML templates&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Running servers&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;python manage.py runserver&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Create an application (inside of a project)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;python manage.py startapp blog&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You should also read &lt;a href=&#34;http://openclassrooms.com/courses/developpez-votre-site-web-avec-le-framework-django&#34;&gt;the Django course of Open Classrooms&lt;/a&gt;   to get started smoothly 🙂&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>Here are couple of useful commands / tutorials (in french sorry!) to get started easily with Django.</p>
<p><strong>Create a project</strong></p>
<p><code>python django-admin.py startproject project_name</code></p>
<p>Manually create a subfolder for HTML templates</p>
<p><strong>Running servers</strong></p>
<p><code>python manage.py runserver</code></p>
<p><strong>Create an application (inside of a project)</strong></p>
<p><code>python manage.py startapp blog</code></p>
<p>You should also read <a href="http://openclassrooms.com/courses/developpez-votre-site-web-avec-le-framework-django">the Django course of Open Classrooms</a>   to get started smoothly 🙂</p>
]]></content>
        </item>
        
        <item>
            <title>Convert an image into a base64 string Javascript</title>
            <link>/en/posts/2013/12/convert-an-image-into-a-base64-string-javascript/</link>
            <pubDate>Sun, 22 Dec 2013 23:26:54 +0000</pubDate>
            
            <guid>/en/posts/2013/12/convert-an-image-into-a-base64-string-javascript/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here is a little function I did to convert an image into a base64 string (JavaScript only): &lt;a href=&#34;http://pastebin.com/Dfb8TR4g&#34;&gt;http://pastebin.com/Dfb8TR4g&lt;/a&gt;&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>Here is a little function I did to convert an image into a base64 string (JavaScript only): <a href="http://pastebin.com/Dfb8TR4g">http://pastebin.com/Dfb8TR4g</a></p>
]]></content>
        </item>
        
        <item>
            <title>Parsing errors JSON</title>
            <link>/en/posts/2013/06/parsing-errors-json/</link>
            <pubDate>Tue, 25 Jun 2013 23:26:03 +0000</pubDate>
            
            <guid>/en/posts/2013/06/parsing-errors-json/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Parsing JSON with the jQuery method &lt;code&gt;$.parseJSON&lt;/code&gt; can be tricky to debug, specially when you’re using a mobile device.&lt;/p&gt;
&lt;p&gt;Here is a list of errors I encoutered, and the reason why they were raised.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Unexpected token u&lt;/strong&gt;
The method tries to parse a undefined variable&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Unexpected token o&lt;/strong&gt;
The method tries to parse [Object object]&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>Parsing JSON with the jQuery method <code>$.parseJSON</code> can be tricky to debug, specially when you’re using a mobile device.</p>
<p>Here is a list of errors I encoutered, and the reason why they were raised.</p>
<p><strong>Unexpected token u</strong>
The method tries to parse a undefined variable</p>
<p><strong>Unexpected token o</strong>
The method tries to parse [Object object]</p>
]]></content>
        </item>
        
        <item>
            <title>Sessions keep refreshing CodeIgniter</title>
            <link>/en/posts/2013/06/sessions-keep-refreshing-codeigniter/</link>
            <pubDate>Wed, 05 Jun 2013 23:22:47 +0000</pubDate>
            
            <guid>/en/posts/2013/06/sessions-keep-refreshing-codeigniter/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had a bug once, the sessions kept expiring even though the token was still valid.&lt;/p&gt;
&lt;p&gt;I found out that CI_sessions were refreshing the session_id all the time. This was a database issue, be careful on the length of the columns in the database. The column that stored the session_id was too short and the token kept being re-generated since the old one couldn’t be recognized.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>I had a bug once, the sessions kept expiring even though the token was still valid.</p>
<p>I found out that CI_sessions were refreshing the session_id all the time. This was a database issue, be careful on the length of the columns in the database. The column that stored the session_id was too short and the token kept being re-generated since the old one couldn’t be recognized.</p>
<p>This was a tricky bug because it didn’t raise any obvious PHP error… Be careful with the schema of your database folks !</p>
]]></content>
        </item>
        
        <item>
            <title>Create a JSON array dynamically Javascript</title>
            <link>/en/posts/2013/03/create-a-json-array-dynamically-javascript/</link>
            <pubDate>Wed, 20 Mar 2013 23:21:59 +0000</pubDate>
            
            <guid>/en/posts/2013/03/create-a-json-array-dynamically-javascript/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Using only Javascript&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;res&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; [];
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;results&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;rows&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;res&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {};
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;res&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;id&amp;#39;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;foo&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;res&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;woohoo&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>Using only Javascript</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">var</span> <span style="color:#a6e22e">res</span> <span style="color:#f92672">=</span> [];
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">for</span> (<span style="color:#66d9ef">var</span> <span style="color:#a6e22e">i</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>; <span style="color:#a6e22e">i</span> <span style="color:#f92672">&lt;</span> <span style="color:#a6e22e">results</span>.<span style="color:#a6e22e">rows</span>.<span style="color:#a6e22e">length</span>; <span style="color:#a6e22e">i</span><span style="color:#f92672">++</span>) {
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">res</span>[<span style="color:#a6e22e">i</span>] <span style="color:#f92672">=</span> {};
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">res</span>[<span style="color:#a6e22e">i</span>][<span style="color:#e6db74">&#39;id&#39;</span>] <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;foo&#34;</span>;
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">res</span>[<span style="color:#a6e22e">i</span>][<span style="color:#e6db74">&#39;name&#39;</span>] <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;woohoo&#34;</span>;
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div>]]></content>
        </item>
        
        <item>
            <title>Best ways to debug Javascript</title>
            <link>/en/posts/2013/03/best-ways-to-debug-javascript/</link>
            <pubDate>Mon, 18 Mar 2013 23:20:37 +0000</pubDate>
            
            <guid>/en/posts/2013/03/best-ways-to-debug-javascript/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I was looking for an equivalent of PHP’s print_r to debug Javascript Objects and I found this very cool method:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;JSON&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;stringify&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;whatever_obj&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;How about you ? How do you debug objects in Javascript ?&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>I was looking for an equivalent of PHP’s print_r to debug Javascript Objects and I found this very cool method:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#a6e22e">JSON</span>.<span style="color:#a6e22e">stringify</span>(<span style="color:#a6e22e">whatever_obj</span>);
</span></span></code></pre></div><p>How about you ? How do you debug objects in Javascript ?</p>
]]></content>
        </item>
        
        <item>
            <title>Passing arguments in an event handler Javascript</title>
            <link>/en/posts/2013/02/passing-arguments-in-an-event-handler-javascript/</link>
            <pubDate>Tue, 26 Feb 2013 23:19:15 +0000</pubDate>
            
            <guid>/en/posts/2013/02/passing-arguments-in-an-event-handler-javascript/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Careful&lt;/em&gt; You&amp;rsquo;re reading an old article ! Some links might be broken and content may be outdated&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had this problem while working on Leaflet but I think it can be generalized to the issue of passing parameters to an event handler in Javascript. With the « bind » method of jQuery, you can pass parameters by using the data property of event (the object sent when an event is triggered) :&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Careful</em> You&rsquo;re reading an old article ! Some links might be broken and content may be outdated</p>
</blockquote>
<p>I had this problem while working on Leaflet but I think it can be generalized to the issue of passing parameters to an event handler in Javascript. With the « bind » method of jQuery, you can pass parameters by using the data property of event (the object sent when an event is triggered) :</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#a6e22e">$</span>(<span style="color:#a6e22e">marker</span>).<span style="color:#a6e22e">bind</span>(<span style="color:#e6db74">&#34;click&#34;</span>, { <span style="color:#a6e22e">parameter</span> <span style="color:#f92672">:</span> <span style="color:#a6e22e">its_value</span>, <span style="color:#a6e22e">parameter2</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">its_value</span> }, <span style="color:#66d9ef">function</span>(<span style="color:#a6e22e">event</span>) {
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">log</span>(<span style="color:#e6db74">&#34;Your parameter is :&#34;</span> <span style="color:#f92672">+</span> <span style="color:#a6e22e">event</span>.<span style="color:#a6e22e">data</span>.<span style="color:#a6e22e">parameter</span>);
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">log</span>(<span style="color:#e6db74">&#34;Your parameter2 is :&#34;</span> <span style="color:#f92672">+</span> <span style="color:#a6e22e">event</span>.<span style="color:#a6e22e">data</span>.<span style="color:#a6e22e">parameter2</span>);
</span></span><span style="display:flex;"><span><span style="color:#75715e">// your code goes here
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>});
</span></span></code></pre></div><p>As « <!-- raw HTML omitted -->marker<!-- raw HTML omitted --> » was a L.Marker object, I had to convert it into a jQuery object before applying the bind method. <!-- raw HTML omitted -->Thank you Anurag on StackOverflow !!<!-- raw HTML omitted --></p>
]]></content>
        </item>
        
        <item>
            <title>Connect a Gumstix via Serial Eclipse Ubuntu</title>
            <link>/en/posts/2012/11/connect-a-gumstix-via-serial-eclipse-ubuntu/</link>
            <pubDate>Thu, 29 Nov 2012 23:10:47 +0000</pubDate>
            
            <guid>/en/posts/2012/11/connect-a-gumstix-via-serial-eclipse-ubuntu/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Attention&lt;/em&gt; Cet article a quelques années et n&amp;rsquo;est peut-être plus à jour !&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I was following this well-written &lt;!-- raw HTML omitted --&gt;tutorial&lt;!-- raw HTML omitted --&gt; to set up eclipse for my gumstix when I came to the part « Connect your gumstix » (with the Eclipse Terminal). Before setting up the terminal connection on Eclipse, make sure that Eclipse will have the permissions to access to the folder. I didn’t have the permissions and I had the error « /dev/ttyUSB0: No such folder error » even if my board was plugged.&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Attention</em> Cet article a quelques années et n&rsquo;est peut-être plus à jour !</p>
</blockquote>
<p>I was following this well-written <!-- raw HTML omitted -->tutorial<!-- raw HTML omitted --> to set up eclipse for my gumstix when I came to the part « Connect your gumstix » (with the Eclipse Terminal). Before setting up the terminal connection on Eclipse, make sure that Eclipse will have the permissions to access to the folder. I didn’t have the permissions and I had the error « /dev/ttyUSB0: No such folder error » even if my board was plugged.</p>
<p>A simple <strong>chmod</strong> on the folder resolves the issue. Make also sure that you have an UTF-8 encoding, otherwise you gonna have a bad time while reading what’s going on on your board ! 😀</p>
]]></content>
        </item>
        
        <item>
            <title>Installing Bluetooth library Java Interpreter</title>
            <link>/en/posts/2012/10/installing-bluetooth-library-java-interpreter/</link>
            <pubDate>Mon, 22 Oct 2012 23:11:53 +0000</pubDate>
            
            <guid>/en/posts/2012/10/installing-bluetooth-library-java-interpreter/</guid>
            <description>&lt;blockquote&gt;
&lt;p&gt;👴 &lt;em&gt;Attention&lt;/em&gt; Cet article a quelques années et n&amp;rsquo;est peut-être plus à jour !&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;When I was installing the bluetooth library, i was told to type the directory where Java Interpreter was installed.&lt;/p&gt;
&lt;p&gt;Run the command:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;  which java
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It’s gonna answer you « /usr/bin/java », type only « /usr/bin » in the shell line and you’re good 🙂 (Mac OS X Lion)&lt;/p&gt;</description>
            <content type="html"><![CDATA[<blockquote>
<p>👴 <em>Attention</em> Cet article a quelques années et n&rsquo;est peut-être plus à jour !</p>
</blockquote>
<p>When I was installing the bluetooth library, i was told to type the directory where Java Interpreter was installed.</p>
<p>Run the command:</p>
<pre tabindex="0"><code>  which java
</code></pre><p>It’s gonna answer you « /usr/bin/java », type only « /usr/bin » in the shell line and you’re good 🙂 (Mac OS X Lion)</p>
]]></content>
        </item>
        
    </channel>
</rss>
