Laur IVAN

Migrate Chromium and Keep all Settings

Posted by in IT, Tutorial

TL;DR: Backup App Data\Local\Chromium on your old machine, copy it to your new one and uncompress (in the same place), install Chromium, profit. With the migration to a new computer, I’ve managed to keep all my Chromium settings. The steps I did are the following: On the old computer Note the chromium version you’ve installed Go to App Data\Local Archive the Chromium directory Note: this might be huge! To reduce it, clean the Chromium\User Data\Default\Cache Note the plugins (optional) – this might be useful if you have plugins depending on…read more

Install and Use Package Control Behind Proxy

Posted by in IT, Tutorial

TL;DR: Install Package Control manually. Add the proxy settings to the configuration file as described in step 2 below. Today I’ve had to install Sublime Text 3 again on a new computer. Package control didn’t want to install due to my proxy settings (I was getting a 407 error code – Proxy authentification required). I managed to do it with two simple steps: Install Package Control manually. At the time of writing this post, the process is simple: Click the Preferences > Browse Packages… menu Browse up a folder and…read more

Fix “No Voice” with Kraken 7.1 and VLC on OSX

Posted by in Hardware

Today I had an odd issue with my Kraken 7.1 Chroma: I could not hear the voices in a movie in VLC. I could however hear the other sounds (like the voices were filtered out). I could also hear everything with the internal speakers or one of the monitors… I’ve tried finding answers online but the only bits I could find were for Windows. So, without further ado, my solution is to install Boom 2 (as a trial). I’ve ended up buying it because it boosts up audio nicely. If…read more

Mock an Observable Interface

Posted by in Software, Tutorial

TL;DR: Use a doAnswer() with a new Answer<Observable<Type>>() if you have to mock observables. Today I wrote my first test where I had to mock an observable interface:

where the User model is:

Solution In my test class (named UserDatabaseTest), I first mocked the interface:

` Then, my setup() method is:

where USER_NAME is a String. To use it, you need to attach an observer and assert:

This is quite simple. Alternative Note: This I haven’t tried yet, but here it goes… If you want…read more

Fix “Multiple dex files define L…” Errors

Posted by in Software

Today I got an error when building the APK: Multiple dex files define L/… My scenario is that of a project with 2 modules: a core and an app. Both modules use a plugin named androiddevmetrics, which generate some code, including a class which has the same signature in both modules. The linking (APK generation) resulted in an obvious conflict. My steps to solve this error are: Identify which package/module generates the error. The L/com/android/… will tell you exactly who the culpable is. In my case, the idea is to…read more

Thou Shall Stop Reading

Posted by in IT

I’ve caught myself reading about a subject matter (now, that’s android). I’ve been reading articles, documentation on new libraries, looking for inspiration on the net about UI… All for an app I’m upgrading with new functionality and looks. This is bad and I’ll stop doing it after I tell you why. First of all, it’s the time. My time is limited because this is done outside work hours. With the other stuff I’m doing (e.g. watch a game), the time I can dedicate to development drops even more. The new…read more

Mirror a Website with WGet

Posted by in Software

TL;DR: if you want to mirror a site where you need to authenticate, you need to do it in two steps. In the process of testing my app, I needed a mirror of the website I’m using. Since the website has authentication (via a form), the mirroring process has 2 parts. First part is to log in and get the cookies:

Now, the cookies are saved in the cookies.txt file. Note that you need to specify –keep-session-cookies. Otherwise, the file will be empty. The second part is to actually…read more

Replace a colour in an image with imagemagick

Posted by in IT, Tutorial

I had to change the colour of some monochrome icons for a personal project, from black to something else (i.e. not black). I’ve tried in python with PIL. Unfortunately, my attempts to use ImageOps failed miserably, because I’m working with RGBA images, not RGB :(. Of course, one could separate the RGBA in two, perform the operation and replace the RGB channels with the updated variants, or even do a pixel-by-pixel search (aka overkill). Since this is more or less a one-off operation, I’ve looked at other ways. I remember…read more

Strip HTML tags in python

Posted by in Software, Tutorial

Note: This is a post transferred from Laurii for historical and consolidation purposes. A common problem I have to deal with quite often is to remove all HTML tags from a document. While this is easy for XML (well formatted etc.) and you could do it by hand with a regexp, HTML has a bit more problems. There are several solutions to get around this… Using a browser This is a bit overkill, but you could use a browser’s renderer to “display” the string content and then get it as…read more