Airtel 3G dongle on Mac OSX Yosemite

WP_20141130_001

In case you are trying to use the Airtel 3G dongle on Mac OSX Yosemite, and facing a problem in establishing a connection, here is a quick tip:

Add *99# as the Telephone Number in the Network settings for ‘HUAWEIMobile’ service.

Screen Shot 2014-11-30 at 12.41.21

P.S: I have heard that the Airtel 3G dongle works seamlessly, without the need of any custom configurations, with both Microsoft Windows and Mac OSX Mavericks. Looks like this issue is only with the latest version of Mac OSX – Yosemite.

Advertisements

Ehcache statistics

Here is what you need to do if you want to enable useful statistics information for the ehcache implementation in your Java application:

  1. Define two new beans – one for ehcacheManagementService and the other for mbeanServer – in the applicationContext file. Make sure that registerCacheStatistics constructor argument is set to true.
    <bean id="ehcacheManagementService" class="net.sf.ehcache.management.ManagementService">
          <constructor-arg name="cacheManager" ref="ehcache"/>
          <constructor-arg name="mBeanServer" ref="mbeanServer"/>
          <constructor-arg name="registerCacheManager" value="false"/>
          <constructor-arg name="registerCaches" value="false"/>
          <constructor-arg name="registerCacheConfigurations" value="false"/>
          <constructor-arg name="registerCacheStatistics" value="true"/>
    </bean>
    <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
          <property name="locateExistingServerIfPossible" value="true"/>
    </bean>
    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cacheManager-ref="ehcache"/>
    <bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
          p:configLocation="classpath:ehcache.xml" p:shared="true"/>
    <cache:annotation-driven/>
    
  2. Set statistics property of your cache in ehcache.xml to true.
    <cache name="coreCache"
             maxElementsInMemory="10000"
             eternal="false"
             timeToIdleSeconds="86400"
             timeToLiveSeconds="86400"
             overflowToDisk="true"
             maxElementsOnDisk="10000000"
             diskPersistent="false"
             diskExpiryThreadIntervalSeconds="86400"
             memoryStoreEvictionPolicy="LRU"
             statistics="true">
      </cache>
    

That’s it! Ehcache mbeans are now exposed to be consumed by any JMX-compatible monitoring tool, viz., JConsole or VisualVM (with Java Profiler plugin) to name a few.

Here is a screenshot of the Ehcache statistics in VisualVM:

Screen Shot 2014-08-08 at 23.33.18

Maven Surefire PermGen error

In case you are getting PermGen error while running tests using the Maven Surefire plugin, here is the solution:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>${surefire.version}</version>
  <configuration>
    <argLine>-Xmx512m -XX:MaxPermSize=256m</argLine>
  </configuration>
</plugin>

Setting the JVM args as part of the plugin did the trick!

Setting MAVEN_OPTS would not help because Maven Surefire plugin forks the JVM process while running the tests, and so the MAVEN_OPTS settings do not take effect.

VirtualBox CompareExchange128 Error

Today, I attempted to upgrade my Windows 8 machine to the yet-to-be-released Windows 8.1, and I got the following error:

You can't install Windows 8.1 because your processor doesn't support CompareExchange128.

error

I am running 64-bit Mac as my primary operating system, and have set up 64-bit Windows 8 on a VM using VirtualBox.

Cause

One of the additional system requirements for 64-bit Windows 8.1 installation is that the CPU must also support CMPXCHG16b, PrefetchW and LAHF/SAHF. And this setting is disabled in VirtualBox by default.

Please check out this link for the other system requirements for Windows 8.1.

Solution

Open up the command prompt of your choice – Terminal / iTerm, and execute the following command:

VBoxManage setextradata [VM_Name] VBoxInternal/CPUM/CMPXCHG16B 1

And, that’s it! You’re ready to install Windows 8.1!

Proxied…

If you work in a corporate behind a firewall, most likely you would need to configure proxy for any of the dev tools that talk to the internet. The write-up below talks about configuring proxy for:

  • Maven – Build and management tool for any Java-based project
  • Git – Distributed version control system
  • npm – Node Packaged Modules (Package manager for Node.js)
  • Bower – Front-end package manager

In order to work with any of the above tools, you would need to have access to the internet. And if your company/client uses a proxy server, you would need to configure these tools to use that proxy in order to talk to the internet.

  • Maven

Add the following section in your maven settings.xml (typically located at ${user.home}/.m2/settings.xml).

