Summer training students' planet

September 20, 2017

Kshithij Iyer

#love #worklifebalance

#love #worklifebalance

"The funny part is that people don’t work as hard as I do and sit in an ongoing presentation..."

“The funny part is that people don’t work as hard as I do and sit in an ongoing presentation and criticise me. I feel like abusing the shit out of such people but I guess I am better than this.”

- Kshithij Iyer

Mohit

Everybody, Somebody, Anybody, Nobody!

During studying Communication Skills for my college exams, I found an amazing story which I would like to share.

Everybody, Somebody, Anybody, Nobody!

- A Communication Gap

This is a story about four people Everybody, Somebody, Anybody, and Nobody.  There was an important job to be done and Everybody was sure that Somebody would do it.  Anybody could have done it, but Nobody did it.  Somebody got angry about that, because it was Everybody's job.  Everybody thought Anybody could do it, but Nobody realized that Everybody wouldn't do it.  It ended up that Everybody blamed Somebody, when Nobody did what Anybody could have done!

Conclusion:  This story is far deeper than it might look and is best describe in team collaborative projects.  If any of you find difficulty understanding, please Comment. (It is rather difficult for me to explain it all over here)

September 19, 2017

Kshithij Iyer

"Okay! 48 hours and I’ll be through with most confusing JAVA EE Project ever."

“Okay! 48 hours and I’ll be through with most confusing JAVA EE Project ever.”

- Kshithij Iyer

Pune is rather green city. #pune #rains (at Symbiosis Institute...

Pune is rather green city.
#pune #rains (at Symbiosis Institute of Computer Studies and Research, Pune)

"You won’t understand the pain of having a bike still you have to walk to the retail shop to..."

“You won’t understand the pain of having a bike still you have to walk to the retail shop to buy coke.”

- Kshithij Iyer

September 18, 2017

Kshithij Iyer

Indeed I have.

"Okay! This is both exciting and horrifying, I just don’t recollect when I slept last night."

“Okay! This is both exciting and horrifying, I just don’t recollect when I slept last night.”

- Kshithij Iyer

September 17, 2017

Vivek Anand

Using C function from Python

ctypes is a python library which allows using C data types, functions from a python script. It’s in the standard python library. To use C functions using ctypes, you will need to compile the C code and create a shared library.

#include <stdio.h>

int add_two_numbers(int num1, int num2) {
return num1 + num2;
}



I will be using a very simple C function in this case which adds two given numbers

Now compile this file using:

This will create a shared library named libadd2nums.so which, for now, contains only one function.

# coding=utf-8

import ctypes



I am using fedora 26. If you are using Windows, you will need to use ctypes.WinDLL.

_add here, is the shared library and we can access the C function using dot(.) .

main.py

# coding=utf-8

num1 = int(raw_input("Enter num1: "))
num2 = int(raw_input("Enter num2: "))



That’s it.

September 14, 2017

Mohit

If you guys have read my previous blog on LibreBoot, you guys might know that I have started to work on LibreBoot and here is something I like to share what I learn along the way on BIOS and boot-loader.

BIOS

BIOS is short for Basic Input Output System and is a very critical part of any computer system and it is very first part which powers up your system.

When the system is powered on, a firmware loaded in a ROM(Read Only Memory) chip is executed and is known as BIOS.  This firmware takes care of your initials drivers required by your system for the keyboards and mouse to interact. Once the BIOS firmware is loaded, the process of booting goes to boot-loader.

Booting takes place in two steps.  BIOS checks all the storage devices connected to the system and if the boot loader is present or not.

Boot Loader then in first step, checks for the master boot partition, aka MBR and verifies whether it is working or not i.e. not corrupted.

Then, in second step, boot loader points to the storage partition which stores the operating system for our system and is referenced by the MBR, whether it be windows or any linux based distribution.

In multiboot systems, MBR has the entry for all the storage partitions for all the operating system, and thus boot loader provides user the option to choose the operating system, s/he wants to use.

Note: Since I am learning these concepts on bootloader, bios and kernel.  So use this material on your risk.  I wont be responsible if your system crashes. :p

LibreBoot!

As an open source enthusiast, I find new open-source softwares almost every week.  This week I get to know about a great one, which I never thought of.  A Open-Source BIOS firmware alternative, LibreBoot.  The thought never struck me that there might also be Open source BIOS firmware out there

How I found it?

For some weeks, I was looking for some opensource projects which I can contribute to but I was too confused about which one to pick.  The main reason being, every new thing fascinates me and thus I got distracted too easily.  Discussing these issues with my dgplug mentor Shakti kannan aka mbuf, I found my core competence (low level computer stuff, 0s and 1s) and most of all, I learnt to say No! to other fascinating stuff which distracted me a lot.

mbuf advised me to check on LibreBoot and see if it helps.  When I first encounter libreboot documentation, i couldn't understand much, but searching a little about it, I started to liked it.

What is it?

Libreboot (formerly known as GNU Libreboot) is a free software project aimed at replacing the proprietary BIOS firmware found in most computers with a libre, lightweight system designed to perform only the minimum number of tasks necessary to load and run a modern 32-bit or 64-bit operating system.

How can you get started?

I wont go into much detail, but there is one advice i would like to give: Hold on, take your time, it might not get to you at first.

• Download the source code for libre boot from its git repository hosted here by:          git clone https://notabug.org/libreboot/libreboot.git

• Try and install it on your system (Recommended on Test System).
• See if you like it.
• Have fun with its code.

As you can see in its documentation, its tested for limited devices/hardwares and here's your chance, go try and  test it on your on.

September 13, 2017

Kshithij Iyer

"No! I ain’t losing tomorrow, Java EE 2 and PHP tests I guess it’s going to be a long..."

“No! I ain’t losing tomorrow, Java EE 2 and PHP tests I guess it’s going to be a long night.”

- Kshithij Iyer

September 12, 2017

Vipin kumar

Program-to-find-Power-using-for-loop

In this blog we are going to make a program find power of same numer

for example :  number is 5 power 5.

power-for-loop.c

#include
void main()
{
int  i , n , pow = 1 ;
printf("enter a number \n");
scanf( "%d",&n);
for(i=1;i<=n;i++)
{
pow=pow*n;
}
printf("%d",pow);
}


Printing-N-to-1-using-for-loop

IN this blog we do a simple program on for loop .

printing-N-to-1-using-for-loop.c

#include<stdio.h>
void main()
{
int i,N ;

printf(“Enter a number : “);
scanf(“%d”,&N);

for ( i = N ; i >= 1 ; i– ) // or for( ; N >= 1 ; N–)
printf( ” %d \n “,i );
}

// I hope now you will able to understend for loop in C.

September 11, 2017

Kshithij Iyer

A year in Pune. (at Pune, Maharashtra)

A year in Pune. (at Pune, Maharashtra)

September 10, 2017

Vipul Gupta

!0 most brain me1ting m0vies.

As promised from my previous post Lights, Camera, My Love for watching movies.

Here’s my list of my mind melting movies that you probably won’t give a fuck about. But don’t worry the list is still gonna be here. Regardless of what you think. So let’s begin. But first. What is a mind melting movie?

It is a brainfuck of thoughts and scenes carefully stitched together with elegance and beauty by the director for you to unravel and discover and as you pull away each layer like scene of that onion like film until you reach its core, the climax where it all boils down into something you never could have expected. Your mind is thinking at about 10-15 WTF’s per minute. As you start to think about one particular scene. And that scene shifts to something else more mind boggling than the previous one. The movie craves for your attention and wouldn’t let you go out of its grip. You have to watch what happens in the end or the world would end. That’s a mind melting movie.

And honestly, I love those kinds of movies. I want movies to be a fast-paced sarcastic thriller that stands apart from the normal shit we are used to watching. That gets you a high, a blissful release from this world. A good movie is so many but a movie that makes you think is one in thousands. It could be anything for you. Share your list too in the comments section. Here is mine and it’s a bit cliche. In no particular order.

1. Memento
2. The Usual Suspects
3. Inception
4. Ocean’s series
5. Don’t Breathe
6. Cloverfield Series (So excited for God Particle)
7. Gone Girl
8. The Prestige
9. The Departed
10. Vanilla Sky and Valkryie and Minority Report ( Love Tom Cruise)

And seriously tons more… Thing is these movies lands quite close to thriller. Maybe I am just renaming the genre here. For what I like for it to sound. Share any movies you would like to be added. Till then, peace out, rabbit.

Kshithij Iyer

"Okay! I though themes would be a bit more easy. :p"

“Okay! I though themes would be a bit more easy. :p”

- Kshithij Iyer

September 09, 2017

Vipin kumar

Understanding-for-loop

#include<stdio.h>
void main()
{
int i ;

for ( i = 1 ; i <= 10 ; i++ )
printf( ” Now the value of i is %d .\n “,i );

/* OR
i = 1 ;
for( ; i <= 10 ; )
{
printf(“Now the value of i is %d.\n “,i);
i++;
}
*/
}
/* Here i = 1 is initialization
and i <= 10 is condinitiona; part and
i++ is expression part.
they run accroding to there flow as we explaine in last blog.
*/

Samridhi Agarwal

Euler Problem no.30 with Python

This problem statement was quite interesting because that not only judged my coding skills but also my mathematical skills. So i tried to solve it in two different ways –

Problem Statement
Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:
1634 = 14 + 64 + 34 + 44
8208 = 84 + 24 + 04 + 84
9474 = 94 + 44 + 74 + 44

As 1 = 14 is not a sum it is not included.

The sum of these numbers is 1634 + 8208 + 9474 = 19316.

Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.

Solution –

I first thought of getting the set of numbers (which meet the problem’s criteria) that are to be added, and then add them together to verify that the set is correct and complete.

Secondly, make a list of constraints which put restriction on the solution set. This problem excludes the value 1 from consideration. In fact, by intuitive extension, it is excluding all single digit values (numbers < 10) as they cannot form a sum of digits. This is a clue that our search range starts from at least 10.Now we have to think on the end range that’s the maximum limit till which our code should search. After just a moment of thought it becomes clear that the number of digits for the sum must have the same number of digits as a value.
Look at the table below to get the maximum limit.

Digits Maximum n Limit = 95 x n Comments
9 999,999,999 531,441 they need to have the same no. of digits
8 99,999,999 472,392 nope, still too many digits of n .
7 9,999,999 413,343 not quite there
6 999,999 354,294 a valid search limit

So we got the maximum limit as 354,294 . Now let’s write the code.

Python Code –

TotalSum = 0
Value = []                             #values to be added

#Range we got and then comparing the values according to criteria
for i in range(10, 354294):
Sum = 0                       #This sum is for getting one single value
for x in str(i):
Sum += int(x) ** 5        #checking for main condition with power 5
if Sum == i:                  #If the sum matches with the value
Value.append(i)           #The value we are in search for

# We add those values stored in the list to get total Sum
for i in Value:
TotalSum += i

print ("Values :" , Value)
print ("TotalSum :" , TotalSum)

Output ->

Values : [4150, 4151, 54748, 92727, 93084, 194979]
TotalSum : 443839

I also tried with other way by defining a function.

Python Code ->

def power_of_digits(n, exp = 5):
Sum = 0
while n > 0:
Sum += (n % 10)**exp
n //= 10
return Sum

total = 0
for i in range(10, 10**6):
if power_of_digits(i) == i:
total += i
print(total)

Output ->

443839

Happy Coding!

Vivek Anand

Realtime Events using Tornado and Rabbitmq

At my day job, i needed a way to send real time events to clients that would in turn trigger some action on their side. The clients could ask for some computation from server which may take time.

To tackle this situation, i ended up making Tornado as a websocket server which will be different from our web app server (and both behind nginx). There are a couple of other services which the client may ask for indirectly. Since, those computations won’t have normal request – response cycle, the results from the computations will have to pushed to the clients. Since, the communication between the client and server is two-way so, websocket seemed fitting. For routing of messages internally, i decided to use Rabbitmq
and Celery for actual execution of tasks.

The problem with this is: Rabbitmq consumer and Tornado both run their own I/O loop. That confused me a little because i had heard this combo worked for zulip when i was randomly reading about their architecture. So, i duckduckgoed(:D) and found this article: https://reminiscential.wordpress.com/2012/04/07/realtime-notification-delivery-using-rabbitmq-tornado-and-websocket/   . It turns out he also had a similar doubt and he got a solution.

Pika library comes with a tornado adapter named TornadoConnection. This makes running the rabbitmq consumer loop inside the tornado IOloop itself. The code for tornado connection is fairly simple. As the code given in the blog wasn’t fully functional, i had to contact the source code of pika a couple of times.

Each websocket connection in tornado gets a unique WebSocketHandler object and these are not directly accessible from the tornado application object. But, the reverse is true. Each websocket handler has access to the application object. So, using TorandoConnection, we tie up one pika consumer to the tornado application object.

server.py

def main():
''' The main method to run the tornado application '''

pc = PikaConsumer(io_loop)

application.pc = pc
application.pc.connect()
application.listen(8080)
io_loop.start()


consumer.py

class PikaConsumer(object):
''' The pika client the tornado will be part of '''

def __init__(self, io_loop):
print 'PikaClient: __init__'
self.io_loop = io_loop
self.connected = False
self.connecting = False
self.connection = None
self.channel = None
self.event_listeners = {}

def connect(self):
''' Connect to the broker '''
if self.connecting:
print 'PikaClient: Already connecting to RabbitMQ'
return

print 'PikaClient: Connecting to RabbitMQ'
self.connecting = True

cred = pika.PlainCredentials('someuser', 'somepass')
param = pika.ConnectionParameters(
host='localhost',
port=5672,
virtual_host='somevhost',
credentials=cred)
param,
on_open_callback=self.on_connected)

def on_connected(self, connection):
print 'PikaClient: connected to RabbitMQ'
self.connected = True
self.connection = connection
self.connection.channel(self.on_channel_open)

def on_channel_open(self, channel):
print 'PikaClient: Channel open, Declaring exchange'
self.channel = channel
# declare exchanges, which in turn, declare
# queues, and bind exchange to queues
self.channel.exchange_declare(
exchange='someexchange',
type='topic')
self.channel.queue_declare(self.on_queue_declare, exclusive=True)

def on_queue_declare(self, result):
queue_name = result.method.queue
self.channel.queue_bind(
self.on_queue_bind,
exchange='someexchange',
queue=queue_name,
routing_key='commands.*')
self.channel.basic_consume(self.on_message)

def on_queue_bind(self, is_ok):
print 'PikaClient: Exchanges and queue created/joined'

def on_closed(self, connection):
print 'PikaClient: rabbit connection closed'
self.io_loop.stop()

def on_message(self, channel, method, header, body):
print 'PikaClient: message received: %s' % body
self.notify_listeners(body)
# important, since rmq needs to know that this msg is received by the
# consumer. Otherwise, it will be overwhelmed
channel.basic_ack(delivery_tag=method.delivery_tag)

def notify_listeners(self, event_obj):
# do whatever you wish
pass

# listener.id is the box id now
self.event_listeners[listener.id] = {
'id': listener.id, 'obj': listener}
print 'PikaClient: listener %s added' % repr(listener)

def remove_event_listener(self, listener):
try:
del self.event_listeners[listener.id]
print 'PikaClient: listener %s removed' % repr(listener)
except KeyError:
pass

