Saturday, April 12, 2025

Motorcycle gear cover/sock

 If you have a motorcycle that has a toe based gear shift and after couple of months of riding, have the left shoe getting spoilt or blackened. 

Then instead of buying expensive gear cover/ socks from motorcycle brands one work around is to buy soft handle bicycle grips and use them as a gear cover.

These are a lot cheaper and fit perfectly as you can see from this photo.



Friday, April 24, 2020

Notepad++ installing compare plugin

Follow the below steps to install the compare plugin for Notepad++ version 7.7 (64 bit) and above.

1) Download the compare plugin from this GitHub link


 2) Extract the files and place them under the note++ --> plugins --> ComparePlugin folder
Make sure that all the dll's are in the comparePlugin folder as shown below.
 3) Re-launch notepad++ and click on plugins
You should see the "Compare" option as shown below

Saturday, April 11, 2020

Failed to write credentials for 'your git repo URL' to secure store No password provided.

When using Eclipse 4.14 with eGit plugin if you get the below error message
"Failed to write credentials for 'your git repo URL' to secure store No password provided." 
as a work around, you can follow the steps in the below image to fix the issue

navigate to Window > Preferences > Secure storage and uncheck"windows integration" and click apply and save.
Keep the "UI prompt" checked





Thursday, June 20, 2019

Jal Vayu vihar post office

There is a post office inside the Jal Vayu Vihar residency. You need to enter from the "North" gate on CMR road, go straight and then take right, after 50 meters on the left is the post office. Its staffed by 2 persons and relatively quick service.

Saturday, August 12, 2017

Write Dropwizard metrics to a log file

Instead of using the Dropwizard URI to view the metrics of the methods that have been annotated by @Timed or @Metered on a need basis, you can also write the output to a log file.

The below changes needs to be made in the Dropwizard configuration xml file.
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:metrics="http://www.ryantenney.com/schema/metrics"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
               http://www.ryantenney.com/schema/metrics
               http://www.ryantenney.com/schema/metrics/metrics-3.0.xsd">

    <!-- Registry should be defined in only one context XML file -->
    <metrics:metric-registry id="metrics"/>
    <metrics:health-check-registry id="healthCheck"/>
    <!-- annotation-driven must be included in all context files -->
    <metrics:annotation-driven metric-registry="metrics"
                               health-check-registry="healthCheck"/>
 
       <metrics:reporter type="slf4j" metric-registry="metrics" period="15m" logger="com.abc.zyx.metrics"/>

     
    <!-- (Optional) The metrics in this example require the metrics-jvm jar-->
    <metrics:register metric-registry="metrics">
        <bean metrics:name="jvm.gc" class="com.codahale.metrics.jvm.GarbageCollectorMetricSet" />
        <bean metrics:name="jvm.memory" class="com.codahale.metrics.jvm.MemoryUsageGaugeSet"/>
        <bean metrics:name="jvm.thread-states" class="com.codahale.metrics.jvm.ThreadStatesGaugeSet"/>
        <bean metrics:name="jvm.fd.usage" class="com.codahale.metrics.jvm.FileDescriptorRatioGauge"/>
    </metrics:register>

    <bean class="org.springframework.web.context.support.ServletContextAttributeExporter">
        <property name="attributes">
            <map>
                <entry key="com.codahale.metrics.servlets.MetricsServlet.registry" value-ref="metrics"/>
                <entry key="com.codahale.metrics.servlets.HealthCheckServlet.registry" value-ref="healthCheck"/>
            </map>
        </property>
    </bean>

</beans>


And you need to also define a logger in log4j.xml or logback.xml file
logger="com.abc.zyx.metrics"

Monday, July 24, 2017

Jenkins slave node gives error /bin/java": java.io.IOException: error=2 when trying to build project

/bin/java": java.io.IOException: error=2
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.(UNIXProcess.java:164)
    at java.lang.ProcessImpl.start(ProcessImpl.java:81)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:476)


As the error indicates the you need to check the environment variables 'JAVA_HOME' or 'java.home' on the slave node. You need to make sure that 'JAVA_HOME' or 'java.home' is pointing to say in linux /opt/common/vendor/jdk1.7.0_79 and not /opt/common/vendor/jdk1.7.0_79/jre.

To check the configuration you can login to Jenkins as admin and then
select Manage Hudson/Jenkins then choose Manage Nodes.
there should be a Node Properties section.
Check the Tool Locations checkbox.
Click on Add/Update then Select your JDK in the dropdown list and add the path to it.

sonar-maven-plugin Insufficient privileges

When using "sonar-maven-plugin" as part of the jenkins build process, you might encounter this error message "[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project service1-data: Insufficient privileges -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project service1-data: Insufficient privileges
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
".

To fix this issue make sure that jenkins continuous integration (CI) job is building with correct projects' pom.xml in multi-module project. For example if your project has the following hierarchy
project/pom.xml
project/folder1/pom.xml
project/folder2/pom.xml

