Jul 082017
 

Hey! Long time no see! Heehee.

I am just dropping a note here about the basic steps of how to install XDebug for a specific setup.

Here is my configuration:

  • host:
    • OS: Windows 7 64 bits
    • IP: 192.168.0.3
    • IDE: Netbeans 8.2
  • guest:
    • OS: Debian Jessie 64 bits in VirtualBox
    • IP: 192.168.0.4 (bridged network in VirtualBox settings)
    • standard Apache2, PHP 5, MySQL from official repositories

The idea is: I want to use the stepper on a website located inside a virtual machine from an IDE on the host machine.

Step by step

XDebug installation

  1. On the guest machine, get the phpinfo() output. If you have no idea how to do this quickly:
    1. From the command line, run php --info > ~/tempphpinfo.txt (you can safely delete this file later).
    2. Open the file: gedit ~/tempphpinfo.txt.
    3. Copy all the contents.
  2. Go to https://xdebug.org/wizard.php and follow the instructions: you will have to paste the contents of the phpinfo obtained earlier. The wizard will tell you exactly how to build xdebug. Make sure you are in the correct folder when running the phpize command.
  3. Locate the xdebug.ini files (named 20-xdebug.ini on my Debian) on the guest machine:
    1. cd /etc/php5
    2. find | grep xdebug
  4. Edit one of the files listed by the last command and add those lines:
  5. sudo service apache2 restart, just in case.

Testing XDebug

We will create a small php file which will react to XDebug calls.

  1. Create a php file:
    • touch ~/testxdebug.php
    • gedit ~/testxdebug.php
    • Insert the following:
    • Save and close.
  2. Start the command line debugger: php ~/testxdebug.php. You may have a warning about the xdebug extension already started: you can ignore it or fix this later by commenting/removing the zend_extension=path/to/xdebug.so line you have added to the /etc/php5/cli/php.ini file (not the xdebug.ini files!).
  3. In the web browser, go to your website location, a Drupal 8 in my case and add an attribute at the end of the URL, e.g.: http://localhost/DrupalXDebug/web/index.php?XDEBUG_SESSION_START=mysession.
  4. In the terminal where you have run the php ~/testxdebug.php command, you should see a message like this one:

    connection established: Resource id #5

    If not, the configuration is wrong and check the steps again or the resources links at the end of this article.

Setup remote debugging

Until now, we have only ran the debugger (the little php script we have created earlier, which you can safely delete now) from inside the guest machine. We will configure xdebug to work with remote machines, in my case, the Windows host.

  1. Edit one of the xdebug.ini files you have edited earlier: replace the xdebug.remote_host value by the IP of the host, 192.168.0.3 in my case.
  2. sudo service apache2 restart, just in case.

Netbeans configuration

Now we can configure Netbeans to run the debugger.

  1. Open the website project.
  2. Right click on the project in the Projects list and click on Properties.
  3. Enter the URL of your website in Run Configuration > Project URL. In my case, it was like this:
    Screenshot from netbeans

    Where to set the website URL

  4. Click on the Advanced button.
  5. Set the path mappings. In my case:
    Screenshot of path mapping on Netbeans

    How to set path mappings

You should now be set for debugging with the stepper!

Run the debug

  1. Click on the Debug Project button in the top toolbar of Netbeans and it should launch automatically a browser with a session id already set!
  2. Put a breakpoint somewhere in the code.
  3. Each time a request is sent to the website, Netbeans will control the page generation.

Additional Information

Aug 292016
 

When you install a new Linux alongside another one, your computer will likely use the last installed OS’s GRUB instead of the one from the previous install.

In my case, I have installed Debian, and a few days later, a Linux Mint on the same disk. But the thing is I prefer the Debian’s GRUB because it is prettier, with a nice image background! Also, I want to keep Debian as my default choice on boot. I could have modified the boot order via Grub Customizer (I will let you Google that) but still! The Debian’s GRUB is better than the Ubuntu’s (Linux Mint’s) dark and ugly one. 😛