def event_listener(self, some_id):
''' Gives the socket object with the given some_id '''

tmp_obj = self.event_listeners.get(some_id)
if tmp_obj is not None:
return tmp_obj['obj']
return None



That’s it. In your WebSocketHandler objects, you can access the consumer via: self.application.pc

Although, this is working fine for me right now but, i am not fully satisfied with this. At present each connection is listening to a single queue because in rabbitmq one consumer cannot listen to multiple queues.

September 08, 2017

Kshithij Iyer

Some out of the box decor in a shop. #ufo (at Ufo)

Some out of the box decor in a shop.
#ufo (at Ufo)

Ashwani Kumar Gupta

Creating desktop entries in GNU/Linux

Have you ever installed a new program on your linux machine and could not figure out why it doesn’t come up in the launcher search menu? You can still access the program from the terminal it works fine. For example, if you ever installed sublime text you might faced this problem.

Desktop environments and desktop entries

Every GNU/Linux distribution provides a desktop environment which is basically a GUI (Graphical User Interface) for the operating system. A distribution comes with a default desktop environment when you install it for the first time but one can choose and change from various desktop environments out there. Check this link to know how it can be done. The desktop entries are just a specification for a program to integrate it with the desktop environment.

How to put our application on the launcher?

For creating a desktop entry you have to create a .desktop file and edit the file with the specification of the application. We will be creating a desktop entry for sublime text. You can choose any other program for which you want to make a desktop entry. Open your favourite text editor and create a file ​ sublime_text.desktop. Inside this file copy and paste the following text.

[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
Comment=Sophisticated text editor for code, markup and prose
Exec=/opt/sublime_text/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
Actions=Window;Document;

The .desktop file consists of a bunch of fields and their values. Let’s look at what these mean one by one.

Version

This refers to the .desktop file version (Not the application version). Hence it is 1.0

Type

It specifies the type of the program.

Name

This refers to the name of the application. This name will be shown in the launcher. We set it to Sublime Text as we are creating one for sublime text.

This is a very important field. This specifies the path of the program that will be executed. The full path has to be specified in here. In case the path of the program is specified in the $PATH environment variable, then only the filename will do the task. Terminal It specifies if the program can be run on a terminal window or not. It has to be either true or false. MimeType It specifies the type of file(s) the program can open. MimeType refers to the type of the data. Here is a complete list of MIME types. Icon This is the path to the icon file that the program/file will be using. In our case we entered the directory name as there is only one icon inside it. Categories It is the categories of the application. Multiple categories are split with ;. This categorisation is useful as it helps categorising applications on the computer. To know more about the desktop entry specifications refer to freedesktop desktop entry specification. After you have put the specifications in the file save it with sublime-text.desktop filename. To get it when you search in the launcher, you have to put the file inside /usr/share/applications or ~/.local/share/applications depending upon creating it for all users or a single user. To do this you have to get root access. sudo mv sublime-text.desktop /usr/share/applications/sublime-text.desktop  The above command will ask you for your password and put your file in the /usr/share/applications folder. After this, search for ‘sublime text’ on your launcher and you will be able to find it like below. That’s it. You have created your new desktop entry. September 07, 2017 Himanshu Awasthi Python Express(in Kanpur) Hey Guys ! This is Himanshu & I have good news for Kanpur Python users . Python Express going to conduct Python Beginner workshop at two colleges of Kanpur . Before describe more about these college I will inform you about Python Express . What is Python Express ? Python Express is the ongoing effort of PSSI with aim of increasing the awareness and awesomeness of Python Programming Language within the student community in India. Python Express started as an initiative in the month of August 2013, just before the annual PyCon India conference, a bunch of volunteers came together and decided to spread the love of Python far and wide. A lot of colleges and instructors came together conducting numerous workshops, and we celebrated that month as the PythonMonth. Python Month shows how people passionate about python language , the response and enthusiasm was tremendous. PSSI decides if people wanted to learn, and there were people ready to teach, why restrict ourselves to just one month from that day PythonExpress brings tutors, organizations and students together to spread the love of Python far and wide. PythonExpress conducts free python workshop all over the India To create more awareness on Python programming language and help to build larger Python community. Only Two colleges from Kanpur apply for workshop but really Happy to see the name of colleges from my city. First college is Allenhouse Institute of Technology & I’m taking the beginner session & another is Kanpur Institute of Technology & I will be volunteering this workshop. you can check out below links : Thank You ! Python Express Happy Coding! Samridhi Agarwal Euler Problem no. 4 with Python I Solved the 4th problem from the Euler’s problem set using python and found that it can be done in multiple ways. The problem is related to palindrome concept. Problem Statement – A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. I first approached the problem statement by thinking that how many maximum digits will a number have so 2 three digits will have max 6 digits number when multiplied and that can be easily achieved by first multiplying the biggest numbers so I took a reverse loop. And then checked the condition of being a palindrome number and displayed the greatest one after comparison . Python Code -> palindrome = 0 # 2 variables to find the biggest palindrome for a in range(999, 100, -1): #First factor #second factor starts from a so that one multiplication does not repeat. for b in range(a, 100, -1): number = a * b if number > palindrome: #To check if number is a palindrome. x = str(a * b) if x == x[::-1]: palindrome = a * b print(palindrome)  Output -> 906609  Trying More Euler’s Problem and the same code with C++. Back to Coding Life! After all this long time I returned back to my hostel (after a lot more traveling and sad days). Everything seems stable now and I wish this remains for a longer time. So today as I returned back there were many things and many tasks to be completed – the internship work (mainly), I missed the dgplug sessions (reading the logs), Assignments and College. So Completed with few things now and enjoyed the whole day with my laptop (after 7 days long holiday). First I did the tasks of the internship work (still left with much more). Read the previous 4 logs which i missed (dgplug). There was a session in dgplug where warthog9 was there for the guest session. He was the one who gave us the battle bunnies in the PyCon Pune 2017 and i also wanted to ask him few things about the bunnies but hard luck missed the chance! But the session was great i read the logs and got to learn many things about hardware. I think I will take one more day to return to the normal schedule where i can write atleast two codes a day and learn things. Still I tried to complete most of the things (satisfied by myself ). Vipin kumar FOR-LOOP-IN-C This loop is called controlled loop in C. it genraly divided in three parts initializaton ,condition and expression[increment/decrement,etc.] all three parts are optional. If you do’nt give condition to for looop it become true and run infinit times. SYNTEX : 1. for( initializaton ; condition ; expression ) statement ; 2. for( initializaton ; condition ; expression ) { statement_1 ; statement_2 ; statement_3 ; statement_……; } NOTE : remember the ( ; ) semicolon after each part. initializaton : In this part we can store values in variable those will used by loop statement. or we can say we can do our initializaton here in this part. This part of for loop execute first and once only. condition : you use a lots of condition in while or do-while loop this is same in this part we can write our condition. This place in for loop is check each time during execution. if condition become false then loop stop executing. expression : In this part of loop we can write any expression which execute after running body of loop. amd execute each time loop will execute. FLOW-OF-CONTROLE-IN-FOR-LOOP : In this loop first of all the initializaton part will execute it will execute once then or conditional part will execute after initializaton it check every time and if it,s true then loop will execute after checking the condition the flow of loop will move forwarde now the body of loop will execute after running hole body of loop The expression will execute after executing body of loop and after it again the condition will check and loop will flow continusly untill condition become false. Now ready for a lots of question on for loop. Print-lucas-serese-using-do-while-loop /* Let me tell you what a lucas serese it’s a serese in which numbers are to be arange in a secquence the secquence is given below 1 3 4 7 11 18 29 …………… and we have to print this serese till N. where user will give value of N */ #include<stdio.h> void main() { int sum,first,second,Number; printf(“Enter a number : “); scanf(” %d”,&Number); sum = 0 , second = 3 , first = 1; do { printf( ” %d “,first ); sum = first + second ; first = second ; second = sum ; Number–; } while ( Number >= 1 ); } Print-fibonacci-serese-using-do-while-loop /* Let me tell you what a fibonacci serese it’s a serese in which numbers are to be arange in a secquence the secquence is given below 0 1 1 2 3 5 8 …………… and we have to print this serese till N. where user will give value of N */ #include<stdio.h> void main() { int sum,first,second,Number; printf(“Enter a number : “); scanf(” %d”,&Number); sum = 0 , second = 1 , first = 0; do { printf( ” %d “,first ); sum = first + second ; first = second ; second = sum ; Number–; } while ( Number >= 1 ); } Read-a-number-and-check-it-is-palindrome-or-not-using-do-while /* If you know what is a palindrome then you can directly move to code else read a few line given beloww a number is said to be palindrome if it’s reverse is same as number. e.g. – > 1234 is a number and reverse of number is 4321 hence it is not a palindrome. 6776 is a number and it’s reverse is 6776 both the nuber and reverse are equale hence we can say this number is a palindrome. */ #include<stdio.h> void main() { int Number,reverse,i; printf(“Enter a Number :”); scanf(“%d”,&Number); i = Number; reverse = 0; do { reverse = reverse * 10 + i % 10; i = i / 10 ; }while ( i != 0 ); if ( Number == reverse ) printf(“Enterd number is an palindrome”); else printf(“Enterd number is not an palindrome”); } Read-a-number-and-check-it-is-prime-or-not-using-do-while #include<stdio.h> void main() { int Number,i,flag; printf(“Enter a Number :”); scanf(“%d”,&Number); i = 2; // because every number is divesible by 1 ; flag = 1; // we can give any value to flag. do { if ( Number % i == 0 ) flag = 0; // if number divide by any number from 1 to number-1 then flag become 0. i++; }while( i < Number ); // because each number is divesible by itself so we move from 2 to Number-1. if( flag == 0 || Number == 1 ) printf(“Enterd number is not an prime number”); else printf(“yes enterd number is an prime number”); } September 06, 2017 Mohit The Rabbit or Turlte "The Rabbit and The Turtle" We all have heard of this Aesop "The Rabbit and The Turtle". It is a story where a turtle despite being slow challenges rabbit for a race and rabbit out of overconfidence, stop to take a nap and lost it. The moral behind this story was "Slow and Steady wins the race". Most of you must have heard this story only up to here, let me tell you my friends, it was just a trailer. "The Story Beyond" At the end of the race, rabbit realized his mistake and out of shame (cause one of the fast animal was lost to one of the slowest animal) went to challenge the turtle again. As expected, this time rabbit won the race. The moral behind this part is "Fast and Persistent wins the race". But Wait a minute, there's still something left, "The Final Blow" This time, turtle again challenges the rabbit with a condition of choosing the arena himself and Rabbit said yes! (No doubt) Out of Rabbits surprise, the arena for the race was the pond. And there is no doubt that this time turtle won the race. The moral of the Final Blow is: "Never Underestimate your core competence" Now, What I concluded of all this... Conclusion Part 1(Slow and Steady): As a tech-geek, we should approach to learn any new technology Slow and Steady, never quit in between or you will loose to those, who were once lacking from you. So Always, delve deeper into new technologies slow and steady to get a good grasp. Part 2 (Fast and Persistent): If Someone like me, wants to learn something in a very short time, this approach will be the best. You have to approach the technologies with a faster pace and keep it persistent. But also like me, most of you, might not be persistent and may take a pause which is their biggest mistake. Part 3 (Core Competence): Never Underestimate your Core Competence, everyone got something, everyone has something special. Everyone is pretty good at some things and not at all in other things. Now, you might wonder how come we are discussing these stuff today. Because..., I didn't know about these other two parts and When I did, I felt I should spread the word. September 05, 2017 Bhavin Gandhi Finding the data usage culprit [ packagekitd ] Yesterday morning, I noticed that my laptop was using high bandwidth. It was nearly 1MBps. It was little bit suspicious for me. At first, I thought it must be Chrome, but later I realized Chrome does not auto update itself.… The post Finding the data usage culprit [ packagekitd ] appeared first on GeekSocket. Vivek Anand Running Firefox as kiosk application on RPi3 At my day job, i had to run firefox as a kiosk application on RPi3. In this blog post, i will note down the steps that i did so that i or my team members can refer to it when needed. I have not used any display manager or Desktop Environment but had to use matchbox-window-manager to make firefox run on full screen. 1. sudo apt-get install vim (this is just for me, i can’t help it) 2. sudo apt-get install xorg xutils matchbox-window-manager 3. sudo apt-get install iceweasel (this is firefox :p) 4. sudo raspi-config 1. Go to boot options and setup auto login for user pi 2. Change the keyboard layout if you wish to 5. As a sudo user, do the following steps: 1. cp -r /home/pi /opt/ 2. cd /opt/pi 3. chmod -R a+r . 4. touch .xsessionrc 5. chmod a+x .xsessionrc 6. Open .xsessionrc as a sudo user and put the following lines there: 1. xset s off # no screen saver xset -dpms # disable some power consumption thingy xset s noblank # don’t blank the rpi screen matchbox-window-manager & while true; do firefox –url http://127.0.0.1 done 7. Copy .xsessionrc file to /home/pi/ 1. cp .xsessionrc /home/pi 8. Configure .bash_profile to start X server when user logs in: 1. if [ -z “$DISPLAY” ] && [ -n “$XDG_VTNR” ] && [ “$XDG_VTNR” -eq 1 ]; then
exec startx
fi
9. Install an extension in firefox to apply kiosk mode. The first extension that comes up when you search kiosk in addons works fine

The blog post that helped most in coming up this setup was: http://www.alandmoore.com/blog/2011/11/05/creating-a-kiosk-with-linux-and-x11-2011-edition/

September 04, 2017

Himanshu Awasthi

Experience of PyData Delhi’17

Hello Guys ! I’m Himanshu Awasthi . I’m very excited to share my experience about First PyData Conference in India. PyData Conf was brilliantly organized by PyData Delhi Community  at IIIT Delhi. PyData Delhi was two days event which means lots of fun & learning . I learned about Neural Network  , ArcGis Api , How to Create Sense2vec model  , also very first interaction with JuliaLang  and lots of Stuffs related to Data Science & visualization.

First Day of conference started by awesome keynote by YouTube Star Siraj Raval . He talks about Math behind Deep Learning .

You can watch video here .

Workshop track was awesome and taken by amazing peoples . I attended these workshops :

1. Machine learning as a Service by Anand Chitipothu.
2. Deep Reinforcement Learning by Shubham Dokania
3. Create a Sense2vec model using Gensim & spacy by Tanu Mittal & Abhishek Kapoor
4. Introduction to Julia Lang by Dr. Sandeep Nagar

Each talk & workshop was awesome and brilliantly organized by the volunteers and speakers .

Keynotes was awesome but keynote taken by Dr. Pannurangam Kumaraguru about Data Science for Social Good was most impact full talk I have ever seen .

I discussed people about firefly & NetworkX  Library & finally found them amazingly useful . I also met some of my friends & mentor of other python communities .

I really thank full to NumFOCUS because they help people to form a community & learn Data Science together.

I suggest students who willing to learn Deep learning , Data science should join the community of PyData. I miss the open space due to some reason . So I’m really happy to inform you that PyData Kanpur is the local chapter of PyData so the students , Developer who willing to be a part of PyData Community can join us  :

PyData Kanpur

Kanpur, IN
33 Members

PyData is an educational program of NumFOCUS, a 501(c)3 non-profit organization in the United States. PyData provides a forum for the international community of users and deve…

Next Meetup

Welcome to PyData Kanpur

Friday, Sep 15, 2017, 5:00 PM
6 Attending

Thank you !

Happy Coding !

Vivek Anand

Star a project on pagure

This feature was marked as “wishful” and it was supposed to be a low priority but i implemented it out of frustration. This should be there in the next feature release.

Star feature is already there on github and gitlab. I use this feature on github a lot. If I like an open source project, i star it. You also have a list of all the projects which you have starred which can be helpful if you have come across a project sometime ago and had starred it and you want to know more about it (given that you don’t exactly remember the name, otherwise you can just search). Also, if the project author/maintainer is anything like me, he would love to see the star count rising.

For sometime now, i had been asking people who use pagure often (and hopefully like pagure) to star it on github. The star count of pagure was 96 at the time i started my work on star project feature. Last year, at this time, it was in late 60s.

If you star a project on github, your followers come to know that you have liked a project. They can see that on their github homepage. If they see the project, like it, you already have helped pagure reach more people with almost zero effort. I can’t see one good reason if you like a project that you won’t star it.

Pagure doesn’t have the follow feature and i am not sure it will have in near future. This means the star project won’t have it’s full effect. But, one can star a project, there is a star count, there is a list of people who have starred, there is a list of starred projects of a user.

Here is how you can use this feature:

2. There is a star button, just beside the fork button. It has a star count just beside it.
3. Star it if you like the project.

Here is where you will find your starred projects:

2. The drop down on the top right corner will be “My Stars”

Here is where you can see who all have starred a particular projects:

1. Right beside the star button on repo page, we have a star count which actually links to a page which lists all the users who have starred the project.

The Socket Programming

Few months ago, i was browsing on my laptop i came across the resume of one of my ideals Aman Goel, I noticed something like "Made a Client Server Messenger using  socket programming libraries of C++ to design a simple server that could chat with upto 30 clients simultaneously." I was like what is this !! socket programming ???? is it saying socket like the electrical engineers study :P ?
I tried to understand what it is but in vain . After few days i lost interest in it so i moved on. As you may be knowing , if you regularly follow me that i am an active student of #dgplug :) there python sessions started. We were taught how powerful and easy python is because of its friendliness and huge bundle of libraries. So again the thought of socket programming came in my mind ,i failed to understand the codes of socket programming in java and c++ then lets give a try with python and atlast i got it :) . Yeah not every thing may be 1% of socket programming but with that knowledge i also made a client server messenger.
How the python files work :---
There are two python files namely server.py and client.py

server.py     code is given below:---
  1 2 3 4 5 6 7 8 91011121314151617181920212223242526272829303132 import socketimport timedef Main(): host="127.0.0.1" port=5001 mySocket =socket.socket() mySocket.bind((host,port)) mySocket.listen(1) conn, addr= mySocket.accept() print ("Connection from: "+ str(addr)) while True: data=conn.recv(1024).decode() if not data: break print("from connected user: "+ str(data)) #data= str(data).upper() #print("Received from user: "+ str(data)) data=input(">>> ") conn.send(data.encode()) conn.close()if __name__ == '__main__': Main()

client.py     code is given below:---
  1 2 3 4 5 6 7 8 91011121314151617181920212223242526272829 import socketdef Main(): host='127.0.0.1' port=5001 mySocket= socket.socket() mySocket.connect((host,port)) message= input(">>> ") while message !='exit': mySocket.send(message.encode()) data=mySocket.recv(1024).decode() print('Recieved from natasha bot: '+data) message = input(">>> ") mySocket.close()if __name__=='__main__': Main()

How to run the messenger :---
Open 2 terminals .From terminal no. 1 run the server.py file so that it starts listening on its port and then from the terminal no.2 as soon as we run client.py

short commings to be updated:---
>>>Multiple client messenger to be done
>>>possibly make a GUI of it(i dont know how to though :P)
>>>Now the messenger works within my system only , i want it to be live in the internet :P
Note :---
---------------
>>>Snapshots will be updated soon
>>>The blog is incomplete. I will complete it and there i will explain the code line-wise.
>>>Feel free to contact me if you wanna contribute to my project by any means be it even a readme.txt file :) https://github.com/soumam007/chat_App

