Monday, 23 February 2015

Covert floating point number to IEEE754 format

/* prints a lot of information about floating-point numbers */

#include <stdio.h>
#include <math.h>
#include <values.h>

/* endianness testing */
const int EndianTest = 0x04030201;

#define LITTLE_ENDIAN() (*((const char *) &EndianTest) == 0x01)

/* extract nth LSB from object stored in lvalue x */
#define GET_BIT(x, n) ((((const char *) &x)[LITTLE_ENDIAN() ? (n) / CHARBITS : sizeof(x) - (n) / CHARBITS - 1] >> ((n) % CHARBITS)) & 0x01)

#define PUT_BIT(x, n) (putchar(GET_BIT((x), (n)) ? '1' : '0'))

void
print_float_bits(float f)
{
    int i;

    i = FLOATBITS - 1;
    PUT_BIT(f, i);
    putchar(' ');
    for(i--; i >= 23; i--) {
        PUT_BIT(f, i);
    }
    putchar(' ');
    for(; i >= 0; i--) {
        PUT_BIT(f, i);
    }
}

int
main(int argc, char **argv)
{
    float f;

    while(scanf("%f", &f) == 1) {
        printf("%10g = %24.17g = ", f, f);
        print_float_bits(f);
        putchar('\n');
    }

    return 0;
}

Thursday, 12 February 2015

Access your WhatsApp from your Desktop Browser

Did you ever feel that your mobile screen or your mobile keypad is too small for you to use watsapp comfortably...

Now you can easily switch on to your PC for watsapp.

Many of you might have heard of watsapp for PC and some of you might have even given a try.

It involves a tedious process of installing an emulator and then using the watsapp.

If your motto is to have a larger screen for your conversation or to use your PC keyboard for typing fast, you need not go for installing the emulators now.

There is a wonderful feature on watsapp latest versions known aswatsapp web.

This feature helps you to connect your mobile watsapp account on to your PC.

But this works only on your CHROME browser.

Just follow this simple steps and enjoy watsapp on your PC without any emulators

STEP 1: open https://web.whatsapp.com/ in your chrome browser

STEP 2: Do the following in your phone



STEP 3: scan the QR code shown in chrome browser from your whatsApp app on your phone

STEP 4: Access your whatsApp account from your Browser

PS: don't forgot to logout your account once you are done