Friday, January 29, 2016

Malta to introduce super unleaded fuel

Enemed, a Maltese Government owned company which will be taking operation of Enemalta's petroleum division, has yesterday informed the public that it will be distributing super fuel in 60 stations.

This is great news for all the petrol heads (including myself!). But before we get all excited, as it normally happens with all cool tech / science that penetrate the Maltese market, let me point out the common myths that need to be busted once and for all!



Myth 1: Premium gas gives you more MPG than regular gas

To increase gas' octane rating, companies add ethanol, when they're mixing up a batch of premium fuel. Interestingly, ethanol actually contains less energy than untreated gas, so the net result from the ethanol component is a reduction in your MPG. Other premium additives, however, have the reverse effect, and slightly increase your MPG. So okay, overall premium provides a very slight net increase in MPG, but it's so slight that I swear you won't notice the difference.



Myth 2: Premium has special or extra detergents in it that are worth the added cost.

Ignore any sales pitch about the super-special detergents that come in the premium-grade fuel.

These days, all of the gasoline from the major gas companies contain more than enough detergents to keep your engine clean. Period.

The only reason you might have a use for the extra detergents in premium, is if you have a noticeably dirty engine, and need to scrub carbon and other crud off engine components. (And, if you're doing that, I'd instead suggest that you toss in one of the many fine engine additives.)



Myth 3: I will void my warranty if my owner's manual calls for premium and I use regular unleaded.

You might, but I don't think so.

But, that's just my humble opinion. If you use regular instead of premium, and your car calls for premium, there's no way I can guarantee that your dealer won't try to sneak away from taking responsibility for repairs.

But, if I had a vehicle that called for premium, I'd take the risk. There's a big price difference between regular and premium. That adds up to quite a bit of money over the life of your car.



Myth 4: Using regular gas in a car designed for premium will definitely damage the engine.

I don't believe that any modern engine that claims to require premium will be damaged by using regular unleaded judiciously. Neither do any of the sources I've checked with - including the American Petroleum Institute and the American Engine Rebuilders Association.



Source: Cartalk.com

Saturday, January 09, 2016

How to fix an overheating Macbook (running sluggish and fan noise)

MacBooks are notorious for overheating - although there is a plethora of information out there how to fix this issue, most of the suggestions are either "Take it to Apple Care" or reset SMC.... In this post I am going to help you fix it for real, especially if it is a MacBook Pro 2010 in which case it is likely to be a hardware related issue.

In my opinion, an overheating MacBook causes two main nuances:

Problem 1 - If it overheats than there must be a hardware issue!
Problem 2 - MacBook overheats for no apparant reason even if it just sitting on your lap!
Problem 3 - The fans are whirling and creating lots of noise!
Problem 4 - The system runs sluggish when there is the overheating!

Fixing FIRST ISSUE
So let's tackle the sluggish issue first - I know it is a bit like cheating, but we will get to the root of the problem soon! Why does the MacBook run terribly slow during an overheat? Some of you may have fired up the Activity Monitor and noticed a process called kernel_task taking high CPU, sometimes even 400% !! So what is happening here?

Basically OSX has a kernel module called ACPI_SMC_PlatformPlugin that regulates the kernel and user processes to prevent overheating by trying to minimise the CPU cycles and system activity. This is done by constantly monitoring the temperature and inputs this information in a negative feedback system - the higher the temperature, it will tell the CPU to slow things down..you know..to chill a bit (that was good eh!).

So in theory this is a good thing. BUT...if there is a hardware fault - I will come to this later - this negative feedback system will actually worsen things out. So I suggest to eliminate this kernel module in the first place by running this command in your terminal:

The result is this: MacBook will still overheat for now, but at least will not cause the whole system to run super-slow and collapses your mental sanity. GOOD!

Fixing ROOT CAUSE
Now let's go to the hardware fault - I will talk about my experience but you can use the same troubleshooting and fix for your particular problem. So my MacBook was giving me trouble from day 1 - everytime I lay it down on my lap it will overheat in a few seconds. If I put it down on a couch, it will do the same. So I used to think that MacBooks in general do a terrible thing in compromising practicality for the sake of running sleek.

However one day I noticed while adding a RAM module that if I press on the RAM, the MacBook will suddenly overheat - so I started replicating the problem to be 100% sure - I was pressing down on the motherboard to make sure that it was just the spot on the RAM that was causing the issue. Further research gave me more insight and appeared to be a common problem!

So how did I fix this? This was easier now that I knew where was the problem. The fix is a bit of a household hack, but hey it works - I just folded a piece of paper and put it on top of the battery. This way I created a buffer and the lid was never pressing against the RAM module:

Monday, December 21, 2015

Sunday, December 06, 2015

Calling non-static method from static method in Java

You might find it useful to call non-static methods from a main method in Java. You can easily do this by creating a class instance and calling the non-static method using that instance in your static method. Sounds complicated? Checkout the example:

Friday, October 30, 2015

Saturday, October 17, 2015

Ralink RT5370 USB WiFi adapter on El Capitan 10.11.x

Note: These instructions are valid for the following drivers: RT2870/ RT2770/ RT3X7X/ RT537X/ RT5572

In a previous post I showed you how to install the Ralink RT5370 and equivalent USB WiFi adapter for OSX Yosemite 10.10.x. In this brief post we will use the information learned in that previous post and adapt it to install the same driver on the new OSX version released a few weeks ago, El Capitan 10.11.x.

Note that throughout the article I will make reference to the following tools and drivers that you can download from here:
1. Bear Extender (GUI for managing the WLAN)
2. RT2870USBWirelessDriver.ext (The Ralink Driver)
3. SIPUtility (an application to manage El Capitan SIP)

But before we start you should understand that Apple made a number of security changes to El Capitan, one of them called SIP (System Integrity Protection). Follow the link for more details about SIP, but the most relevant to us is to understand that in a nutshell the driver will not work (load into the kernel) out of the box, and we need to disable SIP completely for it to work.

As such you need to first run the SIP Utility (credits go to the hacker cvad) to disable SIP completely:


Reboot your machine, and then copy the RT2870USBWirelessDriver.ext driver to /System/Library/Extensions:


Final step is to install the Bear Extender WiFi management GUI. Once you reboot the machine once more, you are able to use the Ralink driver on El Capitan!




EDIT (8/11/2015): I have noticed some people find it difficult to use SIPUtility or install the package manually from the terminal. If you're not comfortable with the terminal, there is an easier alternative by using Pacifist:
1. Download Pacifist from https://www.charlessoft.com/cgi-bin/pacifist_download.cgi?type=dmg
2. Open the installer.pkg file from the driver you downloaded in pacifist, and select to install to default location, and use administrator privilege
3. Reboot
4. Install Bear Extender WiFi management GUI. Once you reboot the machine once more, you are able to use the Ralink driver on El Capitan!

EDIT (10/11/2015): If you are having issues to disable SIP with SIPUtility, you may try the KCPM Utility Pro.


Friday, October 16, 2015

Docker Fix "cannot enable tty mode on non tty input"

Running docker on windows can be a bit challenging for newcomers. This is mainly because Docker was actually meant to run on Linux environments (LXC containers). One of the most common challenges among Windows users is to attach a TTY session to a docker container to run for example a bash shell.

Inherently, the Docker command tool for Windows, which is based on Cygwin/Mingw does not have TTY input, and the following error will pop up:



The workaround is to use winpty (which comes with Mingw):
alias docker="winpty docker"