email : soumambanerjee007@gmail.com

The Socket Programming

Few months ago, i was browsing on my laptop i came across the resume of one of my ideals Aman Goel, I noticed something like "Made a Client Server Messenger using  socket programming libraries of C++ to design a simple server that could chat with upto 30 clients simultaneously." I was like what is this !! socket programming ???? is it saying socket like the electrical engineers study :P ?                  I tried to understand what it is but in vain . After few days i lost interest in it so i moved on. As you may be knowing , if you regularly follow me that i am an active student of #dgplug :) there python sessions started. We were taught how powerful and easy python is because of its friendliness and huge bundle of libraries. So again the thought of socket programming came in my mind ,i failed to understand the codes of socket programming in java and c++ then lets give a try with python and atlast i got it :) . Yeah not every thing may be 1% of socket programming but with that knowledge i also made a client server messenger.How the python files work :---There are two python files namely server.py and client.py

server.py     code is given below:---

import socket
import time

def Main():
host="127.0.0.1"
port=5001

mySocket =socket.socket()
mySocket.bind((host,port))

mySocket.listen(1)
while True:
data=conn.recv(1024).decode()
if not data:
break
print("from connected user: "+ str(data))
#data= str(data).upper()

data=input(">>> ")
conn.send(data.encode())

conn.close()

if __name__ == '__main__':
Main()

client.py     code is given below:---

import socket

def Main():
host='127.0.0.1'
port=5001

mySocket= socket.socket()
mySocket.connect((host,port))

message= input(">>> ")

while message !='exit':
mySocket.send(message.encode())

data=mySocket.recv(1024).decode()
print('Recieved from natasha bot: '+data)

message = input(">>> ")

mySocket.close()

if __name__=='__main__':

Main()

How to run the messenger :---Open 2 terminals .From terminal no. 1 run the server.py file so that it starts listening on its port and then from the terminal no.2 as soon as we run client.py                 short commings to be updated:--->>>Multiple client messenger to be done>>>possibly make a GUI of it(i dont know how to though :P)>>>Now the messenger works within my system only , i want it to be live in the internet :PNote :------------------>>>Snapshots will be updated soon>>>The blog is incomplete. I will complete it and there i will explain the code line-wise.>>>Feel free to contact me if you wanna contribute to my project by any means be it even a readme.txt file :) https://github.com/soumam007/chat_Appemail : soumambanerjee007@gmail.comx

Kshithij Iyer

"If you stop at everything that terrified you, you’ll be left with nothing."

“If you stop at everything that terrified you, you’ll be left with nothing.”

- Kshithij Iyer

September 01, 2017

Vipin kumar

#include<stdio.h>
void main()
{
int i,x,Square;

printf(“Enter a number:”);
scanf(“%d”,&x);

i = Square = 1;

do
{
Square = Square * x;
i++;
}while( i <= x );

printf(“Power is %d.”,Square);
}

#include<stdio.h>
void main()
{
int Number,rev;

printf(” Enter a number “);
scanf(“%d”,&Number);

rev = 0;

do
{
rev = rev *10 + Number % 10 ;
Number = Number / 10;

}while( Number != 0 );

printf(” Reverce of Number is %d.”,rev);
}

#include<stdio.h>
void main()
{
int Number,counter;

printf(” Enter a number “);
scanf(“%d”,&Number);

counter = 0;

do
{
counter++;
Number = Number / 10;

}while( Number != 0 );

printf(” Number of degits are %d.”,counter);
}

#include<stdio.h>
void main()
{
int i,N,r;

printf(“Enter a number:”);
scanf(“%d”,&N);

i = 1;

do
{
r = i*i;
printf(“Square of %d is %d.\n”,i,r); // or printf(“Square of %d is %d.\n”,i,i*i);
i++;
}while( i <= N );
}

DO-WHILE LOOP

DO-WHILE LOOP in C : —>>>
This loop in C creates a structured loop that executes as long as a speecifid condition
is true at the end of each pass through the loop.

SYNTAX :

do
{
statement;
statement;
statement;
statement;
statement;
} while( condition );

condition_expression is an expression that is evaluated at end of each pass through the loop. if the value of the
expression is ” false ” (that is compares equal to zero )the loop is exited.

in this loop expression condition is check at the end of each pass through the loop,
in this loop the body of loop is executes once even our condition is false.

I will give you homework today
you people has to find the diffrent between while and do-while loop and write that in the comment box.

Some question on while loop

Find outputs :

1.

#include<stdio.h>
void main()
{
int i = 1;
while ( i <= 10 )
{
printf(“value of i is %d.\n”,i);
i = i+1;
}
}
/*
OUTPUT :

value of i is 1.
value of i is 2.
value of i is 3.
value of i is 4.
value of i is 5.
value of i is 6.
value of i is 7.
value of i is 8.
value of i is 9.
value of i is 10.
*/

2.

#include<stdio.h>
void main()
{
int i = 10;
while ( i >= 1 )
{
printf(“value of i is %d.\n”,i);
i = i-1;
}
}

/*
OUTPUT :

value of i is 10.
value of i is 9.
value of i is 8.
value of i is 7.
value of i is 6.
value of i is 5.
value of i is 4.
value of i is 3.
value of i is 2.
value of i is 1.
*/

3.

#include<stdio.h>
void main()
{
int i = 1;
while ( i <= 10 )
{
printf(“value of i is %d.\n”,i+1);
i = i+1;
}
}

/*
OUTPUT :

value of i is 2.
value of i is 3.
value of i is 4.
value of i is 5.
value of i is 6.
value of i is 7.
value of i is 8.
value of i is 9.
value of i is 10.
value of i is 11.
*/

4.

#include<stdio.h>
void main()
{
int i = 1;
while ( i <= 10 )
{
printf(“value of i is %d.\n”,i*i);
i = i+1;
}
}

/*
OUTPUT :

value of i is 1.
value of i is 4.
value of i is 9.
value of i is 16.
value of i is 25.
value of i is 36.
value of i is 49.
value of i is 64.
value of i is 81.
value of i is 100.
*/

5.

#include<stdio.h>
void main()
{
int i = 1;
while ( i <= 10 )
{
printf(“value of i is %d.\n”,i);
i = i + 2;
}
}

/*
OUTPUT :

value of i is 1.
value of i is 3.
value of i is 5.
value of i is 7.
value of i is 9.
*/

6.
#include<stdio.h>
void main()
{
int i = 1;
while ( i <= 10 )
{
if( i%2 == 0)
printf(“value of i is %d.\n”,i);
i = i + 1;
}
}

/*
OUTPUT :
value of i is 2.
value of i is 4.
value of i is 6.
value of i is 8.
value of i is 10.
*/

7.

#include<stdio.h>
void main()
{
char i = ‘a’;
while ( i <= ‘h’ )
{
printf(“value of i is %d.\n”,i); //keep %d in mind
i = i + 1;
}
}
/*
OUTPUT :
value of i is 97.
value of i is 98.
value of i is 99.
value of i is 100.
value of i is 101.
value of i is 102.
value of i is 103.
value of i is 104.
*/

8.

#include<stdio.h>
void main()
{
char i = ‘a’;
while ( i <= ‘h’ )
{
printf(“value of i is %c.\n”,i);
i = i + 1;
}
}

/*
OUTPUT :
value of i is a.
value of i is b.
value of i is c.
value of i is d.
value of i is e.
value of i is f.
value of i is g.
value of i is h.
*/

I think we know while loop very well now.

Increment-Decrement-operator

Before we move forward we will take knowledge of some more operator .

They are those kind of operator who increse or decrese the value of a variable
by 1.these are unary operators and can only applied with variables.

EX:
1.
int a = 5;
a++;
printf( ” \n %d \n “,a ); // Output: 6

2.
int n = 5;
n–;
printf( ” \n %d \n “,n ); // Output: 4

These operator has two forms:

1. prefix: In this case operator plased before variable.The expression return
changed value.it solved before all operator .
[ ++variable –variable ]

2. postfix: In this case operator plased after variable.The expression return
unchanged value.it solved after all operator .
[ variable++ variable– ]

EX. for prefix :
1.
int n = 5,p;
p = ++n;
printf( ” \n %d \n %d \n “,p,n ); // Output: 6 6

2.
int n = 5,p;
p = ++n*2;
printf( ” \n %d \n %d \n “,p,n ); // Output: 12 6

3.
int n = 5;
printf( ” \n %d \n “,++n ); // Output: 6

EX. for postfix :
1.
int n = 5,p;
p = n++;
printf( ” \n %d \n %d \n “,p,n ); // Output: 5 6

2.
int n = 5,p;
p = n++*2;
printf( ” \n %d \n %d \n “,p,n ); // Output: 10 6

3.
int n = 5;
printf( ” \n %d \n “,n++ ); // Output: 5

Now some examples for you –>

1.
int n = 3,p;
p = n++ + n++ + n++ + n++ ;
printf( ” \n %d \n “,p,n ); // Output: 12 7

2.
int n = 3,p;
p = ++n + n++ + ++n + n++ ;
printf( ” \n %d \n “,p,n ); // Output: 20 7

3.
int n = 3,p;
p = ++n + ++n + ++n + ++n ;
printf( ” \n %d \n “,p,n ); // Output: 28 7

NOTE :-> you will get wrong output of all three quection’s in gcc or in code::block compiler .because of there undefined nature so don’t worry about that the written answer are correct.

NOW some importent points  :
r = p++ + Q;               /* ok */
r = p+++Q;                /* ok */
r = p++++Q;             /* error */
r = p++ + +Q;          /* ok */
r = p+++++Q;         /* error */
r = p++*++Q; /* ok */

#include<stdio.h>
void main()
{
int i,N,largest,smallest;

i = 1;

printf(“Enter a number\n”);
scanf(“%d”,&N);

largest = smallest = N;

while( i <= 9 )
{
printf(“Enter a number\n”);
scanf(“%d”,&N);

if( N > largest )
largest = N;
if( N < smallest )
smallest = N;
i = i+1;
}
printf(“largest Number is = %d \n and smallest Number = %d”,largest,smallest);
}

In this program we have Read 2 numbers from keyboard and finding power.

#include<stdio.h>
void main()
{
int i,x,y,power=1;

printf(“Enter base\n”);
scanf(“%d”,&x);

printf(“Enter power\n”);
scanf(“%d”,&y);

while( i <= y )
{
power = power*x;
i = i+1;
}
printf(” x power y = %d where %d is x and %d is y”,power,x,y);
}

#include<stdio.h>
void main()
{
int N,i,sum;
float avg;

avg = sum = 0;

i=1;
while( i <= 10 )
{
printf(“Enter value of N :”);
scanf(“%d”,&N);

sum = sum + N;
}
avg = avg / 10;

printf(“The sum of number is %d and the avrage is %f”,sum,avg);
}

#include<stdio.h>
void main()
{
int i,N,large;

i = 1;

printf(“Enter a number\n”);
scanf(“%d”,&N);

large = N;

while( i <= 9 )
{
printf(“Enter a number\n”);
scanf(“%d”,&N);
if( N > large )
large = N;
i = i+1;
}
printf(“The largest number is %d”,large);
}