Step by step

To use the old install’s GRUB, use those commands from the old OS (Debian for me):

  • … with the X corresponding to your disk of installation. For example: sudo grub-install /dev/sda

  • Then reboot and enjoy!

I hope this helps! I have found those steps on the Ubuntu’s documentation: https://help.ubuntu.com/community/Grub2/Installing

Aug 032016
 

I was doing an ingame video capture and I needed to have it in a GIF format. A few frames of the animation could be optimized as there were sometimes still images. So if I wanted to remove those unnecessary frames (while keeping the correct duration, of course), one can simply use ImageMagick.

How to

ImageMagick should be included by default in Debian and probably other distributions. So you just have to use the convert command. Here is an example:

It will remove duplicate frames and try to optimize frames by looking at similar areas of the pictures across the animation so they don’t appear twice.

Now, if you have specific needs, you better check the documentation here: http://www.imagemagick.org/Usage/anim_opt. There are some examples which will give you an idea of how to perform the best optimization.

Aug 032016
 

Didactic

I am writing a little tutorial here for creating a QRCode for a vCard file. As I don’t use it that much, it feels like I need a memo for it.

Preparation

We will use a vCard file named test.vcf which contains the following:

Result file

A vCard image QR encoded

A vCard QR encoded

Generating the image

Prerequisites

  • qrencode package with its dependencies.

Step by step

  1. In the Terminal, execute the following:

That’s all! A file named test.vcf.png will be created or overwritten if it already exists.

If you want to change or get rid of the margin, use the -m option with the size in pixels:

If you want to change the dots size, use the -s option with the size in pixels:

Please check the manual if you need more options such as output format (PNG, EPS, SVG, ASCII, etc.).

Additional Notes

The same thing with an UI

You can also use frontends to generate QR encoded files: qtqr package (available on Debian repository) seems interesting.

vCard syntax

  • If you want to add or remove your own fields, my advice would be to check the properties on the Wikipédia page: https://en.wikipedia.org/wiki/VCard#Properties
  • Make sure to use the right properties for the right vCard version. I am using 2.1 in my example.

Things to consider to prevent reading failures

  • Make sure the color contrast between the dots and the background is sufficient.
  • Dots should remain dark and the background should remain clear.
  • Make sure the dots are large enough if you want devices with fixed focus (such as my Moto E 1st Gen) to read the image. For instance, the example image was generated with a 4px dot size; 3px dot size was not readable by my Moto E on a 22″ 1920×1080 screen.
  • If you resize your image in a graphics software, it is best to use nearest neighbor interpolation algorithm to preserve sharp dots.
  • If your dot size is 1px, don’t shrink your image as it will lose information. (pretty obvious)
  • Make sure the QR code users will physically have access to the space right in front of the image / print. So don’t put a barrier in front of the image…
Jun 192016
 

Tired

Time spent to get the info: one day. Length of the fix: a few lines. Haha, this is so ridiculous it makes me smile a little.

Okay, so you are:

  1. on fresh Debian Jessie (GNOME 3),
  2. on a laptop,
  3. with an integrated graphics unit,
  4. and it is an Intel CPU. In my case, I have a Core i3 Sandy Bridge CPU with HD Graphics 3000.

The backlight function keys:

  1. are working so you have an on-screen display feedback,
  2. are not changing the effective brightness of your screen,
  3. are changing the values of this file: /sys/class/backlight/acpi_video0/brightness (close and reopen in gedit to see the value changing or check by command line).

You have this folder: /sys/class/backlight/intel_backlight.

Yay! You may have a solution!

  1. Create a file:
  2. Add this in the file:
  3. Save file.
  4. Close gedit.
  5. Restart the computer.
  6. It should work now!

If this fix does not work on your laptop, I am sorry to hear that but I cannot help you further. Don’t ask the noob. I have just followed guidance on linux threads such as here: link to Ubuntu’s launchpad website. Good luck!