Swap the rows and columns of an HTML table

Recently I found myself converting a PDF into an EPUB. One challenge of such a task is to make the tables more compact to be able to fit in small screens. Sometimes, the best solution was to invert the rows and the columns of the table.

I looked on the web how to quickly swap rows and columns but most of the solutions involved CSS. The EPUB format does not handle CSS very well and I preferred to convert the table in pure HTML. The only solution I found was in this SO post. I added support for the TH tag, wrapped the algorithm into a nice page and published it as a ready-to-use tool.

So if you need a quick way get the transpose of an table in pure HTML, try my HTML table swapper! Note that it does not support “colspan” and “rowspan” yet.

You can also have a look at the source code.

Posted in Various | Leave a comment

CMYK with GIMP in 2 minutes (without Adobe ICC profile)

Recently with GIMP, I had to export an image in PDF with the CMYK color model (“quadrichromie” in French) for a professional printer. It has been a hard task, because:

  • CMYK is not included by default in GIMP
  • All the tutorials on the web rely on the Adobe ICC profile file for CMYK, which is not available anymore (and even if it still was, I prefer not use something from Adobe)

How to do it

So, to save you from painful hours of research in the world of ICC profiles, here is how to export with the CMYK color profile with GIMP, in a few minutes:

  1. Download this CMYK ICC profile. If it does not work, try this mirror (see below where this file comes from).
  2. Open GIMP and create a new image.
  3. In the creation window, open “Advanced options”.
  4. In “Color profile”, select “Select color profile from disk”, then select the file downloaded at step 1.
  5. Hit OK to create the image.

Now you have a brand new image that will be exported with CMYK next time you export it.

Why this specific file?

Maybe you are wondering where I found this CMYK ICC profile file? On the official ICC website you can find a list of all registered ICC profiles. But which one should you choose to print with CMYK?

In this detailed article of IBM about ICC profiles, they say:

If you save an image by using the CMYK color space, make sure that you either save an ICC profile for that color space or use a standard non-device specific CMYK color space like SWOP or Coated FOGRA27 and associate the appropriate ICC profile with the image.

So back to the ICC list, I selected one of the SWOP files (the one I provide in this article), exported my image with this profile and sent it to the professional printer for a test. He said that the file was perfect 😉

Posted in Various | Leave a comment

Letter O or digit 0?

When playing online with friends yesterday, I had to dictate over phone a short URL with random characters in it. Unfortunately, some characters could have been the letter O or the digit 0 and I was unable to know that!

I quickly looked up for an online tool to help me but I couldn’t find one. That’s why today I release “Letter O or digit 0”, the first online tool to quickly know where are letters O and digits 0 in a text.

You can also have a look at the source code.

Posted in Web | Leave a comment

[Unity3D] Manage links with TextMeshPro

In Unity3D, you can use TextMeshPro or TextMeshProUGUI with embedded links. For example, your text can be:

TextMeshPro Text component with a link

But this is not enough to get it open on click. You also need to handle the click and execute the action you want, based on the link ID (here the link ID is the URL). To do that, just attach this script to the same object of your TextMeshPro or TextMeshProUGUI component.

Continue reading

Posted in Unity3D | 2 Comments

[Unity3D] Make a Coroutine synchronous

Unity3D coroutine synchronous

In Unity3D, Coroutine is a great tool to make parallel scripts in a safe way. However, in certain cases you may need to execute a Coroutine synchronously, and Unity does not offer any method out of the box to do so.

Here is a small code snippet you can use in C#:

Continue reading

Posted in Unity3D | 10 Comments

Restart service after update (Android)

Restart service after update through the Google Play Store

Maybe it is time to update your rusted background service?

For my Android project Stopeen, I implemented a functionality to schedule actions with a recurrence over time. But one of my problem was : when people will update my app from the store, the service in background will be killed, and so do they the pending intents handled by the alarm manager. So how could I restart the service without forcing my user to launch my app immediately after each update?

Continue reading

Posted in Android | 5 Comments

Android Studio Bookmarks

Android Studio Bookmarks toggle

Android Studio Bookmarks toggle

Here is a small tip for Android Studio. I added a bookmark by accident, in one of my source file, and I did not find out easily how to remove it.
Continue reading

Posted in Android | 4 Comments

Parallax scrolling in HTML5

Parallax scrolling example scene

Example of parallax scrolling (by OhSqueezy)

The parallax scrolling is an effect applied to an image to make it move slower or faster than the other images. This effect is very popular in the 2D games, to create a feeling of deepness : when an image goes faster, you think that this image is closer than the rest of the page, if it goes slower, you will think that it is further.
Continue reading

Posted in Web | Leave a comment

Turn off 4G on Android phones

Turn off 4G

It does not exist a “4G switch” on Android!

You can stop looking for a “4G switch” to toggle 4G in your Android settings, it does not exists. To turn off 4G on smartphones, you need to disable access to the LTE network. Many Android devices (Galaxy S4, Galaxy S5, Galaxy Note 4,…) have similar steps to modify this option.

Continue reading

Posted in Android | 23 Comments

Activity: forget onPause to handle focus changes

onPause to handle focus changes seems to be a good way, but actually it is not!

Even if, in the lifecycle graph, the onPause method seems to be called when the activity loose the focus, it is not always the case!

I spent one whole afternoon on a very silly issue about the Android activity lifecyle when the focus changes and the device is turned on. I want to share it with you to avoid you some hours of investigation!

Continue reading

Posted in Android | 1 Comment