#include<stdio.h>
void main()
{
int i,N,odd,even;

odd = even = 0, i = 1;

while( i <= 10 )
{
printf(“Enter a number\n”);
scanf(“%d”,&N);
if( N%2 == 0 )
even = even+1;
else
odd = odd+1;
i = i+1;
}
printf(“number of Odd numbers are = %d \n and number of Even Numbers are = %d”,odd,even);
}

#include<stdio.h>
void main()
{
int N,i,pos,neg;
neg=pos=0; // if we not give zero than
// there would be some gurbage value in these

i = 1;

while( i <= 10 )
{
printf(“Enter a number N :”);
scanf(“%d”,&N);

if( N > 0)
pos = pos+1;
else
neg = neg+1;

i = i+1;
}
printf(“Positive Number are %d,and Negetive Number are %d.”,pos,neg);
}

#include<stdio.h>
void main()
{
int i,Number,factorial;

i = factorial = 1;

scanf(“%d”,&Number);

while( i <= Number )
{
factorial = factorial*i;
i = i+1;
}
printf(“Factorial of the number is %d”,factorial);
}

#include<stdio.h>
void main()
{
int N,i;

printf(“Enter value of N :”);
scanf(“%d”,&N);
i=1;
while( i <= 10 )
{
printf(“%d\n”,N*i);
i = i+1;
}
}

Kshithij Iyer

Finally! the perfect mashed potatoes. #mashedpotatoes...

Finally! the perfect mashed potatoes.
#mashedpotatoes #cookinglevel99 (at Pune, Maharashtra)

August 31, 2017

Kshithij Iyer

#vr46 #quoteoftheday

#vr46 #quoteoftheday

August 30, 2017

Robin Schubert

My start to Emacs/Spacemacs

In this post I’m going to share my experience with Spacemacs – a GNU emacs configuration – and how it became my main editor from the first start. I will try to mention all those little things that I found convenient but had to discover myself, as I could not find them in a comprehensive guide.

My personal editor history

I have always been a vim guy. I was taught vim during my Physics and Computer science studies, meaning: I had to learn it to pass the course, we even had tests. I’m glad we did though, it’s a great editor and once I got used to the keybindings (I still figure out some cool tricks from time to time) I never wanted to use anything else anymore – and no mouse of course.

I use that keybindings everywhere I can, in my i3 environment, in mutt, or when browsing with Palemoon and the Pentadactyl plugin.

When doing larger coding projects, some functionality has to be added to vim though (for my taste), to make the editor more convenient and to solve simple and repeating tasks quicker. I found vim to become quite slow when packed with too many plugins, especially with Python auto-completion / introspection it was no fun to use anymore.

