Fix: Android emulators not starting in Ubuntu

Often this happens when for some reason or the other your OpenGL config is broken. This is often an issue on Ubuntu 17.04.

To confirm this is your problem, (Assuming your Android SDK lives in ~/Android/Sdk)

Step 1
Get your emulator’s name:
~/Android/Sdk/emulator/emulator -list-avds

In my case it was Nexus_4_API_25

Step 2
Test running using system OpenGL
~/Android/Sdk/emulator/emulator -avd Nexus_4_API_25 -use-system-libs

If the emulator starts successfully we can make this solution semi-permanent by having a symbolic link in the android Sdk dirs to the system’s openGL

Step 3
cd ~/Android/Sdk/emulator/lib64/libstdc++/
mkdir backup
mv libstdc++.so.6 backup/
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 .

Voilà, you should now be able to launch your emulator from android studio or anywhere else. In the case of any future updates, you can just run the above commands again.

 

Source: Martin Revert (stackoverflow)

How to fix gradle in Intellij IDEA

When starting a project in Intellij IDEA if you see an error around the lines of

Gradle sync failed: The newly created daemon process has a different context than expected.
 It won't be possible to reconnect to this daemon. Context mismatch: 
 Java home is different.
 Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3.2\jre,daemonRegistryDir=C:\Users\Ronald\.gradle\daemon,pid=7044,idleTimeout=null,daemonOpts=-Xmx1536m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]
 Actual: DefaultDaemonContext[uid=7819e5ac-98ac-4dd2-8891-cacf4e56f662,javaHome=C:\Program Files\Java\jdk1.8.0_112,daemonRegistryDir=C:\Users\Ronald\.gradle\daemon,pid=4720,idleTimeout=60000,daemonOpts=-Xmx1536m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]
 Consult IDE log for more details (Help | Show Log)

The solution would be to explicitly tell grade where your java directory is. You can do this in two places

  1. Open up %USERPROFILE%\.gradle\  and create the file gradle.properties
  2. In your android project create or edit the gradle.properties file

Inside that file put the location of your java path using forwardslashes instead of backslashes

org.gradle.java.home=Your/path/here/with/forwardslashes

In my case it looks like:

org.gradle.java.home=C:/Program Files/Java/jdk1.8.0_112

Virtualization: Should I assign CPU’s or Cores

TL:DR Cores Cores Cores (but no more than pCPU count)

When creating a new virtual machine in VMware ESXi or VMware Workstation, it asks you how may processor cores you wish to set and gives you the option to set both ‘Number of processors‘ and ‘Number of cores per processor‘.

Most places online (looking at you Stack Overflow) said that only ‘Total processor cores‘ matters. I was curious as to how true that was and decided to run some tests myself.

The results are as follows

CPU’s Cores Single-Core Score Multi-Core Score % Increase
1 1  3159  2976  base
1 2  3161  4758  ↑60%
1 4  3055  5068  ↑70%
2 1  2991  4820  ↑62%
4 1  2960  4931  ↑65%
2 2  2913  5060  ↑70%

The results here were pretty astonishing, as soon as we increase the CPU count we actually lost single-core performance and gained a slightly higher multi-core score.

This may be because of the way VMware handle cores vs CPU’s. It could also be because of how the guest operating system handles multiple processors. Regardless, seeing as single-thread performance is more important in most applications, I’d stick with adding cores and not processors for the time being.

How many cores to assign to vmware virtual machines

TL:DR Even with Hyperthreading enabled, do not exceed the amount of PHYSICAL cores your machine has. 

The General rule for assigning CPU’s is to keep your virtual cpu count at or lower than your physical cpu count. (VMware blog) .

I was curious as to why this was, seeing as generally one can get anywhere between a 10-30% increase in performance with hyperthreading.

To see how the performance scaled with each additional core, I decided to test it out on my laptop (1CPU, 2 Cores, 4ht cores). I spun up a new CentOS 7 machine and ran geekbench4 on each core configuration. The results were as follows

CPU’s Cores Single-Core Score Multi-Core Score % Increase
1 1  3159  2976  n/a
1 2  3161  4758  ↑60%
1 3  3109  4851  ↑2%
1 4  3055  5068  ↑4%

From our table we can see that after we arrived at the physical CPU count, adding extra cores gave us very little in terms of a performance boost.

Best linux distro for daily use in 2017

A new year has begun. Time to format my disks. New windows install and more importantly, new Linux install. With windows, the choice is easy. Windows 10. With Linux, it’s a bit more complicated….

Here were the candidates

Ubuntu 16.04 LTS
Here’s a little history about my relationship with Ubuntu. Ubuntu was my first distro and all was right with the world, I would never have left… that is.. until the fire nation att… until unity. It was a bit of a messy breakup, something about it just didn’t resonate with my soul. A year or two ago I tried it again but I remember seeing amazon search results integrated by default and was instantly disgusted. But time has passed, seasons have changed and I believe people learn from their mistakes..so I wanted to give it another shot. so I did… Continue reading

How to speedup (stop lag) in Fedora 25

With Fedora 25 (as you probably already know) X was replaced with Wayland as the default display server. Now while I applaud Fedora for taking that giant step forward. The fact remains that X11 just performs better.

With Wayland i’ve noticed various flickers where there shouldn’t be. As well as a general feeling of… lag or slowness.

Luckily for us it’s pretty easy to go back to X.

  1. Logout (not yet!! Read the rest of the tutorial first)
  2. Click on your profile
  3. Look for the settings icon and select Gnome on XOrg.

Voila! you should now see an immediate difference.

How to disable Cortana and Web Search in windows 10 anniversary update (2016)

With the newest update, windows has hidden the option “search online and include web results” and therefore has made it difficult for users to disable Cortana and Web results completely.

Luckily for us there is a relatively easy fix.

  • Type Win + R to open run and type in gpedit.msc
  • Go to Local Computer Policy > Computer Configuration > Administrative Templates > Windows Components > Search
  • Disable “Allow Cortana”
  • Enable “Do not allow web search”

And Done.

Windows 10 Ninja Cat wallpaper

Windows_Insider_Anniversary-Ninjacat-1366x768

To celebrate one year of the Windows 10 insider program, Microsoft sent out this email to its insiders with exclusive Ninja Cat Windows 10 wallpapers as well as a Ninja Cat GIF.

The wallpaper zip below contains multiple files in various sizes for both phones and PC’s alike.

You can download the official files using the links below:

Continue reading

How to fix ssh locale issues on Linux

So you ssh into your server and all over the place you see something like

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = (unset),
 LC_ALL = (unset),
 LANG = "en_US.UTF-8"
 are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

You search for the solution and everywhere keeps telling you to setup the locales but nothing works. Most likely what the problem is your ssh client is forwarding its locale-related environment variables and thats messing up stuff on the server end. To fix.

Edit /etc/ssh/ssh_config and comment out the line that says

SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES

Save, and restart your ssh service (or just restart)