Skip to main content

Posts

Most Code will now be at my GitHub - github.com/adi-g15

Friends... i didn't update this blog for a month. But actually it was the period of time, i LEARNED and DID the most. The sole purpose of this blog for me, was just to put 'Interesting Observations' i used to get during finding or solving the errors, and some just clicked to try. Now, that i have actually been trying many languages and design, so most of the new code part will be on GitHub from now on... Thanks for reading... and I WILL keep posting more inferences here (I got dozens in this month due to the projects ;D ). And special thanks to DevHack1.0 team! GitHub link -> https://github.com/AdityaGupta150
Recent posts

Using 'ls' command as a replacement of 'find'

Advantage over find - Actually not probably in terms of speed, but... only point of this is that it's an observation, but... you can do like 'search only in' */*/*Programs* , /*/*Programs*/* , this may compensate the extra time took by using two commands 1. To search in current folder only (1 level... only this folder, no subfolder)     Type... ls | grep Search_Term 2. To search in current folder only (till level 2... this folder + subfolder)     Type... ls * | grep Search_Term #ls and ls * are NOT same! 3. To search in current folder only (till level 3... this folder + subfolder + subfolder)     Type... ls */* | grep Search_Term 4. To search in current folder only (till level 4... this folder + subfolder + subfolder + subfolder)     Type... ls */*/* | grep Search_Term ... and so on... FORMULA - To search till 'n' level (considering current folder as 1)... go till (n-1) stars If wanting to search whole disk... better type stars, like this... ls * ** *** **** *****

LudO - The Game

/* Programmer - Aditya Gupta (Techy15) Language - C++ Program - LudO - The Game */ /* PLANS- Add functionality for name of player */ //IMP NOTE - See all notes, written in this form "//NOTE..." //NOTE- Mark 'R','G','B','Y' for gotis, ignore doubling for now //NOTE- Settings will have options: change default game play order(ie RBYG), change/give names to each colour //NOTE- Add code in case of attacks //NOTE- Add stops, and ways to show them distinct from others {may require graphics.h} #include<iostream> /* #include<fstream>    To be used in case save & resume to be used*/ #include<cstdio> #include<cstdlib> using namespace std; //Changes on 16th Oct //Show gotis as R1, R2... and ask user to enter string R1 or whatever // // Place within appropriate block ...     short diethrow(){     int fl=1; //holds 0 if decnum is 0     while(fl==0) { char *temp;         temp=new char; short dec

Message Scroller (Big and Styled Characters)

/*     IDEA BY OUR SIR     Programmer - Aditya Gupta (aka. Techy15)     Language - C++     NAMASTE ! */ //Known Bug : It doesn't scroll if it the length of the bigger string matches the terminal width, for a second or so /*LEARNT ThINGS :  * VIM : :%s/foo/bar/g finds and replaces ALL 'foo' with 'bar'  * A - 65  * a - 97  *Observation - Terminal in windowed mode has a heiht of 23 lines, width of 80 characters; and in full screen, has a height of 38 lines, and width of 169 characters [Useful for creating clrscr alternative with newlines] */ #include <iostream> #include <string> #include <unistd.h> #ifdef _WIN32   //Macro defined by MSVC (Microsoft Visual C++) compiler (not g++)     #include <windows.h> #elif __linux__     #include <sys/ioctl.h> #elif __MINGW32__   //MinGW (g++)     #include <windows.h> #elif __CYGWIN__    //CygWin (g++)     #include <windows.h> #endif using namespace std; /

Decimal to Binary (wo Array) - A DIFFERENT APPROACH (the way i do it)

 /* * Title - Decimal to Binary Converter - My Way  *  * Programmer - Aditya Gupta (@Techy15)  *  * */ /*The more general approach is to take remainders after dividing by 2, but this one is by comparison*/ /*Compiled with g++ on Zorin OS (Linux)*/ #include<iostream> using namespace std; long pow(int a, int power){         if(power==0) return 1;         else if(power==1) return a;         else return a*pow(a,power-1);         } int main(){         int dec,bin=0,wtemp1,wtemp2,i=0;         cin>>dec; wtemp1=wtemp2=dec;         while(wtemp1>0){                         while(wtemp1>=pow(2,i)){                                  i++;                         }                 bin+=pow(10,i-1);                 wtemp1-=pow(2,i-1);                 i=0;            }         cout<<bin;         return 0; } ~            

C++ printed a 100MB text file in just 6 seconds inference (Due to file stream not initialized with any file on system)

This was actually acomplished by 'not' intialising the inout file stream with any real file. So, computer may have pointed to some random location, and hence it went on printing for so long! In 6 seconds, it printed a 91.4MB text file In 1 minute (60 seconds), it printed a 848MB text file! [though notepad hang when trying to open these files]

More_Inferences_in_C++(1Aug'19-16thOct'19)

Programmer/Tester- Aditya Gupta (aka Techy3.5 :-) I used g++ to compile these on linux 1. Type casting of floating point numeral to integer (either automatic or by type casting)- Conversion of floating point to integer is by taking the GIF (Greatest Integer Funtion) and NOT ROUNDING OFF Greatest Integer Function(Maths,12th) it gives the integer part when the original number is written as integer+fractional part (where fractional part is less than 1 but positive) 2. NEsted MultiLine Comment [actually wont work as expected?!] if you do this in C++.... /*  blah /*blah blah blah*/ blah*/ the last blah will be visible to the compiler!!! (Inference- Multiline-Comment ends whenever */ is encountered, no matter where!!)NEsted MultiLine Comment 3. Size of various types (of C++) on 'Linux' Mint - (and same as in later versions of windows, and most PCs nowadays) char - 1 int - 4  (and: short - 2, unsigned long - 8) long long - 8 float - 4 double - 8 (and: lo