Friday, 12 January 2018

Ola does not support Amex

As per their FAQs, Ola claims to support Amex cards.



However, when an attempt is made to add an Amex card, an error is shown as following.



The explanation provided by Ola is as follows.



I don't understand why is this clarity is not provided in the FAQ.

Tuesday, 2 January 2018

KActivityManager blocking unmounting

While un-mounting a partition to safely remove the external hard drive, I got an error about the device being busy. Both Dolphin and the command line said the same thing.

umount /run/media/myuser/New\ Volume/
umount: /run/media/myuser/New Volume: target is busy.


It seems kactivitymanagerd was using it.


[root@clown myuser]# fuser -vm /run/media/myuser/New\ Volume/
                    USER        PID ACCESS COMMAND
/run/media/myuser/New Volume:
                     myuser     612 ..c.. kactivitymanage


I tried to stop the daemon but I got the following error.

root@clown myuser]# /usr/bin/kactivitymanagerd
QStandardPaths: wrong ownership on runtime directory /run/user/1000, 1000 instead of 0


After some discussion on Freenode, I got to know that when graphical apps are run with escalated priviledges, similar error is found. I guessed I was getting the error because I was trying to stop the daemon as root user. I tried changing back to my regular user and stopping the daemon. It worked  and I was able to unmount the drive after that.

/usr/bin/kactivitymanagerd stop
Service stopped
Cleaning up...


Tuesday, 5 December 2017

Benchmarking elasticsearch and logstash pipeline

Elasticsearch and logstash pipelines can be elaborate or simple. Depending upon the setup, end to end benchmarking should be done time to time. One way to do it is to have a marker document (log line). We need to track when the marker is introduced into the pipeline and finally when it becomes available to query.

import urllib2

import json

from datetime import datetime

import sys

import time

print "Started at " + str(datetime.now())
if len(sys.argv) < 2:
   print "URL not specified.\nUsage: watch.py "
   exit(1)

count = 0
while count < 1:
    resp = urllib2.urlopen(sys.argv[1]).read()
    count = json.loads(resp)["hits"]["total"]
    if count > 0:
        print "Found at " + str(datetime.now())
        break
    time.sleep(2)


The above script can be used as follows:

python <script_file> "http://<host_name>:<port_number>/_search?q=message:<markerMessage>"

Thursday, 16 November 2017

Toggle Read-only behaviour of buffer in Emacs

When a file to which you have read access as regular user is opened in emacs, the buffer is marked read-only. If the user escalates to root and opens the same file in emacs, the buffer still remains read-only. To modify the file, the user needs to toggle the read-only behaviour of the buffer (for which the default key binding is C-x C-q) first.

Increasing the maximum number of file descriptors allowed per user on Cent OS 6

For some applications like elasticsearch, the maximum number of file descriptors needs to quite high. The way of modifying the value varies from distro to distro. In Cent OS6, the following did not work.

1. Using sysctl as root
sysctl -w fs.file-max=100000

2. Using ulimit as root

After the above approaches, when you check the value using the following, the value will show up.

cat /proc/sys/fs/file-max

However, setting the values as root, does not change the values for other regular users. To set it specifically for any user, change the value in /etc/security/limits.conf file. Setting only the soft or hard limit will not be sufficient. Therefore, the following lines should be added.

<user> soft nofile <value>

<user> hard nofile <value>

After the modifications, it is required to logout and log back into the system.

Monday, 30 October 2017

Manually install maven dependency

Error messages from Maven are often useless. The root cause is mostly never captured. Debugging issues might require manually installing a dependency. The way to do it is as follows:

mvn install:install-file -DgroupId=jnuit -DartifactId=junit -Dversion=3.8.1 -Dpackaging=jar -Dfile=/path/to/file

Sunday, 15 October 2017

Correct do...while in Ruby

Rubyists use the .each or .map way of looping frequently. However, when there is a need of a while loop, the following is the correct way.
loop do
    # statements
    break if condition
end

Sunday, 7 May 2017

Getting method name within the same method

For logging in some server side javascript, I had the need of getting the name of the method within the same method. There are 2 ways of doing this:
- accessing arguments.callee.toString() and applying regex extraction to get the name
- accessing arguments.callee.name

It does not always work though. ECMA strict mode does not allow it but their is no alternative either.

Wednesday, 1 March 2017

Unable to locate "adwaita" theme engine

While running KDE on Arch linux, on a number of occassions, I get to see the following error.

(java:20732): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita"

[828:828:0708/183334:ERROR:browser_main_loop.cc(249)] GTK theme error: Unable to locate theme engine in module_path: "adwaita"

The mitigation of the issue is installation of gnome-themes-standard package.