<settings>
  .
  .
  <proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.somewhere.com</host>
      <port>8080</port>
      <username>proxyuser</username>
      <password>somepassword</password>
      <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
    </proxy>
  </proxies>
  .
  .
</settings>

For a detailed description on the different settings, please refer to this link.

  • Git

For using git over HTTP, execute the following command.

git config --global http.proxy http://<proxy_server>:<proxy_server_port>
  • npm

Execute the following command. You might want to put it as part of your .bash_profile (for bash) or the profile file of your favorite shell so that you do not need to set it up whenever you open up a new command shell.

npm config set proxy http://<proxy_server>:<proxy_server_port>
  • Bower

Set the following environment variable:  HTTP_PROXY or HTTPS_PROXY (as per your needs).

export HTTPS_PROXY=http://<proxy_server>

Again, you might would want to put it as part of your .bash_profile (for bash). In case of windows, add a new User environment variable.

System-provided packages taking precedence over Homebrew-installed packages

If you are using a Mac, you must be familiar with Homebrew. After installing brew, you must run the following command to ensure it is ready to install packages.

brew doctor

When you install a package, e.g., git, that also comes pre-installed with Mac, you will notice that even though brew installed a newer version of that package, it is still the older version (the one provided by the system) that seems to be taking precedence.

Here is the reason why this happens:

Brew installs the packages into their own directories and symlinks the executables into /usr/local/bin. If you run brew doctor at this point, it clearly mentions what is happening behind the scenes:

Warning: /usr/bin occurs before /usr/local/bin This means that system-provided programs will be used instead of those provided by Homebrew. 
Consider amending your PATH so that /usr/local/bin is ahead of /usr/bin in your PATH.

Solution

Modify the sequence of paths in /etc/paths file so that /usr/local/bin comes ahead of /usr/bin.

sudo vi /etc/paths

Here is a sample /etc/paths file (after the change):

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

If you check the version of the installed package at this point, it would be the one installed by brew.

Network connectivity on a new CentOS installation

I had recently set up a new CentOS VM (v6.2) on my VirtualBox, but had a tough time configuring it to use the internet connectivity from my host machine. Here is a snapshot of the VirtualBox network settings for the VM:

Screen Shot 2013-06-09 at 4.16.50 PM

After quite a bit of troubleshooting, finally it turned out to be a simple config change. By default, CentOS does not configure the network interfaces on a new installation. I just had to execute the following command to configure the ethernet network interface. It acquired a new IP address and the network connectivity issue got resolved.

$ dhclient -v eth0

VirtualBox error: Kernel driver not installed (rc=-1908)

I use VirtualBox to  run a Windows 8 VM on my Mac. Something strange happened today. My Mac ran out of battery while I was working on something important on the Windows VM. I recharged my Mac and tried to restart the VM, but the VM was not booting up at all. I kept getting the following error:

VirtualBox error: Kernel driver not installed (rc=-1908)

Since the machine had not shut down gracefully, the VM seemed to have got corrupted.

After spending quite a bit of time trying to troubleshoot this problem, I was finally able to resolve it. Reinstalling VirtualBox helped resolve the issue. Obviously, I did lose all the unsaved changes, but the good part was that the VM was still intact, and it booted up just fine!

Just penning it down so that it helps someone else facing the same issue…

Linux distro and kernel details

Lately, I have been working with different Linux distros, and two of the most common tasks have been to figure out:

  1. the particular distro installed on the VM
  2. the Linux kernel version

This might be trivial for people working on Linux on a day-to-day basis, but for somebody new to Linux trying to troubleshoot issues this might be of some help.

To figure out the Linux distro running on the machine

Execute the following command:

$ cat /etc/*-release

Here is a sample output from my Ubuntu instance:

STRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"
NAME="Ubuntu"
VERSION="12.04.2 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu precise (12.04.2 LTS)"
VERSION_ID="12.04"

Another one from my CentOS instance:

CentOS release 6.2 (Final)
CentOS release 6.2 (Final)
CentOS release 6.2 (Final)

To figure out the Linux kernel version

Execute the following command:

$ uname -mrs

Here is a sample output from my Ubuntu instance:

Linux 3.2.0-40-generic-pae i686

And another one from my CentOS instance:

Linux 2.6.32-220.e16.x86_64 x86_64

Do you (still) hate IE?

I would be curious to know the reason why. Have you tried out IE9?

Check out this link >>> http://browseryoulovedtohate.com/