About Me

My photo
Mostly software programming related blogs.

Thursday, September 11, 2014

Non programming questions

1) How smart pointer like provided by Boost work?
2) How memory leak and corruption is detected by tools like Valgrind?
3) How storage allocator like malloc works? Implement a basic one.
3) how deadlock can be detected? Then how to prevent it from happening?
4) How ping works? How telnet works? How SSH works? How FTP works? How http works? what is ICMP? What is NAT? What is PAT? DHCP servers. DNS servers.
5) Just on top level how virtualization softwares like VMware work?
6) Design questions. Like design a LIFT/elevator setup with multiple lifts
7) Setuid. setgid, chroot <--- Unix/linux
8) How Java virtual machine works? How garbage collector works?
9) Active Directory Server, LDAP etc
10) how facebook work? How facebook stores/loads data of a "timeline"? Considering more than billion FB users, billions of pics/videos etc stored in thousands of servers.
11) Memcached - open source caching system. Used by Facebook.


Wednesday, September 10, 2014

Given an integer find the immediate larger integer which is a palindrome

// #palindrome #C #Programming #String 

#include <stdio.h>
#include <string.h>

typedef unsigned int uint;

uint find_next_palin(uint inp);

main()
{
        uint num;
        printf("enter the number: ");
        scanf("%u", &num);

        uint ret = find_next_palin(num);

        printf("next palindrome is %u\n", ret);
}

uint find_next_palin(uint inp)
{
        char buff[32];
        uint ret, i1 =0, i2 =0, i = 0;

        sprintf(buff, "%d", inp);

        int len = strlen(buff);

        if (len == 1) {
                return inp;
        }

        if (len % 2 == 0) {
                i1 = buff[len/2 -1] - '0';
                i2 = buff[len/2] - '0';

                if (i1 < i2) {
                        buff[len/2 -1] = i1 + '0'+1;
                }
                for (i = 0; i < len/2; i++) {
                        buff[len/2+i] = buff[len/2-i-1];
                }
        } else {
                i1 = buff[len/2 -1] - '0';
                i2 = buff[len/2 +1] - '0';

                if (i1 < i2) {
                        buff[len/2 -1] = i1 + '0'+1;
                }
                for (i = 0; i < len/2; i++) {
                        buff[len/2+i+1] = buff[len/2-i-1];
                }
        }

        sscanf(buff, "%u", &ret);
        return ret;
}                                                                                                                                                                                  

Monday, September 8, 2014

meru genie cab/taxi guys highly unprofessional - review

My experience with them is highly disappointing. I had to go to railway station which is around 20KM from my house. I had booked the can in the afternoon for 6PM same day. As **they had accepted the booking** so cab should have come. But by 6'o clock no SMS or no call. Should not at least they inform the customers if due to some reason cab can't be arranged?

I called them at 6. They told that they are arranging and by 6:15 I will get the cab. Again no call or sms till 6.15. Again I called after 6:15, they said sir its not possible. I said at least you should have informed. He has no answer other that "sorry".

My personal advice don't have the option of this cab service. Very Very unprofessional.

#Bangalore #Cab #Taxi #Railway #Station #Airport #Meru #Genie #india #Review