So I switched to sublime text, an excellent editor in my opinion – providing vim mode, hackable with Python code and very much customizable with json style settings. I loved it and still would use it, if only there wasn’t this little sting all the time; Although free to use, Sublime text will remind you every X savings you do, that you can buy a license (which is not even very expensive, 70$for a superb product). This gave me a little stitch, not because good software has a price, but because it reminded me that I’m using non-free software again. So I decided to give GNU Emacs another try. I had installed Emacs on my system before to check out what’s so nifty about it, that you would use it in favor of vim. I worked through the tutorial (which I can recommend to everyone, since you will meet Emacs keybindings everywhere – the Bash is my favorite example). However, the permanent use of the Ctrl and Alt/Meta key felt so inconvenient for me as vim user, not even evil mode could help it, and I abandoned Emacs. I learned about Spacemacs in a #dgplug session and gave that a try. I was skeptic at first, but it turned out that Spacemacs felt so intuitive and convenient from the first use, that I stopped using any other editor in an instant. Spacemacs Spacemacs is just a configuration for Emacs. That was important to me, I did not want to loose compatibility to other Emacs set-ups and enjoy the full Emacs experience. Also I would be lost if I couldn’t google for solutions to problems in classic Emacs forums. However, the layer of abstraction that Spacemacs adds to Emacs is obvious. In Emacs, you can add features by adding a major mode and various minor modes to your buffer, and design a specific environment for all your specific tasks. That’s either copy and paste someone else’s config file to your own, or quite some time of fiddling with lisp. Spacemacs does this by providing configuration layers, that will set up the major and minor modes and other things in the background for you already. So far I find this very convenient with nothing to miss for a nice workflow, no matter if I do Python coding, R scripting or writing my blogs or ToDos. First things first Installation was quite straight forward, following the steps on the Github page. I use Spacemacs with the helm (fully featured) distribution in evil mode (you will be asked for your preferences during first start-up). I updated my configuration layers by editing the config file: space f e d for file -> emacs -> dotfile I commented in all of the configuration layers that were out-commented per default, like autocompletion better-defaults git markdown and org etc. and added some others for my daily work: python, django, latex, ess (which is the R layer). Although I added some snippets to my config file, I did not change the default behavior or keybindings, so everything I write here refers to default settings. Basic usage Spacemacs commands mainly can be triggered using the Space key. A menu will pop up with keys and descriptions of options you have next. File operations, for example, can be accessed with f, so space f will lead you to another menu with options on file procedures. Another f press will let you open a file. Again it is useful to have at least a little Emacs background knowledge, so find file will not sound familiar to you and the space f f keybinding makes sense all of a sudden. This command opens a file on your disk. space f s will save your buffer to the file. It’s so intuitive, your fingers will almost move by themselves. Similarly, space g will bring up a git (magit) menu (the best interface to git I have ever seen, by the way), given you have activated the git configuration layer in your dotfile. With the projectile mode, space p shows options related to projects – e.g. every folder that contains a .git folder is considered a project. space p f will trigger a fuzzy search on files all over that project folder and sub-folders. I loved the ctrl+shift+p keybinding in Sublime text, that just did that and was happy not to have miss that feature. space m shows the options of your currently activate major mode. In Python mode for example, it will provide me with options of jumping to definitions, open a REPL, execute code, etc. Since the major mode may be used quite frequently, you can just type , to abbreviate the space m (it sounds ridiculous but it’s really nice to have). In Emacs, you can assign keybindings to every function or macro of your choice. The keybindings change with the modes you activate, and of course they can be changed in your config files individually. To me, this seemed very chaotic and I found it difficult to remember all those key combinations. You can however call every function by name (given that you know the name). Spacemacs let’s you do the same thing, but by default lets you search for the desired function with a nifty fuzzy search. You can trigger that either with the original Emacs Alt x keybinding or by pressing space space. I do that very often for functions I don’t need to remember the key combinations, because I don’t use them too often. With the org2blog module, for example, I can login to my wordpress account to publish the post with only a few keystrokes from within Emacs. I simply type space space login to choose and execute the org2blog/wp-login function and space space publish to trigger org2blog/wp-post-buffer-and-publish. In general, Emacs provides an excellent help, if you know how to pull it up. You might already guess it, you will find all help related options with space h. Here you can choose e.g. space to learn about the Spacemacs specific options and configuration layers. But what’s really cool is what you’ll find under space h d (for help -> describe). Here you can find help on any function f, mode m, package p and many more. Particularly helpful: space h d b let’s you fuzzy-type a function and shows you the keybindings to it. The other way round space h d k will let you type a keybinding to show you the documentation of the function it triggers. Org mode A comprehensive guide to org mode is by far beyond the scope of this blog post, but I wanted to mention this in particular, since it’s something non-emacs users hardly ever get to know. Org mode is something I read of before, but never really could make sense of. Maybe that’s because it’s so versatile. It’s structured text very similar to markdown or rST; similarly you can export your .org files to a variety of formats (latex/pdf or beamer, html – plain or even with twitter bootstrap css and js, open office odt and many others). It also provides functionality to manage ToDo lists and agendas, schedule tasks and record progress. Writing tables and formatting any kind of text is super easy. What I find a very cool bonus: it is rendered by Github to perfectly beautiful sheets. I went over to use it for my tasks at work but for my private appointments as well. The , to trigger the major mode commands comes very handy again. You can create items with a simple asterisks. shift right/left will let you cycle through the todo sequence, so you can mark an item as TODO or DONE ect. You can nest those items with more asterisks, give them tags and define deadlines or schedule your tasks. To schedule you simply press , s, which will bring up a calendar to choose from. The interface is smart enough, however, to recognize most notations you type. To schedule the task for the next day, you could write +1, to put it on next Monday just type Monday (or even just mon) and hit enter. Type 1 sep if you want to schedule for September 1st. Same thing applies for deadlines , d. You can have an arbitrary number of org files with tasks and ToDos of different domains. I have one for work and one for private stuff. With ctrl+c [ you can bring an org file to your agenda (actually I haven’t found a Spacemacs keybinding for that, yet). Your agenda can show you scheduled tasks and deadlines for the current week or provides other views and filters to not loose track. You can bring it up with , a a while in org mode (remember that , triggers major mode commands) or with space a o a (for apps -> org -> agenda) from any buffer and mode. This blog is written in Org mode and transferred to WordPress.com with the org2blog module. All I have to add are some meta information. This can be done using the #+ tag. #+TITLE: <my title here> will add a title to my blog post. elisp Again, I cannot go into detail, describing lisp or emacs lisp (elisp) here. For those who don’t know lisp, it’s a quite old functional programming language, with a lot of parentheses. It’s quite powerful, although I still find it hard to read. @shakthimaan gave an excellent starting point for elisp coding in a dgplug session. If you use Emacs, I dare say you won’t be able to avoid elisp completely, if you want to customize the editor a bit to your needs. Emacs itself is largely written in lisp and is fully hackable if you know that language. Using Spacemacs, you probably won’t get in touch with elisp that often or intensively. If you want to add a configuration layer in the dotfile, you basically add an item to an elisp list, but you’ll hardly notice. Still, I would recommend to everyone to dive into that language if you consider using Emacs or Spacemacs for you all-day work. Apart from the fact that it’s a fascinating and historically important language, it will make your life easier if you know what you’re doing. The basics (syntax, builtin datatypes and functions) are learned quite quickly; the real big deal is about learning the third party functions – I’m still too new to the language to be able to oversee the countless possibilities, but I will dive deeper into it some time. August 29, 2017 Bhavin Gandhi Running Oracle database XE 11G using Docker In our syllabus we have Advance Database Systems subject. We were instructed to use Oracle database for this. So I was searching for Oracle database EXpress edition 11g but I did not want to install it on my system directly.… The post Running Oracle database XE 11G using Docker appeared first on GeekSocket. August 28, 2017 Kshithij Iyer When you decide to keep really small spikes are a long long... When you decide to keep really small spikes are a long long time. (at Pune, Maharashtra) #NewBag (at Pune, Maharashtra) #NewBag (at Pune, Maharashtra) "Yeah, you know no better Say you different, who you kidding? Yeah, you know no better O-oh, save..." “Yeah, you know no better Say you different, who you kidding? Yeah, you know no better O-oh, save that talk for the ones who don’t know no better ‘Cause baby I know you better 'Cause baby I know no better Baby I know you better (baby I know) Baby I know you better” - Major lazer (lyrics from Know No better) Vipin kumar A simple program on while loop //let’s play a quiz. //I will give you code and you have to judge the output. #include<stdio.h> void main() { int x=1; while ( x <= 10) // this is our condiction now x is 1 so it’s true // so loop will execute it’s statement { printf(“MY NAME IS VIPIN\n”); x = x+1; // here x become 2 } // after closing of loop block condiction is recheck it will again true // because x was 2 // same process will go on untill the condiction become falce. printf(“LOOP HAS OVER”); // when x become 11 then condiction become false // and then other statements will run. } /* cann you gess if yes than very good else don’t worry i will tell you OUTPUT : MY NAME IS VIPIN MY NAME IS VIPIN MY NAME IS VIPIN MY NAME IS VIPIN MY NAME IS VIPIN MY NAME IS VIPIN MY NAME IS VIPIN MY NAME IS VIPIN MY NAME IS VIPIN MY NAME IS VIPIN LOOP HAS OVER you see it print MY NAME IS VIPIN 10 times. */ understanding while loop in C #include<stdio.h> void main() { int i; i=1; while ( i <= 10 ) { printf(“Now i is %d so accarding to condiction %d <= 10 which is true “,i,i); printf(“so loop will execute it’s statements\n”); i = i+1; } printf(“Now i is %d so accarding to condiction %d <= 10 which is not true “,i,i); printf(“so loop will stop and it’s other statements will run”); } /* Now i is 1 so accarding to condiction 1 <= 10 which is true so loop will execute it’s statements Now i is 2 so accarding to condiction 2 <= 10 which is true so loop will execute it’s statements Now i is 3 so accarding to condiction 3 <= 10 which is true so loop will execute it’s statements Now i is 4 so accarding to condiction 4 <= 10 which is true so loop will execute it’s statements Now i is 5 so accarding to condiction 5 <= 10 which is true so loop will execute it’s statements Now i is 6 so accarding to condiction 6 <= 10 which is true so loop will execute it’s statements Now i is 7 so accarding to condiction 7 <= 10 which is true so loop will execute it’s statements Now i is 8 so accarding to condiction 8 <= 10 which is true so loop will execute it’s statements Now i is 9 so accarding to condiction 9 <= 10 which is true so loop will execute it’s statements Now i is 10 so accarding to condiction 10 <= 10 which is true so loop will execute it’s statements Now i is 11 so accarding to condiction 11 <= 10 which is not true so loop will stop and it’s other statements will run */ while loop in C WHILE LOOP :—->>> This is a pree tested loop where condition is teasted and if it is true then, statements will execute and so on. syntex : while ( condiction ) { statement_1; statement_2; statement_3; statement_……; } LOOP in C LOOP iteration or repetition) controls : ——-> loops cause program to execute the certain block of code repeatedly until test condition is fals. They use while we have to perform some repetitive task in programing, actualy loop depend’s on a condition till the condition remain true loop will execute it’s statements.when condition become false loop will terminate. WE HAVE 3 LOOP IN C :::::::>>>>> 1.while 2.do-while 3.for we will study all of these one by one. week days name using switch-case #include<stdio.h> void main() { int number; printf(“Enter a Nummber : “); scanf(“%d”,&number); switch(number) // switching a number { case 1: printf(“\n\n\n\n\n SUNDAY \n\n\n\n”); break; case 2: printf(“\n\n\n\n\n MONDAY \n\n\n\n”); break; case 3: printf(“\n\n\n\n\n TUESDAY \n\n\n\n”); break; case 4: printf(“\n\n\n\n\n WEDNESDAY \n\n\n\n”); break; case 5: printf(“\n\n\n\n\n THURSDAY \n\n\n\n”); break; case 6: printf(“\n\n\n\n\n FRIEDAY \n\n\n\n”); break; case 7: printf(“\n\n\n\n\n SATURDAY \n\n\n\n”); break; // here break is compusury if we not use break // then default will also run. default: printf(“\n\n\n Invalid Number \n\n\n”); // IF VALUE DOES NOT // MATCH TO ANY CASE THEN DEFAULT // WILL RUN. } } // PASTE THE OUTPUT IN COMMENT BOX. Refreshing nesting if-else showing days of week #include<stdio.h> void main() { int Number; printf(“Enter a Number : \n”); scanf(“%d”,&Number); if( Number == 1 ) printf(” The Number is %d so the weekly name is Sunday.”,Number); else if( Number == 2 ) printf(” The Number is %d so the weekly name is Monday.”,Number); else if( Number == 3 ) printf(” The Number is %d so the weekly name is Tuesday.”,Number); else if( Number == 4 ) printf(” The Number is %d so the weekly name is Wednesday.”,Number); else if( Number == 5 ) printf(” The Number is %d so the weekly name is Thursday.”,Number); else if( Number == 6 ) printf(” The Number is %d so the weekly name is Friday.”,Number); else if( Number == 7 ) printf(” The Number is %d so the weekly name is Saturday.”,Number); else printf(“Invalid number”); } /* Output 1. Enter a Number : 5 The Number is 5 so the weekly name is Thursday. 2. Enter a Number : 56 Invalid number 3. Enter a Number : 7 The Number is 7 so the weekly name is Saturday. */ showing all days of a week after given number using switch-case #include<stdio.h> void main() { int number; printf(“Enter a Nummber : “); scanf(“%d”,&number); switch(number) { case 1: printf(“\n\n\n\n\n SUNDAY \n\n\n\n”); case 2: printf(“\n\n\n\n\n MONDAY \n\n\n\n”); case 3: printf(“\n\n\n\n\n TUESDAY \n\n\n\n”); case 4: printf(“\n\n\n\n\n WEDNESDAY \n\n\n\n”); case 5: printf(“\n\n\n\n\n THURSDAY \n\n\n\n”); case 6: printf(“\n\n\n\n\n FRIEDAY \n\n\n\n”); case 7: printf(“\n\n\n\n\n SATURDAY \n\n\n\n”); default: printf(“\n\n\n Invalid Number \n\n\n”); } } A program to check an alphabet is vowel-using-switch-case #include<stdio.h> void main() { char alfa; printf(“Enter an Alphabet : “); scanf(“%c”,&alfa); switch( alfa ) //switching a chracter { case ‘a’ : case ‘e’ : case ‘i’ : case ‘o’ : case ‘u’ : printf(“Yes Enterd Alphabet is a vowel”); break; default : printf(“No Enterd Alphabet is Not vowel”); } } A program to find Odd-even-using-switch-case #include<stdio.h> void main() { int number; printf(“Enter Your Number :”); scanf(“%d”,&number); switch ( number%2 ) // we gave expression to switch which have to switch { case 0 : // if 0 come then flow comes to this case printf(“Enterd Number is EVEN”); break; // IT is also a jump statement who break switch // and return flow of control out of switch. case 1 : printf(“Enterd Number is ODD”); break; // here no need to use break because // switch is over after this case. } } SWITCH-case in C The SWITCH-CASE is a multi way branch statement. It accept an expression/variable and test it’s value with written value in case if it match to any case than it switch flow of program there and statements written in that case will run. and the break statement will transfer flow of programe out of switch. if there will no break then hole switch will run till end. NOTE :- IT ONLY TEST INTEGER AND CHARACTERS. IT DO NOT TEST FLOAT OR DOUBLE VALES. syntex : switch (var) { case value_1 : statement_1; statement_2; statement_3…; break; case value_2 : statement_1; statement_2; statement_3…; break; case value_3 : statement_1; statement_2; statement_3…; break; \\ we can write case according to our recquirment. } or you can use pair of {} also. switch (var) { case value_1 : { statement_1; statement_2; statement_3…; break; } case value_2 : { statement_1; statement_2; statement_3…; break; } case value_3 : { statement_1; statement_2; statement_3…; break; } \\ we can write case according to our recquirment. } Odd-even program using ternary-operator #include<stdio.h> void main() { int number; printf(“Enter Your Number :”); scanf(“%d”,&number); number%2==0 ? printf(“Enterd number is EVEN”) : printf(“Enterd number is ODD”); } // now you know how to use ternary-operator so build some more program on it at home. // PASTE THE OUTPUT IN COMMENT BOX. Ternary-operator in C I will remamber you about ternary operator or conditional operator. I keept it to disscus latter while we learning operator it’s right time to learn it. Well now we all have a good knowledge of If-Else, statement now you can easely learn ternary operator (conditional operator). syntex : condiction ? expression_1 : expression_2 ; It check the condiction and if it is true then expression_1 will run and if condiction will not true then expression_2 will run. Calculating your telephone bill /* NOTE :- If we want to make a few line as comment then we can write those statemennts within /* this pair of combinaction of . */ /* calls <= 100 charges 2/- per call calls <= 300 charges 3.5/- per call calls <= 500 charges 4.5/- per call calls > 500 charges 5/- per call */ #include<stdio.h> void main() { int calls; float amount; printf(“Enter Number of calls :”); scanf(“%d”,&calls); printf(“Number of calls is %d and \nyou have to pay “,calls); if ( calls <= 100 ) amount = calls*2; else if ( calls <= 300 ) { amount = 100*2; calls = calls-100; amount = amount + calls*3.5; // or amount = 100*2 + (call-100)*2; } else if ( calls <= 500 ) { amount = 100*2; amount = amount + 200*3.5; calls = calls-300; amount = amount + calls*4.5; // or amount = 100*2 + 200*2 + (calls-300)*4.5; } else if ( calls > 500 ) // or else { amount = 100*2; amount = amount + 200*3.5; amount = amount + 200*4.5; calls = calls-500; amount = amount + calls*5; // or amount = 100*2 + 200*3.5 + 200*4.5 + (calls-500)*5; } printf(” %.2f Rs.”,amount); } /* OUTPUT 1. Enter Number of calls :100 Number of calls is 100 and you have to pay 200.00 Rs. 2. Enter Number of calls :2345 Number of calls is 2345 and you have to pay 11025.00 Rs. */ SO WE ARE ENDING NESTING IF-ELSE HERE YOU CAN PRECTICE MORE QUECTION ON IT AT HOME. Calculator using if-else // We are going to code a calculater in our this program. // let’s start. #include<stdio.h> #include<stdlib.h> // We are goint to use exit function in this code so we // connect this library. void main() { double number_1,number_2,result; char operaction; printf(“Enter your Both Number : “); scanf(“%lf%lf”,&number_1,&number_2); fflush(stdin); // this is use for flushing enter you pressed. affter // entering number if we not use fflush then \n // will store in operator and we got wrong result. // It also comes in stdio.h library of C. printf(“Please select a operaction from the given list :\n”); printf(” + for addiction \n”); printf(” * for multiply \n”); printf(” – for subtruction \n”); printf(” / for devide \n”); printf(” %% for remander \n”);// here we use %% because it display % // on output. scanf(“%c”,&operaction); if ( operaction == ‘+’ ) // or if ( operaction == 43 ) ASCII value of + result = number_1+number_2; else if ( operaction == ‘-‘ ) // or if ( operaction == 45 ) ASCII value of – result = number_1-number_2; else if ( operaction == ‘*’ ) // or if ( operaction == 42 ) ASCII value of * result = number_1*number_2; else if ( operaction == ‘/’ ) // or if ( operaction == 47 ) ASCII value of / result = number_1/number_2; else if ( operaction == ‘%’ ) // or if ( operaction == 37 ) ASCII value of % result = (int)number_1%(int)number_2; else { printf(” INVALID OPERATOR “); exit(1);//It is a jump statement who close the program // we will discus about it later and we can // It use stdlib.h library of C. // write any number in ().There is no compulsion // to write 1 in it. } printf(“\n\n\n Your result is %.2lf.\n\n\n\n”,result); } NOW PASTE THE OUTPUT IN COMMENT BOX. August 27, 2017 Kshithij Iyer "86C019BD75E878270F75B8AF41523E1EE789128AA9B188E3F819B3A4AD5011E5 This is how complicated LOVE can..." 86C019BD75E878270F75B8AF41523E1EE789128AA9B188E3F819B3A4AD5011E5 This is how complicated LOVE can become. - kshithij Iyer Robin Schubert My children and feelings I wanted to write this down for many years now. It is about an amazing and overwhelming feeling, but with a frightening and sad taste. I still feel it now, after more than 4 years, like the way I felt it back then. It first appeared when I had a look at my new born oldest son for the very first time. A child in time I am incredibly lucky to have three healthy beautiful wonderful children, all of which gave me that feeling and still do. They were born as perfect little beings. Flawless, without any scratches or scars, just complete and pure. Unnecessary to mention, I was happy and proud as can be, but one thing I knew from the start: From now on I would have to sit powerless and watch how time passes by my children and how scratches, scars breaches and whatsoever would be added to their perfect skins and bodies. Together with my children a fear was born that I know I will carry for the rest of my life; Sure, I will put anything into protecting my children from any harm as good as I can. I don’t have the illusion though, that I can protect them from all harm. This will become a constant struggle with my children and my fears, which they will not be able to understand until they have children themselves. Furthermore I realized that it’s not only their bodies; They were born with a clean and pure mind and soul as well; both awaits a similar path. The tremendous task to protect three little bodies minds and souls from getting wounded, scarred or worse lies now upon me. A word on time healing wounds That’s what they say. However, I don’t think that time actually heals wounds, neither physical nor mental or emotional. I imagine a soul as a beautiful landscape. Life with its ups and downs will add valleys and mountains to it, forming a unique personality. However, deep wounds will cut deep craters and gorges, or just burn things down. We can try to build bridges over crates and gorges and patch things. We can try to grow new things on the ashes and with time the tracks of wounds will become weaker. It will nevertheless not heal fully. You will see evidence of all these wounds if you took a cross-sectional view of a density distribution – a quake may tear open old wounds easily anytime. Finally This has been on my mind for quite some time now. When re-reading, it sounds pretty cheerless to me. But that’s not true; living means using the body, mind and soul. Life will inevitably leave its on them. This is what life is bears by default. I want my children to live, so that’s okay. They still are and always will be the most beautiful things I’ve ever seen and ever made myself, and they make me happier as anything else could do. Vivek Anand Using Celery with Rabbitmq Rabbitmq is a message broker and celery is a task queue. When you run a celery app, by default, it will open as many processes as there are cores of cpu on the machine. These processes are workers. When you have a task which needs to be done outside of a normal HTTP request-response cycle, you can use a task queue. Rabbitmq can be configured to decide (and deliver) which worker the task has to go and celery will help in the actual execution of the tasks. Celery supports a lot of message brokers but, Rabbitmq is the default one. So, setting up celery for using with rabbitmq doesn’t require any effort. If you have rabbitmq already installed then all you need to do is create a rabbitmq user, a virtual host and give the user access to the virtual host. It is given in the celery documentation here. Then you need to specify the broker url in this format in the celery app. broker_url = 'amqp://myuser:mypassword@localhost:5672/myvhost' The default exchange that celery listens to is named ‘celery‘ and routing key is also ‘celery‘. The ‘celery‘ exchange is direct type exchange. AMQP is the protocol that rabbitmq follows. Username, password and virtual host here is of rabbitmq that you want celery to use. Based on the given broker url, celery attempts to know which message broker is being used. August 26, 2017 Kshithij Iyer Twist to forget You know sometimes my soul feels trapped as if it was trapped between 2 wheels and an engine as if it was trapped between the halogen front light and the rear LEDs. It’s really difficult to make your parents and family understand that I work so hard to afford the fuel to ride to unseen places and uncharted roads. How am I suppose to make them understand that there is a thrill in going out at night? How do I explain to them that the thrill is what is missing in an IT job? And that the experience of riding long distance makes my head clear. It helps me deal with all the stress which I face in life. I understand that it takes a lot of effort to raise a boy and a lot more to raise a boy like me but sometimes you should just trust his instinct as well. Sometimes you should allow him to take the risks which he wants to take in life. I sometimes have no idea how to explain to my Mom that driving long distance is helping me in the long run and it’s not something which is meant to increase her blood pressure. It’s just that sometimes friends, partying, watching a movie or playing video games doesn’t help, sometimes you have to twist to forget. I hope that my family doesn’t jump around seeing this post, I am just writing to get it all of my head. Love now and always, Kshithij Vipul Gupta The Guide to filling the perfect OD form ft. Amity University This post is exclusively for Amity University students. And could be described as one of the most important things in their lives after of course maintaining 75% attendance and their grade points. Official duty (OD) forms are defined as those A4 sheets of paper that students in Amity University fill to get their attendance marked in classes they missed while they are performing official duties or volunteering in events etc. But some enlightened individuals, don’t know how to fill them. And this results in their attendance getting marked absent and their reactions being ‘Something Just Like This’. The pain, the horror of getting marked absent. Here’s a guide as to how to fill the perfect OD form so that your attendance can be marked easily, correctly and on time. Along with helping your seniors and teachers that they don’t have harrowing time locating the details you deliberately missed. You sold. Let’s get started. Get an OD form quick. 1. Name of the Institution – You study under an institution. Everyone does. The question is why are you so ashamed that you forget to write it. Example – I study in Amity School of Engineering and Technology so I write ASET. 2. (No. of students) Fill in the blanks are meant to be filled and not left empty. So if 3 guys will write their names in the OD form, then write a clear 3 in that blank. 3. Name of Activity – Pretty basic. Just write the task or event that you were so busy in or whatever the faculty/senior tells you to fill here. 4. Date of Activity – Check your fancy smartphone and put a date there in a clear format. Example – 23/08/17 (dd/mm/yy) or 23 August 2017. This date is the date on which the activity took place. 5. Time of Activity & Duration – Usually duration is not that big of a deal. But do fill the starting (From) and ending time of the event Usually, people get this right or ask other people to help them out. But nevertheless, the worse part is still to come. The details table. So the table will have 6 columns namely S.No, Student Name, Enroll No., Program, Courses which will be missed, Role and Responsibilities assigned. We will be going from left to right filling the first empty row in the table. 1. Serial Number Count if the numbers are right or wrong. They are right. Ok, cool. 2. Name You got a name, right ?. Then fill your name without any designation of Mr. /Mrs. Writing should be clear. Fill in capital letters if you feel like it. 3. Program Write the course/program you are enrolled under. I am pursuing B.Tech Computer Science. So I write only B.Tech. That’s not it. You have to mention the class/section you are studying in. So I am in my 3rd semester studying in CSE under the section 6 batch Y so you write – B.Tech 3CSE6Y 4. Courses which will be missed [Most important part] This section denotes the class you have missed while performing your official duty. So let’s take examples of classes I missed and how to fill them out. 1.1 FBL (Foreign Business Language) – These subjects are the most problematic. If your attendance gets stuck, then these are the troublemakers at play. Example – I take German classes from X pm to Y pm under ABC ( ABC is the full name of the teacher, that teaches me German, check Amizone if you don’t know the name) . So I write – FBL German (ABC) [X pm – Y pm].1.2 Other subjects – Goes pretty much the same. Just without the name of the Professor teaching you. So let’s have some more examples. For the sake of simplicity. Time would be X pm to Y pm or A pm to B pm. Engineering Mechanics [X pm – Y pm] Applied Physics – I [X pm – Y pm] Physics lab [X pm – Y pm][A pm – B pm] Applied Mathematics – I * 2 [X pm – Y pm] [A pm – B pm] English [Xpm – Ypm] You get the point, right ?. Write in this format and never miss out on anything. Write clearly and try to write in the width of the box only. If you make a mistake then it is always advisable to start out afresh. There are no hard n fast rules here. But these here are the best format possible. * 2 – if there are 2 theory classes on a single day in the time period you are requesting your OD. 5. Role and Responsibilities assigned – This column specifies what you did in the event. There are mostly 2 choices. Either Participant/attendee or Volunteer. Take your pick, no one cares about it. FYI this is how it looks. 1. Under the table there is a date blank. Fill that too with the date on which you are submitting the OD form. Not to be confused with the date on which the activity took place, that’s different. SO there it is, the perfect OD form completed under 5 minutes. Submit that baby to the person who is collecting them and home run !! Also get your form cross-checked one more time by yourself and by someone else. Just to be on the safer side. A little side note: it is highly recommended to fill OD forms with the people of the same class and same program. It is much easier for the person who is marking the attendance. Also if you guys, are all missing out the same classes then draw a big curly bracket or use double quotes in the columns under courses you missed to denote that all the students mentioned here have missed the same classes and to be marked present for it. It is recommended to fill and submit your OD forms on the same day itself or the next day of the event as the attendance gets blocked within 2 days. Just give it ASAP. It is a no brainer. Once in a blue moon, if even after filling your OD form, your attendance is not marked. Then it is hard to say this, but learn to let go. Don’t cry over it. If you are not getting disbarred, and tried all possible ways. Then it better to move on and make sure it doesn’t happen to you next time Ending credits – Some people might think what’s the need for this. Everyone would learn eventually. True, but instead of learning things simply by trial and error. If we could tell someone exactly what to do. Then the confusion and problems would get solved much faster. Comment any doubts you have and keep filling those forms. This post is completely free to copy, share and repost anywhere on any social media platform. I just want people to benefit from this. Send it anywhere, everywhere you like. There are no affliations or benefits involed from this. Made in the spirit of truly being opensource and transparent. Vipin kumar A C program to Check larger number from 3 numbers // One more thing if you use (//) than everything written become a comment // that will not execute. #include<stdio.h> void main() { int number_1,number_2,number_3; printf(“Enter 3 number : \n”); scanf(“%d%d%d”,&number_1,&number_2,&number_3); // We have taken input. if( number_1 >= number_2 ) // We have check from number_1 and number_2 which is large. // if number_1 is large than if will run. { if( number_1 >= number_3 ) printf(” The large number is %d.”,number_1); else printf(” The large number is %d.”,number_3); } // We have checked number_2 which is larger than number_1 so. else { if( number_2 >= number_3 ) printf(” The large number is %d.”,number_2); else printf(” The large number is %d.”,number_3); } } or #include<stdio.h> void main() { int number_1,number_2,number_3; printf(“Enter 3 number : \n”); scanf(“%d%d%d”,&number_1,&number_2,&number_3); // We have taken input. if( number_1 >= number_2 && number_1 >= number_3 ) printf(” The large number is %d.”,number_1); if( number_2 >= number_1 && number_2 >= number_3 ) printf(” The large number is %d.”,number_2); if( number_3 >= number_1 && number_3 >= number_2 ) printf(” The large number is %d.”,number_3); } Output 1. Enter 3 number : 12 15 46 The large number is 46. 2. Enter 3 number : 34 56 32 The large number is 56. 3. Enter 3 number : 78 65 12 The large number is 78. Nesting IF-ELSE OK i think now you all has a great knowledge of IF-ELSE so let us start our next topic : NESTING OF IF-ELSE –> While we use IF-ELSE inside IF-ELSE this kind of condiction’s called Nesting IF-ELSE. let us understand with help of some example. if (condiction) { statements….; if(condiction) { } } else { statements….; if(condiction) { } } or if (condiction) { statements….; } else if (condiction) { statements….; } else if (condiction) { } else { } NOTE :– If you enable to understand them than no need to worry you can easely learn with help of some quection. in above examples you can see we use IF inside IF. this is called Nesting Of IF-ELSE. Now It’s time for some Examples. August 25, 2017 Vipin kumar Program to check a character is Alphabet or Not #include<stdio.h> void main() { char character; printf(“Enter a character:”); scanf(“%c”,&character); if( character >= 65 && character <= 90 || character >= 97 && character <= 122 ) printf(“Yes Enterd chracter is an Alphabet .”); else printf(“No Enterd chracter is an Alphabet .”); } OUTPUT : 1. Enter a character:5 No Enterd character is an Alphabet . 2. Enter a character:d Yes Enterd character is an Alphabet . 3. Enter a character:Z Yes Enterd character is an Alphabet . As you can saw we use AND and OR operator and perform a lotes of operaction. A program to check a alphabet is vowel or not #include<stdio.h> void main() { char alpha; printf(“Enter a Alphabet:”); scanf(“%c”,&alpha); if( alpha == ‘a’ ||alpha == ‘e’ ||alpha == ‘i’ ||alpha == ‘o’ ||alpha == ‘u’ ) printf(“Yes Enterd Alphabet is an vowel .”); else printf(“No Enterd Alphabet is Not an vowel .”); } OUTPUT : 1. Enter a Alphabet:u Yes Enterd Alphabet is an vowel . 2. Enter a Alphabet:d No Enterd Alphabet is Not an vowel . A C programme to check leap year #include<stdio.h> void main() { int Year; printf(“Enter a Year :\n”); scanf(“%d”,&Year); if ( Year%4==0 && Year%100 != 0 || Year%400==0) printf(“yes it is leap Year.”); else printf(“No it is Not an leap Year.”); } OUTPUT : 1. Enter a Year : 2004 yes it is leap Year. 2. Enter a Year : 1700 No it is Not an leap Year. if you dont know what is a leap year thanclick here Shivam Singhal Moz Add-Ons Day So this was the event for i was working for around 2 weeks before the date of event. As a organiser it was my second event , other was Mozilla NIEC Activate. This time i was making this free workshop more bigger and useful. We were making arrangements for around 100+ attendees so there was a lot of stuff had to manage like refreshments for all, event poster , and main work was to make announcements in every class in our college especially in first year students classrooms so that to involve more students from freshman years. So there was all set and on D-Day 19th of August , I landed in Delhi around 6 AM on 19th , i was so tired. After came to Delhi i went home and grabbed the standy of Mozilla , and then went to college for all setup.As there was a huge response from interested students, we have more than 270 registration, but in last i sent 130 invitations based on their Javascript Expertise and also the strength of Auditorium is for 130 peoples only . So i reached college around 9.30 AM, Pushpita , the mentor of this event was waiting on main gate of college . So the attendees started to come to college and so till 10:30 AM we have 60+ attendees in the auditorium so we started the event with what is Mozilla and then we had a little session on Javascript till 12 AM, till now almost 100 students in Auditorium then Trishul ( Mozilla Add-Ons Developer ) introduced all of us about “Mozilla Add-Ons” and how to develop those. Then around 1 PM we had a little break for snacks which i ordered already and reached college on time :P. After that the core development of Add-ons started. So Trishul started event with a simple add-on which will just adds a color border to any pages loaded from “mozilla.org” or any of its subdomains. So i am trying here to explain how we can make this extension I hope all of you will understand it :). So first there is a simple manifest.json file under any new directory you make ,lets for example borderify. { "manifest_version": 2, "name": "Borderify", "version": "1.0", "description": "Adds a red border to all webpages matching mozilla.org.", "icons": { "48": "icons/border-48.png" }, "content_scripts": [ { "matches": ["*://*.mozilla.org/*"], "js": ["borderify.js"] } ] } Here the first three keys: manifest_versionname, and version, are mandatory and contain basic metadata for the extension.description is optional, but recommended: it’s displayed in the Add-ons Manager.icons is optional, but recommended: it allows you to specify an icon for the extension, that will be shown in the Add-ons Manager. The most interesting key here is content_scripts, which tells Firefox to load a script into Web pages whose URL matches a specific pattern. In this case, we’re asking Firefox to load a script called “borderify.js” into all HTTP or HTTPS pages served from “mozilla.org” or any of its subdomains. If you do need to specify an add-on ID, include the applications key in manifest.json and set its id property. "applications": { "gecko": { "id": "borderify@example.com" } } Create the “icons” directory directly under the “borderify” directory. Save an icon there named “border-48.png”. As our manifest.json promised that we would have an icon at “icons/border-48.png”. Finally, create a file called “borderify.js” directly under the “borderify” directory. Give it this content: document.body.style.border = "5px solid red"; So finally we finished our code then we have to add this add-ons to our Firefox Browser. You can do that simply by watching this video :). I hope you understood this code. Here some of the images of the event :). And the image after the event. You can find me easily sat down most left with weedy eyes as did not sleep from 3 days and travelled more than 800 kms in last 3 days. Thanks for reading. Cheers Samridhi Agarwal Euler Prolem no. 2 I solved the second question from the euler’s problem set with python first then i tried to do the same with c++ and I realized that it just does the same thing and same logic to be applied just increasing number of lines to code in C++. Problem Statement – By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. So I will start with how I first thought of writing a precise and simple code. As the last digit in the Fibonacci series is the sum of all the prior numbers so if we minus all the odd values from last digit that is 4 million, we will get sum of all even numbers. But i went with searching for all the even numbers one by one till 4 million and adding them. Python Code -> sum = 0 # Assign variable sum as 0 a, b = 0, 1 # Taking a and b as values in Fibonacci series while b < 4000000: # Last value should be 4 million if b % 2 == 0: # Checking if even sum += b # Adding up all even values a, b = b, a + b # swapping first value with second print(sum) # print the sum  Output ->  4613732  C++ Code -> #include using namespace std; int main() { int sum = 0; //3 variables to create the Fibonacci sequence from 0 to 4000000 int a = 0; int b = 1; int c = 0; while (b <= 4000000) { c = a + b; if (b % 2 == 0) //check for even number total += b; a = b; b = c; } cout << sum <<endl; return 0; } Output ->  4613732  Practicing more Euler’s problem. August 24, 2017 Vipin kumar Program to check Alphabat is of upper case #include<stdio.h> void main() { char alfa; printf(“Enter a Alphabets:”); scanf(“%c”,&alfa); if( alfa >= 65 && alfa <= 90) printf(“Yes the alphabet is of upper case”); else printf(“No the alphabet is of upper case”); } OUTPUT : 1. Enter a Alphabets:A Yes the alphabet is of upper case 2. Enter a Alphabets:a No the alphabet is of upper case Program to check Alphabat is of lower case. #include<stdio.h> void main() { char alfa; printf(“Enter a Alphabet :”); scanf(“%c”,&alfa); if( alfa >= 97 && alfa <= 122) printf(“Yes the alphabet is of lower case”); else printf(“No the alphabet is of lower case”); } OUTPUT : 1. Enter a Alphabets:a Yes the alphabet is of lower case 2. Enter a Alphabets:A No the alphabet is of lower case Here 97 is ASCII value of ‘a’ and 122 is ASCII value of ‘z’ hence the number between these two value is a lower case. Program on ASCII #include<stdio.h> void main() { char test; printf(“Enter a character :”); scanf(“%c”,&test); printf(“The ASCII value of %c is = %d :”,test,test); } OUTPUT : 1. Enter a character The ASCII value of x is = 120 : 2. Enter a character :% The ASCII value of % is = 37 : In this code we take a char and print that using %d, it will not change value of test. ASCII and it’s Importence ASCII ( American Standard Code for Information Interchange) —-> is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Most modern character-encoding schemes are based on ASCII, although they support many additional characters. IN C all character has a spacific ASCII value, alphabets also has a spacific value. given below, ASCII value of character’s are given below. Dec Char —- —– 0 NUL (null) 1 SOH (start of heading) 2 STX (start of text) 3 ETX (end of text) 4 EOT (end of transmission) 5 ENQ (enquiry) 6 ACK (acknowledge) 7 BEL (bell) 8 BS (backspace) 9 TAB (horizontal tab) 10 LF (NL line feed, new line) 11 VT (vertical tab) 12 FF (NP form feed, new page) 13 CR (carriage return) 14 SO (shift out) 15 SI (shift in) 16 DLE (data link escape) 17 DC1 (device control 1) 18 DC2 (device control 2) 19 DC3 (device control 3) 20 DC4 (device control 4) 21 NAK (negative acknowledge) 22 SYN (synchronous idle) 23 ETB (end of trans. block) 24 CAN (cancel) 25 EM (end of medium) 26 SUB (substitute) 27 ESC (escape) 28 FS (file separator) 29 GS (group separator) 30 RS (record separator) 31 US (unit separator) 32 SPACE 64 @ 96  33 ! 34 ” 35 # 36$
37 %
38 &
39 ‘
40 (
41 )
42 *
43 +
44 ,
45 –
46 .
47 /
48 0
49 1
50 2
51 3
52 4
53 5
54 6
55 7
56 8
57 9
58 :
59 ;
60 <
61 =
62 >
63 ?
64 @
65 A
66 B
67 C
68 D
69 E
70 F
71 G
72 H
73 I
74 J
75 K
76 L
77 M
78 N
79 O
80 P
81 Q
82 R
83 S
84 T
85 U
86 V
87 W
88 X
89 Y
90 Z
91 [
92 \
93 ]
94 ^
95 _
96
97 a
98 b
99 c
100 d
101 e
102 f
103 g
104 h
105 i
106 j
107 k
108 l
109 m
110 n
111 o
112 p
113 q
114 r
115 s
116 t
117 u
118 v
119 w
120 x
121 y
122 z
123 {
124 |
125 }
126 ~
127 DEL

