Monday, 4 January 2021

Atom text editor not opening or saving files

 My atom text editor version 1.53.0 was not opening files. Initially clearing the state using the following command solved the issue : 

atom --clear-window-state

Using this I was able to open files but not able to save any changes I made to the files. I tried reinstalling through 

sudo apt-get remove atom

rm -r ~/.atom

sudo apt-get install atom 

However this did not solve the issue.

Finally what worked was installing it using snap

sudo snap install atom

Since then atom text editor has been working fine.

Another thing I did different was to click on No, on the telemetry consent page. Earlier I was just closing the window without clicking on anything.

Not sure what made it work but happy to have it working again!

Sunday, 20 December 2020

Segmentation fault with gnome-control-center on ubuntu 18

I was unable to open the settings tab of my ubuntu 18. This seems to be a very common issue as I found various threads on it with solutions ranging from asking to remove external ppas, reinstalling gnome-control-center etc. However none of this worked.

Finally I ran gnome-logs from the terminal and saw the detailed segmentation fault error under the System tab: 

gnome-control-c[28768]: segfault at fffffff8 ip 00007fe6cc71c8a0 sp 00007ffdf553f9e0 error 4 in libc-2.30.so[7fe6cc6a4000+178000]

On searching for error 4 libc along with gnome-control-center segmentation fault, I found the following page which finally solved the issue for me, at least temporarily.

https://bugzilla.redhat.com/show_bug.cgi?id=1668792

Removing the "user" file from .config/dconf folder made gnome-control-center work again!

Monday, 31 August 2020

Running arduino board with ubuntu 18 and ros melodic

While trying to run arduino script using rosserial_python serial_node.py, I was getting following error:

[ERROR] [1598864453.982391]: Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

The error was occuring because my rosmsg type was Float32MultiArray which contains an array inside it. Probably this leads to some buffer overflow in ros melodic which causes the error. Changing the rosmsg type to Point from Float32MultiArray solved the issue for me. 


Other things that helped in running arduino board with ubuntu and ros melodic were:

1) Make the usb port writable. Solution is provided at https://arduino.stackexchange.com/questions/21215/first-time-set-up-permission-denied-to-usb-port-ubuntu-14-04 

2) Make sure pubsub example in ros_lib is working. Solution is provided at https://answers.ros.org/question/360537/unknown-error-handler-name-rosmsg/

3) Only baud rate of 57600 worked with ros


Wednesday, 7 February 2018

Converting a number range to regex for search using grep on linux command line

I often have to grep filenames having numbers in their names with numbers in specific range to get some statistics from many log files. Could not find a straightforward existing method to do this. So wrote this python function to convert a number range into regex for grep. Hope it is helpful for others also.
       
def get_highest_number(start_number, i):
    m = int(math.pow(10,i))
    return ((int(start_number/m) + 1)*m) -1
    
def get_regex_from_number_range(start_number, end_number):
    
    end_number_string = str(end_number)
    start_number_string = str(start_number)
    num_digits_end_number = len(str(end_number_string))
    num_digits_start_number = len(str(start_number_string))
    
    pattern = '_@'
    i = 0
    intermediate_start_number = get_highest_number(start_number, i+1) 
    while intermediate_start_number <=end_number:
        #print intermediate_start_number
        #print start_number_string
        if i==0:
            pattern = pattern + '('
        else:
            pattern = pattern + '|'
      
        for j in range(0 , num_digits_start_number -(i + 1)):
            pattern = pattern+ start_number_string[j]
        pattern = pattern + "[" + start_number_string[num_digits_start_number -(i + 1)] + "-9]"
        for j in range(num_digits_start_number - i,num_digits_start_number):
            pattern = pattern + "[0-9]"
        i = i + 1
        start_number_string = str(intermediate_start_number + 1)
        intermediate_start_number = get_highest_number(intermediate_start_number + 1, i+1)
        num_digits_start_number = len(str(start_number_string))
    
    #Number of digit in intermediate start number same as number of digits in end number
    intermediate_start_number = int(start_number_string)
    i = 0
    while intermediate_start_number < end_number:
        #print intermediate_start_number
        #print start_number_string
        if(int(end_number_string[i]) > int(start_number_string[i])):
            pattern = pattern + "|"
            for j in range(0,i):
                pattern = pattern + end_number_string[j]
            pattern = pattern + "[" + start_number_string[i] + "-" + str(int(end_number_string[i])-1) + "]"
            for j in range(i+1, num_digits_end_number):
                pattern = pattern + "[0-9]"
            intermediate_start_number = intermediate_start_number + (int(end_number_string[i]) - int(start_number_string[i]))*int(math.pow(10,num_digits_end_number - (i+1)))
            start_number_string = str(intermediate_start_number)
        i = i +1 
    if intermediate_start_number == end_number:
        pattern = pattern + "|" + end_number_string
    
    pattern = pattern + ')'
        
    
    return pattern