Skip to main content

Posts

Showing posts from November, 2017

Send and Recieve emails with your domain for free

Are you owning a domain name and want to send and recieve email using your domain for free? Yes, free, I just came accross a third party website Mailgun  which lets you do this, with a limit of 10,000 emails per month under their free plan. When you purchase a domain name, most of the time, it will come with free email forwarding service i.e. you can create an virtual email address with your domain and use this service to forward any incoming email, however you won't be able to send the email using this address. Mailgun provides you a free service (10,000 emails in free plan) that you can send and recieve. In this case post, I'll explain the setup with Mailgun and Gmail in order to use this service. Signing up with Mailgun First step is to have an account created with Mailgun. Once registered, verify your account with your mobile number. Next, add your custom domain. You might have to copy the MX records and add in your DNS records in your domain Nameserver re

Understanding Python Iterables, Iterators and Generators

An Iterable is an object in Python which can return one of its member at a time, examples include list, str, tuple, dict, file etc. Iterables can be used with for loop and in some places with zip(), map() etc.  We can pass an iterable object to built-in function iter() to get an iterator. An iterator is an object representing a stream of data and does have next() (Python 2.x) and __next__() (Python 3.x) methods which can be called to get the successive data. When no more data is available, a StopRaiseException is raised. So what’s the difference between the Iterator and Iterables? An Iterable can be considered as collection of objects which can be iterated over and Iterator lets you specify what it means to iterate over an object. Let’s consider some examples :-    myList = [1, 2, 3, 4, 5, 6, 7, 8, 9] # Iterable (List) myString = "SomeText" # Iterable (String) Above two examples (list and str) are iterable objects and we can iterate over an individu

Implementing Singly Linked List using C

In this post, we'll walk over the Singly Linked List and its implementation using C language. In a singly linked list, each node in the list stores two things - contents of node and the pointer to next node. It is called singly linked list because every node has only pointer i.e. pointer to next node. Last node will typically point to NULL indicating the end of list. Typically, we will have a head which will be used to intialize the empty list and will point to NULL. #include<stdio.h> #include<stdlib.h> typedef struct node { int key; struct node *nextNode; } LinkNode; LinkNode *addNode(LinkNode *nodePtr, int value) { LinkNode *newNode = (LinkNode *) malloc( sizeof (LinkNode)); if (newNode == NULL) { fprintf(stderr, "Error creating new node, terminating program \n " ); exit(1); } newNode->key = value; newNode->nextNode = nodePtr; return newNode; } LinkNode *deleteNode(LinkNode *nodePtr, int value) { LinkNode *he