then if jenkins CI build is using project/pom.xml then
the sonar jenkins job (using sonar-maven-plugin) should also be using project/pom.xml

If the jenkins CI job is using project/pom.xml but sonar jenkins job is using different pom.xml say project/folder1/pom.xml then you will get above error.

Saturday, December 10, 2016

Tuesday, November 22, 2016

Nexus 5 disable autoplay music via bluetooth

Using Nexus 5 with kitkat 4.4.4, once you have paired a bluetooth device with your phone, you might have noticed when when the bluetooth device is detected and connected, music or videos starts playing automatically.

To disable this feature you need to go to

Settings -> bluetooth -> paired devices ->
Select the bluetooth device
under profiles -> uncheck "Media audio"

Tuesday, November 1, 2016

Nexus 5 power button reboot/restart

If you have an issue with your Nexus 5 phone's power button wherein the phone just restarts/reboots after pressing the power button then you need to boot in recovery mode and select 'wipe cache partition'. This worked for Kitkat 4.4.2 version of Android installed in the Nexus 5.

Detailed list of steps are present at this google link.

Registry key Error: Java version has value '1.8', but '1.7' is required


When working with multiple versions of Java SDK installed in your computer, you might come across this error where you have installed Java8 and then when you try to run/compile an application using Java6 or Java7 you get stuck.

Essentially you need to make sure that the  system 'path' variable points to the Java version that you need. When installing Java8 there are lot of folders that get added to the 'path' like 'C:\programdata\Oracle\Java\' or c:\program files\java\java8\nin, etc Once these folders are deleted from the 'path' variable then you will not get this error. Make sure that any windows command prompts are re-opened once changes have been done to the 'path' variable.

The below two posts nicely summarize the fix needed to make Java8 co-exist along with Java6/7.
http://stackoverflow.com/questions/26324486/properly-installing-java-8-along-with-java-7
http://stackoverflow.com/questions/29697543/registry-key-error-java-version-has-value-1-8-but-1-7-is-required

Sunday, June 5, 2016

How to add custom/local jars to a maven project as in-project repository

There are certain times when you will need to add a custom jar that is not present in a central or local repository as part of the maven build/compile goals. This jar along with others would need to be shipped out as part of the jar depdencies that are needed for the program to run. If you encounter such a suitation then follow the steps below to add the custom/local jar to your project.

1) Create a folder called 'lib' in your project root hierarchy.
For example if you have a project called c:\myTestProject then create a folder c:\myTestProject\lib

2) Copy the jar file to c:\myTestProject
For example lets say that we need to add a jar called abcd.jar to our project. So copy abcd.jar to c:\myTestProject\abcd.jar

3) Using maven 2.3 onwards, from windows command line, issue the command
mvn install:install-file -Dfile=c:\myTestProject\abcd.jar -DgroupId=com.xyz.myproject -DartifactId=abcd -Dversion=1.0.0 -Dpackaging=jar -DlocalRepositoryPath=c:\myTestProject\lib -DgeneratePom=true

After running that command, you will see the below folder created with the jar in it
c:\myTestProject\lib\com\xyz\myproject\abcd-1.0.0.jar


Now you can delete the c:\myTestProject\abcd.jar

4) Make the below changes to your projects pom.xml file

Note: file://${project.basedir}\lib has a \lib (backlash\lib) which is needed to work on windows computers
 

<project>
...
...

<repositories>
  <repository>
    <id>my-local-repo</id>
    <releases>
        <enabled>true</enabled>
    </releases>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
    <url>file://${project.basedir}\lib</url>
  </repository>
</repositories>

<dependencies>
    <dependency>
         <groupId>com.xyz.myproject</groupId>
        <artifactId>abcd</artifactId>
        <version>1.0.0</version>
    </dependency>
    ...
    ...
</dependencies>

...
...
<project>

After following the above steps, if you are still not able to build the project using maven and maven says that it cannot locate the abcd.jar file then check the maven settings ${maven_home}\.m2\settings.xml file
set the <mirrorOf> tag as mentioned below

<mirrors>
    <mirror>
        <mirrorOf>*<mirrorOf>
        ...
        ...
    </mirror>
</mirrors>

Running Java standlone app and spring xsd error message

When running java spring based standalone application, you might get an exception that spring is not able to validate the spring beans xsd file. This might due to the fact that your computer is behind a proxy and the java application does not have access to the proxy server. 

Assuming that you have a proxy server for internet configured with host as http.myproxy.net and port 9876 then run the java application with the below options will allow the application to launch

java -Dhttp.proxyHost=http.myproxy.net -Dhttp.proxyPort=9876 -Dhttp.proxyUser=someUserName -Dhttp.proxyPassword=somePassword -jar some-jar-to-run.jar

Friday, October 16, 2015

puttycm opens putty in separate window instead of tab

PuttyCm is a good utility to open mutiple putty sessions in the same window across tabs. However there are certain problems when instead of opening in a new tab the putty session opens in a new window which is cumbersome and annoying.