NOTE :- You no need to learn these.

using these value we can use any character.

we will learn those in our programe.

The Django Girls

Recently, I have started getting my hands dirty in dynamic web development. I first used it in my sentence as a swag factor but never gave a deep thought in what can be dynamic in my website until my mentor literally asked me what are you going to make dynamic in the website. Truely speaking i was a bit nervous and felt a dumbstruck sort of emotion , but that didnt last long. I started googling about it and stumbled into a website known as The Django Girls. Hahahahah!! Dont go by the name or you gonna be a sexist , but the content is awesome and much more interactive than the documentation of django developers.

I started earnestly following it step by steps, the more i started following it the more i got addicted to it and by the next day within 4 a.m. I was able to develop my first dynamic webapp in Django.

First of all i would like to mention what is django!!! Any guesses?? Well , its a framework of python made to easy the job of web developers because it comes with many inbuilt features like admin,sessions,messages,database,authentication,etc. Well i havent dived into all of those deeply but planning to do it soon. It also comes with its server so that we can check our results using it.

What i made is a very very simple blog webApp in which one can add posts as many as they can and they may publish it. As soon as they publish it the html code for the new post will be automatically generated. I also added the feature to edit even after you have published it.

One cant edit your posts so i have authenticated it. And more over even someone gets access to your system still he/she will not be able to edit or add new posts untill the admin is logged in.So its very secure as a Note book.

This is my first work in this type of web development and as you know first works are very ugly but still teaches you the most out of it.

Hoping to add many more features like login, register, delete posts from the website,etc

"""
I write less blogs because i am afraid of mistakes so:---
>I will be pleased if you inform me the technical errors i have written
>feel free to contact me if you wanna contribute to my project by any means be it even a readme.txt file :) https://github.com/soumam007/my-first-blog
"""

email : soumambanerjee007@gmail.com

Vipin kumar

OR operator

#include<stdio.h>
void main()
{
int Number;

printf(“Enter a Number:”);
scanf(“%d”,&Number);

if(Number%3 == 0 || Number %6 == 0)
printf(“Enterd Number is either Multiple of 3 or 6 :”);
else
printf(“No the enterd Number is Not Multiple of 3 as well as 6 :”);

}
OUTPUT :
1.

