Tuesday, 28 March 2017

Compile and run C & C++ programs in Atom Editor



Here's a simple way to compile and run C and C++ programs in Atom Editor
1. To do that you first need to install Atom Editor, download link https://atom.io/
2. Go to Files -> Settings -> Install
search for gpp-compiler and install
(gpp compiler package link: https://atom.io/packages/gpp-compiler)
3. Now go to the editor and write your program and save.
4. To compile the program press F5 or right click the file in tree view and click Compile and Run

5. The terminal/command prompt will invoke and start to show you output if your code is compiled successfully.


Note: To use the compiler from the Atom Editor you also need to install MinGW
Watch this video for install MinGW on Windows: https://www.youtube.com/watch?v=DHekr3EtDOA


Monday, 27 March 2017

Using Cloud Functions in Firebase to send emails to the users for subscriber notifications

Use the GitHub repository:

1. Copy or clone the repository in your computer.
2. Move the functions to the functions folder created for your Project in the local directory and move the hosting files in public folder to the local public folder.
3. Paste the Web initialization snippet from: Firebase Console > Overview > Add Firebase to your web app in the public/index.html where the TODO is located.
4.You must have the Firebase CLI installed. If you don't have it install it with  install -g firebase-tools and then configure it with firebase login.


5. Configure the CLI locally by using firebase use --add and select your project in the list.
6. Install dependencies locally by running: cd functions; npm install; cd -
7. Now open the command prompt / terminal and enter the following command by changing the your-email@gmail.com and email-password from which you want to send the email.

firebase functions:config:set gmail.email="your-email@gmail.com" gmail.password="email-password"

This will configure the 'gmail.email' and 'gmail.password' Google Cloud environment variables.
8. After its done, now its time to deploy your functions and hosting for the project.
9. Open the command prompt/terminal. Use the command

firebase deploy

To start the deployment.

10. After the deployment is complete you can open the hosting from the URL displayed in terminal at the end of the deployment completion.

Sunday, 26 March 2017

Passing PHP variable to JavaScript Button Click Function

Here's how to pass your PHP variable to a JavaScript button Click function

The variable is  $username

and here's how to pass it to onClick function

echo "<td><input type=\"button\" value=\"Edit\" onClick=\"editItem('".$username."')\"> <a href=\"delete.php\" onClick=\"return confirm('Are you sure you want to delete?')\">Delete</a></td>";

Android Studio 2.3 - Speed up startup loading time

I updated my Android Studio 2.1.3 to Android Studio 2.3 on my Windows 10 OS System.

My computer had a configuration of 8GB RAM, 4GB Nvidia 920m GPU and 5th Gen i5 Processor. But when starting the android studio it was really very slow and was just not enough to work on it.

It took me 15-20 mins to start and build the initial gradle in the android studio.

So I tried to make some changes and updates in the system to make the system work faster and lower the startup time for the Android Studio 2.3.


Here are the changes and updates that I made in my computer:


1. Enable IVT for Intel Processor
This starts the virtualization of the system to make the PC process faster.

To do this restart your PC and go to the BIOS setting at the startup and enable the IVT/Virtualisation for Intel Processor.

2. Increase Virtual Memory to 20GB

Go to Computer -> Right Click and select Properties -> In Left side select Advanced System Settings

In Advanced -> Performance -> Settings




3. Install HAXM Intel 86x Emulator
Download link: https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager/

4. Click Windows+R and Go to services.msc
Select Windows Search and Superfetch
Go to Startup type and select disabled
And stop the services

5. Go to settings -> System -> Notifications -> Get tips, tricks about Windows -> turn Off



Default setting of Windows 10 will use about >90% of your disk which will make your building process much more slower. You could decrease it to <12% by simply turning off "Show Me About Windows".

6. Go to gradle.properties in the Android Project and set

org.gradle.jvmargs=-Xmx2048m



7. Enable offline Gradle compiler to prevent the update checks

Go to File -> Settings.

And open the 'Build,Execution,Deployment',Then open the 'Build Tools' -> 'Gradle'.
Then check "Offline work" on the right.


8. Also go to compiler and set the Command line options to --> 

--parallel --offline


After doing this settings Android Studio 2.3 went 2.5x faster. Its starting on a reboot which was initially 15-20 mins, was lowered to 6-8 mins.

As a best performance in Android Studio restart which took almost 10 mins was lowered to 3 mins.

Friday, 24 March 2017

Unsupported major.minor version 52.0 when rendering in Android Studio 2.3 API Level 25

Generally when you try to create a new project or load a project in Android Studio 2.3 with API Level 25 it shows an error saying -

Unsupported major.minor version 52.0

To solve the issue do the following -

Files -> Other Setting -> Default Project Structure -> Check the Use embedded JDK (recommended)

select Mark

This will solve the issue.

Wednesday, 1 March 2017

Employee Payroll System in C Language using Structured Approach

Employee-Payroll-System-in-C-Language


Employee Payroll System program written in C language using structured approach. Program has functions to create employee records, update records, generate salary slip & display all records in a table.

Follow the actual code and repository at: 
https://github.com/VishalVishwakarma/Employee-Payroll-System-in-C-Language/

Files Description


payroll.c - This is the code file that needs to compiled and executed. It is written in C language using the structured approach.
payroll.exe - Binary file or application or exe file. This can be used to directly run the program in the terminal or the command prompt.
Payroll-Complete-Program-Sample-Output.txt - This is the sample output text file.




Compiling using GCC compiler in Windows


Install the GCC/MinGW compiler compiler for C/C++. Open the command prompt/CMD and get to the directory where the program is located.

Type the following command to compile the code file.

gcc payroll.c -o payroll.exe

This will successfully compile the code and will be ready to run. To execute enter -

payroll.exe
This will start to execute the program.



While - switch continuous loop program in C

While - switch continuous loop program in C

Until the user want to exit the program, the program continues to execute.

Basic command line input addition program in C

Basic command line input addition program in C
Using arguments to take the input during the execution.

Simple employee salary payroll program in C using structure


Simple employee salary payroll program in C using structure.