There are three ways to fix this problem:
1) Timeout option
2) Windows compatibility option
3) Windows registry settings

For "Timeout option"
Tools -> Options -> Select the check-box “Enable additional timing for PuTTY capture (ms)” -> set the value to 500 ms. Try even with value of 10,000ms (~10 secs)

If that does not work then try the above with "Windows compatibility option" as indicated by this blog post
  • Right-click the executable file and go to Compatibility tab.
  • Choose compatibility for Windows (as per your operating system).
  • Toward the bottom of the Compatibility tab, tick "Run this program as an administrator".

If both the above solutions do not work then its possible that you do not have local admin priviledges. As each time puttycm tries to open a session in a new tab then it makes an entry in the windows registry. Check with your administrator if you have local admin rights granted. Once its granted puttyCm will open new sessions in a new tab.

Friday, August 15, 2014

Android scrollview hiding top content in layout

Based on the screen layout in your Android application, some of the text in a TextView widget may not be visible i.e looks like its hidden/scrolled off at the top of the screen.

In the definition of the TextView in your layout xml, check to see if the below tag is present. This layout_gravity attribute is the problem why some of the text is not visible. Removing it from the TextView definition will display all data in the TextView widget.

android:layout_gravity="center_horizontal|center_vertical"

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="1.04"
        android:fillViewport="true"
        android:keepScreenOn="true"
        android:scrollbarStyle="insideInset"
        android:scrollbars="vertical"
        android:visibility="visible" >

        <TextView
            android:id="@+id/detailsText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            <!--android:layout_gravity="center_horizontal|center_vertical" -->      android:layout_marginTop="30dip" />
    </ScrollView>

Replace end of line (CR/LF carriage return/new line) characters in a file or string using java

Replace end of line (CR/LF) characters in string with another character 'A'

desc = desc.replaceAll("\\r?\\n", "A");
where desc is a String variable.

Wednesday, July 23, 2014

Bangalore Open Air 2014 - metal concert

Bangalore Open Air takes place on September 13th, 2014 at CounterCulture, Bengaluru.

Three international headline acts
  • Destruction - German thrash metallers
  • Rotting Christ - Greek extreme metal band
  • Cadaver Mutilator - Italian brutal death metal band

Three Indian metal bands,
  • Threinody
  • The Down Troddence
  • Armament


Entry: 
Rs 2,000 (early bird)
Rs 2,500 on the day of the event.

Event location:
CounterCulture
2D2, 4th Cross, Dyavasandra Industrial Area,
ITPL Main Road, Whitefield, Bangalore

Event details
http://bangaloreopenair.com/

Saturday, June 21, 2014

Adding/integrating Google play services with Android app project

When adding the below element tag to AndroidManifest.xml file

<meta-data  android:name="com.google.android.gms.version"
 android:value="@integer/google_play_services_version" />
 

If you see the below error message then it means that Google play services library is not present for the current Android project.
The error is:
   No resources found that match the given name (at 'value' with value '@integer/google_play_services_version').


 To add Google play services lib, follow the below steps
1)      Select File -> Import
2)      browse to the folder where ‘Google play services library’ is present
3)      Note: ‘Google play services library’ is located in \sdk\extras\google\google_play_services
4)      select ‘Google play services library’ and ‘copy project into workspace’
Note: “copy project into workspace” must be selected so that the lib does not get modified
5)      right on your project -> properties -> android -> library and select the Google play services lib
6)      Rebuild your project which will clear the error







.

Saturday, May 3, 2014

How to play music play music from microphone input

If you have forgotten your headphone/earphones and still need to listen to music on the go and have a laptop and your favourite audio device then you can follow the steps below to listen to music.

You will need to have
1) windows 7 installed
2) 3.5mm male to male audio stereo cable
3) your favourite music player ipod, mp3 player, etc

Steps:
1) click on 'control panel' and navigate to your 'sound settings'
2) click on the 'microphone' then 'properties'
3) Tick mark 'Listen to this device'
4) make sure that 'playback through this device" is set to "default playback device"
5) click "apply" then "ok"
6) connect the 3.5mm cable from your music player to the microphone input of your laptop/desktop
7) start playing music and adjust the volume from your laptop/desktop as necessary.





3.5mm male to male audio cable.
3.5mm male to male audio cable.
3.5mm male to male audio cable.

Wednesday, April 30, 2014

Adding external/third party jars to Android project in libs folder


  1. Download the jar files to your computer.
  2. Create a new folder, libs, in your Eclipse/Android project (if it does not exist)
  3. Right-click libs and choose Import -> General -> File System, then Next, Browse in the filesystem to find the parent directory where the jar(s) were downloaded.
  4. Click OK, then click the directory name (not the checkbox) in the left pane, then check the relevant JAR in the right pane. This puts the library into your project.
  5. Right-click on your project, choose Build Path -> Configure Build Path, then click the Libraries tab, then Add JARs..., navigate to your new JAR in the libs directory and add it.This step is when the new jar gets converted to a Dalvik-converted JAR that can be used with the Android project.