Enter a Number:21
Enterd Number is either Multiple of 3 or 6 :

2.

Enter a Number:22
No the enterd Number is Not Multiple of 3 as well as 6 :

as you can see in this code in OUTPUT 1    21 is multiple of 3 so If will run

but in output 2   22 is nither multiple of 3 and 6 so else will run.

AND operator

OUR this program will help in understanding AND operator.

#include<stdio.h>
void main()
{
int Number;

printf(“Enter a Number:”);
scanf(“%d”,&Number);

if(Number%3 == 0 && Number %6 == 0)
printf(“Yes the enterd Number is Multiple of 3 and 6 :”);
else
printf(“No the enterd Number is Not Multiple of 3 and 6 :”);

}
OUTPUT :
1.

Enter a Number:9
No the enterd Number is Not Multiple of 3 and 6 :

2.

Enter a Number:18
Yes the enterd Number is Multiple of 3 and 6 :

as you can see if both expression are true than our condiction become true.

in output  1     9 is multiple of 3 but not of 6 so ELSE run.

but in 2           18 is multiple of 3 as well as 6 hence If run.

OR and AND operator

In our this blog we will use
1. && —-> and operator,
2. || —-> or operator,
(&&) This is called the AND operator it used between two expression,
(||) This is called the OR operator it also used between two expression.
They work according to there name .
Work of (&&) operator —>
If our both expression will true than our condition become true,
else our condition become false.
You can easely learn learn these with some example.

August 23, 2017

Vipin kumar

A program to check you pass or fail

#include<stdio.h>
void main()
{
int number_of_subject,total_mark;
double mark,Prsantag;

printf(“Enter the number of subject you have :”);
scanf(“%d”,&number_of_subject);

total_mark = 100 * number_of_subject;

printf(“Enter how much mark you got from %d:”,total_mark);
scanf(“%lf”,&mark);

Prsantag = (mark/total_mark)*100;

if(Prsantag >= 33)
printf(“Party time you have pass your exam you got %2.2lf %:”,Prsantag);
else
printf(“You have to work hard you fail in your exam you got only %2.2lf %:”,Prsantag);

}
OUTPUT :
1.

Enter the number of subject you have :5
Enter how much mark you got from 500:456
Party time you have pass your exam you got 91.20 %:

2.

Enter the number of subject you have :5
Enter how much mark you got from 500:123
You have to work hard you fail in your exam you got only 24.60 &:

In this program we use %2.2lf  this 2.2 is allow to print upto 2 digit only.

for any queary contect me at :- kumarvipinyadav369@gmail.com

Yurii Pylypchuk

Lots of Isolated Silly Parentheses

«Lots of Isolated Silly Parentheses» . There is how some people claim the  LISP is standing  for.   But LISP (LISt Processing) language has survived since 1960 and still is in use.

In his article «The roots of Lisp»(2001)  (http://www.paulgraham.com/rootsoflisp.html)  Paul Graham tell us  «In 1960, John McCarthy published a remarkable paper in which he did for programming something like what Euclid did for geometry.He showed how, given a handful of simple operators and a notation for functions, you can build a whole programming language. He called this language Lisp, for «List Processing,» because one of his key ideas was to use a simple data structure called a list for both code and data …  It’s worth understanding what McCarthy discovered, not just as a landmark in the history of computers, but as a model for what programming is tending to become in our own time. It seems to me that there have been two really clean, consistent models of programming so far: the C model and the Lisp model. These two seem points of high ground, with swampy lowlands between them. As computers have grown more powerful, the new languages being developed have been moving steadily toward the Lisp model. A popular recipe for new programming languages in the past 20 years has been to take the C model of computing and add to it, piecemeal, parts taken from the Lisp model, like runtime typing and garbage collection.»

August 22, 2017

Samridhi Agarwal

Emacs Lisp

In yesterday’s dgplug session, we were taught the Emacs Lisp programming, something very new for me which I had never done before. I liked the way the code is written because of its simplicity and normal English language but the way in which parenthesis are put is little confusing. That can be actually done by practicing writing code in Emacs Lisp. I was given a link to a video in the session by the mentor which i found really helping. I summarized all the codes with comments we learned in the session. You can have a look for them here .

After the session we also got some work to do – We have to select a problem from the Project Euler  and implement the solution in Emacs Lisp. So I selected the very first problem that is –

Find the sum of all the multiples of 3 or 5 below 1000.

I first wrote the code in python –

sum = 0                           #assigned sum variable as 0
for i in range(0, 1000):          #used range function to iterate from 0,1000 in the for loop
if(i % 3 == 0) or (i % 5 == 0):   #checked the condition
sum += i                          #if true then add with sum
print (sum)                       #print total sum

Output ->

 233168

I tried to proceed in the same way for Emacs Lisp programming and i got the output in two ways once defining a function and one without function.

1) Defining the function sum

(defun sum (list)
(apply '+ (mapcar
'(lambda (x) (if (or (eql (% x 3) 0) (eql (% x 5) 0))
x 0) )
list) ))
(sum (number-sequence 1 999) ) 

Output ->

 233168 (#o707320, #x38ed0, ? )

In the first line I defined the function sum with parameter list then I wrote a condition to check and add all the numbers satisfying the condition to give the total. To give the range I used the number-sequence function.

2) Without using function and using loop (do)

 (let ((sum 0))
(cl-loop for x from 1 to 999
do (if (or (zerop(mod x 3 )) (zerop(mod x 5 )))
(setq sum (+ x sum))))
sum)  

Output->

 233168

Used the same logic but mentioned the range in the loop which is more problem statement oriented result.

I really liked the Euler’s problem statements will try to practice more from them each day.

Himanshu Awasthi

Playfair Cipher using Python

Hello Guys ! This is Himanshu Awasthi & this time I’m going to tell you about most interesting topic of Classical Cryptography Technique named as Playfair Cipher. We learn how to  implement Playfair Cipher using Python Programming Language .

How ????????????????????????????????????????????????????????????????

So don’t we confuse I will describe Playfair Cipher before Implementing Playfair cipher using Python .

What is Playfair Cipher ?

Playfair Cipher is a Polyalphabetic Cipher . In Playfair Cipher, initially a key table is created. The key table is a 5×5 grid of alphabets that acts as the key for encrypting the plaintext. Each of the 25 alphabets must be unique and one letter of the alphabet (usually J) is omitted from the table as we need only 25 alphabets instead of 26. If the plaintext contains J, then it is replaced by I.

Playfair Cipher Invented by Charles Wheatstone in 1854, but named after his friend Baron Playfair.

Encryption & Decryption in Playfair Cipher:

• Plaintext is encrypted two letters at a time.
• If a pair is a repeated letter, insert filler like ‘X’.
• If both letters fall in the same row, replace each with the letter to its right(circularly).
• If both letters fall in the same column, replace each with the the 5. letter below it(circularly).
• Otherwise, each letter is replaced by the letter in the same row but in the column of the other letter of the pair.

Security Of Playfair Cipher:

• Equivalent to a monoalphabetic cipher with an alphabet of 26 x 26 = 676 characters.
• Security is much improved over the simple monoalphabetic cipher.
• Was widely used for many decades
eg. by US & British military in WW1 and early WW2
• Once thought to be unbreakable.
• Actually, it can be broken, because it still leaves some structure of plaintext intact.

How we implement Playfair Cipher using Python ?

You can write you own code for playfair in any language so there is a module named as pycipher which directly gives access to playfair code . So easily we can import playfair with the help of Pycipher .

lets code :

from pycipher import Playfair
Playfair(‘cdabefhgkijlmnoprqstuvzwxy’).encipher(“hello world! This is Himanshu & I’m showing the example of Playfair Cipher”)
‘IDOVNXLTRHRIKTKTGFQGSWFVGORKNXKOIQIDIEGQRJITJUMDFJEGPDFTIDTV’
Playfair(‘cdabefhgkijlmnoprqstuvzwxy’).decipher(‘IDOVNXLTRHRIKTKTGFQGSWFVGORKNXKOIQIDIEGQRJITJUMDFJEGPDFTIDTV’)
‘HELXOWORLDTHISISHIMANSHUIMSHOWINGTHEEXAMPLEOFPLACFAIRCIPHERX’

Here is the code of playfair lets check the screenshot  :

So I play with Playfair that time hope this will be informative for you guys .

So I’m going to end with this popular quote of Philip Brewer :

Security is an illusion. Freedom is real

Happy coding !

August 21, 2017

Samridhi Agarwal

This Weekend was an awesome one, I got the chance this Saturday to take a Workshop on “Python Basics 101” where I and one of my friend taught many girls Python Basics.

Before giving the session I was so tensed because First Anwesha (Organizer of Pyladies Pune) and Kushal (CPython Core Developer) were going to come as guests so that was a big support for us but because of certain health issues they were not able to come. So we were having the thought of postponing the workshop but Anwesha and Kushal gave us confidence to take the whole seminar by ourselves. That gave us a real responsibility to handle the whole session, and we were having the aim of teaching everything we know. We made the Presentation with all the content and examples the whole night and practiced once in front of our own friends a night before and then we were ready to rock the workshop.

The next day, we saw students really came to attend the workshop (we were expecting less students) So there came our responsibility to make the workshop worth. And hopefully we did that, Everyone was satisfied and we checked everyone’s coding skills by giving them questions in last 1 hour of the session and there was the aura of competition at the last( because we were having 2 chocolates by chance and we gave that who solved first). Many students came to ask more about PyLadies Pune and i was so happy to tell them as I can surely say that PyLadies totally turned me into a different person (good according to me). This opportunity taught me many things, Learn by Teaching and handle things. All Thanks to my very good step of joining PyLadies Pune Group.

You all can look at the Presentation and stuff i taught here and tell me changes so that i can learn and improve.

Vipin kumar

A program to check number is positive, nagtive or zero.

#include<stdio.h>
void main()
{
int number;

printf(“Enter a number :”);
scanf(“%d”,&number);

if(number > 0)
printf(“\n The given number is Postive. \n”);

if(number < 0)
printf(“\n The given number is Pagtive. \n”);

if(number == 0)
printf(“\n The given number is Zero. \n”);

}
OUTPUT :
1.

Enter a number :4

The given number is Postive.

2.

Enter a number :-98

The given number is Nagtive.

3.

Enter a number :0

The given number is Zero.

August 20, 2017

Kshithij Iyer

Abhi tho mocktail mai be coffee chaya mujha! #mazagran #coffee...

Abhi tho mocktail mai be coffee chaya mujha!
#mazagran #coffee (at Pune, Maharashtra)

"Sorry folks you can’t strong-arm me! I am one of those men who live on the terms it’s my..."

“Sorry folks you can’t strong-arm me! I am one of those men who live on the terms it’s my way or no way.”

- Kshithij Iyer

August 17, 2017

Aniket uttam

Working with Vim Editor

Vim editor was develop for the writing of programmers of Linux and Unix users. It was  develop in 1991 by Bram Moolenaar based on the source code of Stevie editor. The vim editor was develop for both the Command Line Mode and Graphical User Interface mode. It was full open source software which was run in public charity funds.It was widely used by the Linux users in the world.

Vim editor was start for beginners it was already install in Linux OS . It was platform independent, it works in  different platform of open source now a days. It’s  customization start by the users of Perl ,Python, Racket, Ruby and  other users. After that it was using deferent plugins was merge in it. Which provides different users to use it very efficiently. Vim editor was very use full  for writing the scripting languages on it. Vim script also supports more advanced data types such as lists and dictionaries and (a simple form of) object-oriented programming. In it built in function like map() and filter() which allows for functional programming.

Vim script files are stored in plain text format and the file name extension is .vim. There are libraries for Vim script available on http://www.vim.org/ as Vim plugins.

Example

" This is a simple while loop in Vim script.
let i = 1
while i < 10
echo "count is" i
let i += 1
endwhile


Vim was available for all type of platform like UNIX operating system and also for all the DOS, windows starting form windows 95 , openVMS, Linux, and Mac OS etc. Now a days it was also developed for the Android and iOS system also support it.

August 16, 2017

Vivek Anand

Using Syntastic for Python development

I use Synstastic plugin of vim for syntax checking in vim. Syntastic offers syntax checking for a LOT of languages. But, there is a problem that i had been facing with it. For a file with larger than 4k lines, it takes a lot of time to check the syntax and it used to happen every time you save the file. Syntax checking on write operation is the default behavior.

So, i did some changes in my .vimrc so that i could still use Syntastic for larger files. Do note that syntastic checking still takes a long time but, i have configured it to be called whenever i want to rather than on every write operation or opening of file.

” show list of errors and warnings on the current file
” Whether to perform syntastic checking on opening of file
” This made it very slow on open, so don’t
let g:syntastic_check_on_open = 0
” Don’t check every time i save the file
” I will call you when i need you
let g:syntastic_check_on_wq = 0
” By default, keep syntastic in passive mode
let g:syntastic_mode_map = { ‘mode’: ‘passive’ }
” Use :Sc to perform syntastic check
:command Sc :SyntasticCheck
” Check pylint for python
let g:syntastic_python_checkers = [‘pylint’]
” For jsx – React and React native
let g:syntastic_javascript_checkers = [‘eslint’]

This change made opening of a larger python file ~25s (yes, seconds) faster. It still takes a lot of time for syntax checking though. I will have to find out why and if i could do anything about it. I don’t want to leave out this plugin because it offers so much. I could simply use Python-mode for python syntax checking but, what about the rest of the languages which i am going to use.

August 15, 2017

Kshitij Kumar

Python’s SymPy module is really cool

So I was just browsing some code, and I came across a cool module I’d never seen before: SymPy

Basically, SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS).

What is symbolic mathematics?

Symbolic computation deals with the computation of mathematical objects symbolically. This means that the mathematical objects are represented exactly, not approximately, and mathematical expressions with unevaluated variables are left in symbolic form. Symbolic computation is handling non-numerical values, this means symbols like in algebra. Variables are defined as

In simple word, “Variables are defined as Symbols in Symbolic Computation instead of defining variables as numerical values ”

This will be more clear from an example from SymPy official documentation.

Let us define a symbolic expression, representing the mathematical expression x+2xy+2y.

>>> from sympy import symbols
>>> x, y = symbols('x y')
>>> expr = x + 2*y
>>> expr
x + 2*y


Instead of evaluating to something by convention, the expression remains as just, x+2*y

>>> x*expr
x*(x + 2*y)

Here, we might have expected x(x+2y) to transform into x^2+2xy, but instead, we see that the expression was left alone. This is a common theme in SymPy.

The Power of Symbolic Computation

The real power of a symbolic computation system such as SymPy is the ability to do all sorts of computations symbolically.

SymPy can simplify expressions, compute derivatives, integrals, and limits, solve equations, work with matrices, and much, much more, and do it all symbolically. It includes modules for plotting, printing (like 2D pretty printed output of math formulas,), code generation, physics, statistics, combinatorics, number theory, geometry, logic, and more.

Examples from official SymPy tutorial

Solve x^2 – 2 = 0

