Skip to main content

Posts

Showing posts from April, 2017

Lazy argument passing

passing many argument is time consuming and boring so to make it easy i created a python script  Dependencies        xdotool for sending arguments to program        zenity for dialog box generation (one of the cool program check out more in https://www.howtogeek.com/107537/how-to-make-simple-graphical-shell-scripts-with-zenity-on-linux/ ) import os import time #os . system( "zenity --title 'Lazy arguments' --entry --text 'Enter the arguments' > /tmp/lazy" ) os . system( "zenity --editable --title 'Lazy arguments' --text-info --text 'Enter the arguments' --height=500 --width=501 > /tmp/lazy" ) time . sleep(1) os . system( "xdotool type --file /tmp/lazy" ) working  pretty easy script  1. get the arguments to be passed using zenity  2. send it using xdotools

Find out Time Consumption of Process

Time consumption:                                No of times the basic block of program executed. consider writing a factorial program where to factorial of number we create something like this for(i=1;i<N;i++) fact=fact*i;//consider initial value if fact as '1' this is basic block i.e main concept of program Now how to find the time consumption of this process well,we have lot technique let's see one by one Method 1: # include < stdio.h > # include < time.h > # include < conio.h > # include < iostream.h > void main (void) { clrscr(); int sum,a,b; time_t time1,time2; double dif_sec; time (&time1); cout << "Enter the value of a :"<<endl; cin >> a; cout << "Enter the value of b :"<<endl; cin >> b; sum = a + b; time (&time2); dif_sec = difftime (time2,time1); cout << "\nThe sum is : " << sum<<endl; cout &l