Skip to main content

Posts

Showing posts from 2013

A Google Nexus 5 review - All you want to know, battery camera speed and more !!

This post is about the NEXUS 5 , I have been using this phone for around 15 days, I got this phone on 8th November . So to know about the battery life, camera , the pros and cons read it further. Phone spec: 16gb. 5" display.If you have tiny hands it will be difficult to use :) 1920x1080 display. Snapdragon 800, 2.26GHz processor. LTE Enabled. Wireless charging. Android 4.4 aka kitkat. 1.3 MP front facing and 8 MP rear facing camera. 2300 mAh battery. Pros: For me battery life was a huge improvement as I was previously using Samsung galaxy S3 whose battery life sucked big time. Now battery lasts for almost a day (9 AM- 11PM) with the following applications being used : Wi-fi on for all the time. Bluetooth for around 30 mins. All of the auto sync on. Facebooking. Nike+ app running for 30mins without GPS. Playing some small games. Extensive use of google now. With all of these and moderate use of other apps, battery lasts for a day. So, Nexus5 is prett

How to install rabbitmq on centos 6.

*All the comments are well appreciated * So here we go, one more installation tutorial this time its none other than the great RABBITMQ :) So to install rabbitmq on centos 6 please follow the below east steps. Install the EPEL-6 yum repo which contains Erlang R14B with the following command. This step is only for centos 6. rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm Install Erlang with the following command. yum install erlang Install RabbitMQ from RPM 1.rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc 2.rpm -Uvh http://www.rabbitmq.com/releases/rabbitmq-server/v3.1.4/rabbitmq-server-3.1.4-1.noarch.rpm By this time you are done installing rabbitmq. So just some points for the quick start. To make it run as daemon run this /sbin/chkconfig rabbitmq-server on To start the rabbit mq. /etc/init.d/rabbitmq-server start To stop the rabbitmq /etc/init.d/rabbitmq-server stop If you get into any tr

Wondering how to start/stop a Python script from init.d ?

If you just looking for the solution please go to solution heading directly!! So I have been asked to start my python server at the time of boot up. As I am pretty new to Python and have never done this, I have to go and find some help from none other than our best bud google. So when I googled I had found couple solution like http://www.pietervanos.net/knowledge/start-python-script-from-init-d/ The problem with the above solution is that when you want to stop your Python script using the above solution it kills all of the python scripts running on the machine. Obviously we don't want to kill other Python script, don't we? And had found couple of other solutions which I was not able to understand or I could not make them work. So the solution which I am using is. Solution : The plan is to make your Python script in my case my Python server to store its pid in some file, lets say in location /var/run/your_script.pid. So I am making your life easy, use this bel

Sending a SIGHUP signal to some external process from Python script

Code : import psutil import os import signal pids = psutil.get_pid_list() for pid in pids: if psutil.Process(pid).name == "process_name": os.kill(pid,signal.SIGHUP) break Steps to follow. 1.Get the PID of the process, in this case  "process_name"   to which you want to send out a SIGHUP signal. 2.Use os.kill(pid,sig) command to send out the SIGHUP signal to that process. 1.Get the PID of the process to which you want to send out a SIGHUP signal. One has to install a package called psutil by the following command. easy_install psutil Check out the following links for more details https://code.google.com/p/psutil/ https://pypi.python.org/pypi/psutil use psutil.get_pid_list() to get all of the PIDs. psutil.get_pid_list() works in the following manner.  pids = [ int ( x ) for x in os . listdir ( '/proc' ) if x . isdigit ()] return pids once you get all the PIDs get the PID you are i

error: command 'gcc' failed with exit status 1 while installing eventlet[Solved] for centos or ubuntu

Solution : Install python-devel using following command. yum install python-devel FYI, OS I was running. # uname -a Linux Dell620 2.6.32-220.17.1.el6.x86_64 #1 SMP Wed May 16 00:01:37 BST 2012 x86_64 x86_64 x86_64 GNU/Linux # cat /etc/redhat-release   CentOS release 6.2 (Final) for Ubuntu use the following command  aptitude install python-dev

How to debug a deadlock in multithreaded c/c++ program

Debugging a deadlock in multithreaded program can be little tricky . So the rescuer GDB is there for the help.I am just giving here the head start one needs to debug a multithreaded program for deadlocks. Run your program in GDB, wait until the deadlock happens and then use the following commands. 1. info threads which will list all of the threads that are running and a little * on the one which is currently running. Sample output  5 Thread 0x7ffff6be3700 (LWP 20175) 0x00000032cf6de8b3 in select () from /lib64/libc.so.6 3 Thread 0x7ffff75e4700 (LWP 20173) 0x00000032cf6ab15d in nanosleep () from /lib64/libc.so.6 2 Thread 0x7ffff7fe5700 (LWP 20172) 0x00000032cf6cd177 in sched_yield () from /lib64/libc.so.6 * 1 Thread 0x7ffff7fe7720 (LWP 20168) 0x00000032cf6de8b3 in select () from /lib64/libc.so.6 So one can see where all the threads are waiting at this point, so if happens to be a dead lock, threads must be stuck on lock or unlock. to see whats the thread name and all one c