>>> solve(x**2 - 2, x)
[-√2, √2
Compute  sin(x2)d
>>> integrate(sin(x**2), (x, -oo, oo))
√2⋅√π
─────
2

Installation

To install SymPy run:

sudo pip install SymPy

conda update sympy

After installation, it is best to verify that your freshly-installed SymPy works. To do this, start up Python and import the SymPy libraries:

\$ python
>>> from sympy import *

From here, execute some simple SymPy statements like the ones below:

>>> x = Symbol('x')
>>> limit(sin(x)/x, x, 0)
1
>>> integrate(1/x, x)
log(x)
I am looking forward to using this library for mathematical computation for my IoT projects.

Currently, I am going through the tutorial and documentation to get familiar with using the software.

References:

Github: Introduction to contribution

Documentation: http://docs.sympy.org/

Vipin kumar

A program to check you can Vote or not

#include<stdio.h>
void main()
{
double age;

printf(“Enter your age \n\n\t (ex: 18 or 17.9 or 45):”);
scanf(“%lf”,&age);

if(age >= 18)
printf(“\n yes you can Vote \n”);
else
printf(“\n sorry you can’t vote \n”);
}
OUTPUT :
1.

(ex: 18 or 29 or 45):19

yes you can Vote

2.

(ex: 18 or 29 or 45):17

sorry you can’t vote

Samridhi Agarwal

Working on Python Dictionaries

As dictionary can store many key-value pairs in fact it can store millions of items. So to handle or work with all those items python lets us loop through the dictionary. There exists many ways to loop through all dictionary items by using the keys or the value

1) Looping in Dictionary through all items One of the simplest way (at least for me) is using a for loop. So before working with the key-value pairs let us make a dictionary to store the information of a student.

student_1 = {'name' : 'Samridhi' , 'nationality' : 'Indian' , 'Stream' : 'Electronics and Telecommunication' , 'age' : '19'}

Use of for Loop – To get a single item of a dictionary we can simply use the key value but to print the whole dictionary we use the for loop. We select the two variables names to hold the key and value of each item in dictionary. We can choose any name or any character as variable. The for loop stores each item in those variables. The method items() is used to return the list of items.

Example – To print the information of student_1 in an organized way.

for key, value in student_1.items():
print("\nKey: " + key)
print("Value: " + value)

Output ->

Key: age
Value: 19

Key: Stream
Value: Electronics and Telecommunication

Key: nationality
Value: Indian

key: name
value: Samridhi

This type of looping works well with millions of data and it also helps to see for choices of many people when the value remains same for many but key (name of a person) keeps on changing.

This way does not give all the key-value pairs in the same order as entered because looping does not take of that. So the items we get are in a unpredictable order. If you want a sorted dictionary to get the name of millions of students in an order makes it more readable so a sorted() function can be used with the for loop.

2) Looping in Dictionary through keys – The method keys() of using the keys of any item is used when you don’t have to work with all the values in the dictionary. Like if you just want to know the name of students participated in a certain competition and don’t want to know in which game they are participating we can just get the keys of dictionary (names of students).
Example: In a college fest there are 3 sports category but we want only those students who participate in any sport.

College_fest = {
'vikky': 'cricket',
'rachi': 'football',
}

for name in College_fest.keys():
print(name.title())

Output ->

Sam
Vikky
Rachi
Yashu

Looping in dictionary through keys() method is default behavior for looping in dictionary so for name in College_fest: is same as for name in College_fest.keys():

We can use the key() method to work with items explicitly and this can also be used in many ways like i want to check if a certain person is coming to an event or not.
Example – Check the list of students if Rashmi is present if not call her to play any game.

if 'rashmi' not in College_fest.keys() :
print("Rashmi come to register your name for college fest!")

Output ->

Rashmi come to register your name for college fest!

3) Looping in Dictionary through Values – In the previous method we were more concerned with keys but here our main focus is on the values. The values() method is used to get the values stored in the dictionary. Like if you only want to know the name of sports that are in the college fest.
Example –  Get the name of all the games in the College_fest.

print("These are the games in the college fest -")
for game in College_fest.values():
print(game.title())

Output ->

These are the games in the college fest -
Cricket
Football
Basketball

But here the game basketball repeats itself  This method results in a repetitive list of values. This can be used in some other examples where you would require all the values but here we want a list without repetitions. In this case set comes to rescue. A set only stores unique values. When a list is wrapped around a set python identifies all the unique items and displays them as a set of unique items.
Example – To display a set of games in the college fest.

print("These are the games in the college fest -")
for game in set(College_fest.values()):
print(game.title())

Output ->

These are the games in the college fest -
Cricket
Football

So here is the list of games in the college fest.

Next time i will be writing on nesting in dictionary.
Till then Happy Looping Dictionary!

Jason Braganza

Book Review – i want 2 do project. tell me wat 2 do

TL;DR? It’s awesome. Buy it right now.

I was looking to dip my toes into some sort of structured help with the summer training and open source in general, because while I knew what I wanted, I just didn’t know how to go about it.

And then I realised that one of our mentors had actually gone and written a whole book on the how to.
So, I bought the paperback.
The binding is really good, the paper really nice (unlike other tech books I’ve read) and the words large enough to read.
I expect to get a lot of use, out of the book.

And lot of use is right.
While it’s a slim volume and a pretty quick read, the book is pretty dense when it comes to the wisdom it imparts.

The book has a simple (yet substantial to execute) premise.
You’ve just tipped your toe into programming, or you’ve learnt a new language, or you’ve probably written a few programs or maybe you’re just brand new.
You want to explore the vast thrilling world that is Open Source Software.
What now?

“i want 2 do project. tell me wat 2 do.” answers the “what now” in painstaking detail.

From communication (Mailing List Guidelines) to the importance of focus (Attention to Detail) to working with mentors (the Project chapters) to the tools (Methodology & tools) to the importance of sharpening the saw (Reading …) and finally the importance of your environment (Sustenance), the book covers the entire gamut that a student or a novice programmer with open source would go through.

Shakthi writes like he speaks; pithily, concisely with the weight of his experience behind his words.

The book is chockfull of quotes (from the Lady Lovelace to Menaechmus to Taleb) that lend heft to the chapters.
The references at the end of each chapter will probably keep me busy for the next few months.

The book’ll save you enormous amounts of time and heartache, in your journey, were you to heed its advice.
It’s that good.

Book Review – i want 2 do project. tell me wat 2 do

TL;DR? It’s awesome. Buy it right now.

I was looking to dip my toes into some sort of structured help with the summer training and open source in general, because while I knew what I wanted, I just didn’t know how to go about it.

And then I realised that one of our mentors had actually gone and written a whole book on the how to.
So, I bought the paperback.
The binding is really good, the paper really nice (unlike other tech books I’ve read) and the words large enough to read.
I expect to get a lot of use, out of the book.

And lot of use is right.
While it’s a slim volume and a pretty quick read, the book is pretty dense when it comes to the wisdom it imparts.

The book has a simple (yet substantial to execute) premise.
You’ve just tipped your toe into programming, or you’ve learnt a new language, or you’ve probably written a few programs or maybe you’re just brand new.
You want to explore the vast thrilling world that is Open Source Software.
What now?

“i want 2 do project. tell me wat 2 do.” answers the “what now” in painstaking detail.

From communication (Mailing List Guidelines) to the importance of focus (Attention to Detail) to working with mentors (the Project chapters) to the tools (Methodology & tools) to the importance of sharpening the saw (Reading …) and finally the importance of your environment (Sustenance), the book covers the entire gamut that a student or a novice programmer with open source would go through.

Shakthi writes like he speaks; pithily, concisely with the weight of his experience behind his words.

The book is chockfull of quotes (from the Lady Lovelace to Menaechmus to Taleb) that lend heft to the chapters.
The references at the end of each chapter will probably keep me busy for the next few months.

The book’ll save you enormous amounts of time and heartache, in your journey, were you to heed its advice.
It’s that good.

Saptak Sengupta

APIs help us to send and receive data in some particular data format that can then be used individually or integrated with a frontend UI. In our case, the entire API server is used to manage all the requests from the frontend and send back the necessary response. Usually, the application is to send simple form data which is then stored into the backend database and a valid jsonapi response is shown. However other than normal text, url, datetime data one very important data is media files, in our case event images, user images, slides, etc. In this blog, we will particularly deal with how we can upload images in the server using API.

Sending Data

Firstly, we need to decide how do we send the data in the post request of the API. So we are sending a base64 encoded string representing the image along with the image extension appended to it, for example, data:image/png;base64,iVBORw0KGgoAAAANS. This is a widely used format for showing images over the web. So when we send a POST request we send a json encoded body like:

{    "data": "data:image/png;base64,iVBORw0KGgoAAAANS"}

Converting Base64 Data to Image

There are 2 parts of the data in the string that we receive. The first part basically tells us the format of the image(.gif in this case) and string encoding(base64 in this case), the second part gives us the encoded string. So, from the first part, we extract the file extension for the image file to be created. We use uuid.uuid4() for a random filename.
filename = '{}.{}'.format(str(uuid.uuid4()).data.split(";")[0].split("/")[1])

Now to write the base64 encoded string as an image file, we first need to get only the encoded string part from the data and then decode it. We use string decode function of python for the decoding purpose. Then we write the data to the image file and save it.
file.write(data.split(",")[1].decode("base64")

API Response

Finally using whatever logic you are using for serving your static files, you generate the static file path for the image saved. And then create another json encoded response which returns you the url for the saved image in the server.
{    "url": "https://xyz.storage.com/asd/fgh/hjk/1233456.png"}

August 14, 2017

Vipin kumar

A program to check odd and even number.

#include<stdio.h>
void main()
{
int number;

printf(“Enter a number :”);
scanf(“%d”,&number);

if ( number%2 == 0 )
printf(“\n Entered number is even \n”);
else
printf(“\n Entered number is odd  \n”);
}

NOTE :-> You can see we use (  ==  ) in if this is equal operator if we use it once (ex: number=50) it

assigned the value 50 to number but if we use (  ==  ) it compare the value of number with 50.
OUTPUT :
1.

Enter a number : 50
Entered number is even

2.

Enter a number : 5
Entered number is odd

A simple Program on if-else

#include<stdio.h>
void main()
{
int number;

printf(“Enter a number :”);
scanf(“%d”,&number);

if( number >= 50 )
printf(“\n Our number is greater than or equal to 50. \n”);
else
printf(“\n Our number is less than 50. \n”);
}
OUTPUT :
1.

Enter a number : 50
Our number is greater than or equal to 50.

2.

Enter a number : 5
Our number less than 50.

If-else statement in C.

Friends now we are Going To start If-Else.
Some time we have to make some decision in our program for those we have If statement.
If statement work in such a way

1.

if (condition)
statement;

if our condition is true then our statement will run

2.

if (condition)
statement_1;
else
statement_2;

In this case if our condition is true then our statement_1 will run and
if our condition is false then our statement_2 will run.

3.

if (condition)
{
statement_1;
statement_2;
statement_…..;
}
else
statement_n;

In this case if our condition is true then all our statements written in if
( or we can say all statement in that pair of {} ) will run .

NOTE : -> If we have more than one statement than pair of {} is necessary.

If our condition is false then our statement_n will run. which was written in
else.

3.

if (condition)
{
statement_1;
statement_2;
statement_…..;
}
else
{
statement_1;
statement_2;
statement_…..;
}
In this case if our condition is true then all our statements written in if
( or we can say all statement in that pair of {} after if ) will run .

If our condition is false then our all statements written in else will run.
which was written in else.
( or we can say all statement in that pair of {} after else ) will run .

NOTE : -> If we have more than one statement than pair of {} is necessary.

In our next Post  we will code some programe. Based on If-else statements

and do some example.

August 13, 2017

Kshithij Iyer

"People might criticize me for this but I guess the right thing to do when people around you show..."

“People might criticize me for this but I guess the right thing to do when people around you show their true but ugly faces is to move ahead and leave it all behind. To move to a different city with new faces. I guess it’s just a defense mechanism which I have developed over all these years. What can I do I can’t change the world or the people who exist in it or can I? I guess it’s time to move on and move ahead.”

- Kshithij Iyer

"Now, this is really confusing my mind says that it’s time to move somewhere else but my heart..."

“Now, this is really confusing my mind says that it’s time to move somewhere else but my heart says there is a lot left to see in Pune.”

- Kshithij Iyer

"So it’s 11 in the night seems like a good time to study let’s play some music and start..."

“So it’s 11 in the night seems like a good time to study let’s play some music and start studying. I guess Hardwell On Air would be a good option.”

- Kshithij Iyer

Himanshu Awasthi

Cool things I did with Python

Hello Friends !
I am here to represent some my cool stuffs which I had done in past using Python.
I start python with print “Hello World! This is Himanshu” Statement.
I learn some module of Python like Tkinter(“used for GUI application development”) and made a small game of TIC-TAC-TOE . I upload my code of TIC_TAC_TOE in github , People can enjoy this game by running the script click here : Tic-Tac-Toe .
Requirement :Python3 with Tkinter module

I made GUI calculator basically I take help from Google while writing script for calculator program.
Requirement :Python3 with Tkinter module

So BRB guys !

Happy Coding!

August 12, 2017

Vipin kumar

Casting in C

Let us learn what is a casting in C.

Using this feature of C we can change data type of variables.

For Example :->

#include<stdio.h>
void main()
{
int a,b;
float div;
a=20,b=3;
div=a/b;
printf(“Result Before Casting : %d\n\n”,div);
div=(float)a/b;
printf(“Result After Casting : %f\n\n”,div);
}

or

#include<stdio.h>
void main()
{
int a,b,div;
a=20,b=3;
div=a/b;
printf(“Result Before Casting : %d\n\n”,div);
div=a/(float)b;
printf(“Result After Casting : %f\n\n”,div);
}

or

#include<stdio.h>
void main()
{
int a,b;
a=20,b=3;
printf(“Result Before Casting : %d\n\n”,a/b);
printf(“Result After Casting : %f\n\n”,a/(float)b);
}

you can see in both the case we use casting to make our result correct,

In first code we make change data type of (a) from int to float.

And in second code we change data type of (b).

And in third case we change data type of both (a) and (b).

Work in Progress(Pym)

reading python for you and me , hope to summarise it more efficiently and keep using the functions …

August 11, 2017

Vipin kumar

A C program to find Simple Interest

We are going to use double Data Type in this program .

#include<stdio.h>
main()
{
double principal,rate,time,simple_interest;
printf(“Enter value of Principal : \n”);
scanf(“%lf”,&principal);

printf(“Enter value of Rate : \n”);
scanf(“%lf”,&rate);

printf(“Enter value of Time in month : \n”);
scanf(“%lf”,&time);

simple_interest = (principal*rate*time)/100;

printf(“The simple Interest is : %lf”,simple_interest);

}

or

#include<stdio.h>
void main()
{
double principal,rate,time,simple_interest;
printf(“Enter value of Principal : \n”);
scanf(“%lf”,&principal);

printf(“Enter value of Rate : \n”);
scanf(“%lf”,&rate);

printf(“Enter value of Time in month : \n”);
scanf(“%lf”,&time);

printf(“The simple Interest is : %lf”,(principal*rate*time)/100);

}

or

#include<stdio.h>
void main()
{
double principal,rate,time,simple_interest;
printf(“Enter value of Principal,Rate,and Time in month : \n”);
scanf(“%lf%lf%lf”,&principal,&rate,&time);

printf(“The simple is : %lf”,(principal*rate*time)/100);

}