• Android With Java

    Retrofit – A simple Android tutorial

    In this tutorial, we are going to see how to use Retrofit HTTP client in your Android application. Retrofit is an awesome type-safe HTTP client for Android and Java built by awesome folks at Square. Retrofit makes it easy to consume JSON or XML data which is parsed into Plain Old Java Objects (POJOs). So, without any further delays, lets get started by first creating a new project in Android Studio. 1.Go to File ⇒ New Project. When it prompts you to select the default activity, select Empty Activity and proceed. 2.Open build.gradle in (Module:app) and add Retrofit, Picasso, RecyclerView, Gson dependencies like this. dependencies { ... compile "com.android.support:cardview-v7:26.1.0" compile…

  • Tutorials

    Write a shell script that store content from console to file until end is encountered and print number of line and content of stored file

    echo "Enter Content" touch contentfile end="end" while true do read content if [ "$content" != "$end" ] then echo $content >> contentfile line=$((line + 1)) else break fi done echo "-----------------------------------------" echo " Content Of File" echo "Name Of File :: contentfile" echo "Number Of Line $line" read data < contentfile while read data do echo "$data" done < contentfile echo "-----------------------------------------"  

  • Javascript

    Where To Place JavaScript In HTML

    Javascript can be placed in three ways. Between <head> and </head> Between <body> and </body> External JS File How To Define Javascript In HTML, JavaScript code must be inserted between <script>  and </script> tags. <script> document.getElementById("demo").innerHTML = "My First JavaScript"; </script> Old JavaScript examples may use a type attribute: <script type=”text/javascript”>. The type attribute is not required. JavaScript is the default scripting language in HTML. JavaScript Functions and Events A JavaScript function is a block of JavaScript code, that can be executed when “called” for. For example, a function can be called when an event occurs, like when the user clicks a button. You will learn…

  • Javascript

    Javascript Can Change HTML Content

    One of many JavaScript HTML methods is getElementById(). This example uses the method to “find” an HTML element (with id=”line”) and changes the element content (innerHTML) to “Hello JavaScript”: <html> <body> <h2>Java Script Can Change HTML Content</h2> <p id="line">This Is HTML Content</p> <button type="button" onclick='document.getElementById("line").innerHTML = "The Content Is Changed By Javascript"'>Click Me to Change</button> </body> </html> JavaScript accepts both double and single quotes: JavaScript Can Change HTML Attribute Values In this example JavaScript changes the value of the src (source) attribute of an <img> tag: <html> <body> <h2>Java Script Can Change HTML Attribute</h2> <button type="button" onclick='document.getElementById("bulb").src = "off.gif"'>Off The…

  • Python

    Consider the following formula and evaluate the y value for the range of t values found in a file with format 𝑦(𝑡)=𝑣0𝑡−0.5𝑔𝑡2

    Problem: Consider the following formula and evaluate the y value for the range of t values found in a file with format 𝑦(𝑡)=𝑣0𝑡−0.5𝑔𝑡2 File Format: v0 3.0 t: 0.15592 0.28075 0.36807889 0.35 0.57681501876 0.21342619 0.0519085 0.042 0.27 0.50620017 0.528 0.2094294 0.1117 0.53012 0.3729850 0.39325246 0.21385894 0.3464815 0.57982969 0.10262264 0.29584013 0.17383923 More precisely, the first two lines are always present, while the next lines contain an arbitrary number of t values on each line, separated by one or more spaces. i. Write a function that reads the input file and returns v0 and a list with the t values. ii. Write…

  • Python

    Read data from two file and calculate salary of employee

    Problem: An organization wants to compute monthly wages to be paid to an employee in an organization. The input data is provided in two different files. File1 contains permanent employee data about employees (i.e. Empid, name, hourly wages), and File2 contains working hours information of each employee in the current month (i.e., empid and hours). Individual elements of data are separated by commas. Design a python program that reads both the files, computes the monthly wages of each employee and store in another file. Take both file names as command line arguments and check the respected exceptions for the same.…

  • Tutorials

    Write a shell script for performing the functions of a basic calculator.

    This will execute basic calculator operation. echo -n "Enter the First Value " read no1 echo -n "Enter the Second Value " read no2 echo " *** Choice *** " echo "1. Addition" echo "2. Subtraction" echo "3. Multiplication" echo "4. Division" echo "5. Modulo" echo -n "Enter Choice: " read choice case $choice in 1) echo -n $no1 "+" $no2 "is " result=`expr $no1 + $no2` echo $result;; 2) echo -n $no1 "-" $no2 "is " result=`expr $no1 - $no2` echo $result;; 3) echo -n $no1 "*" $no2 "is " result=$((no1 * no2)) echo $result;; 4) echo -n $no1…

  • C language

    Find Sum Of Digit For Given Value By User.

    This problem will calculate the sum of all digit in the value give by user. #include<stdio.h> void main() { long long no,temp; int rem,sum=0; printf("\n\tEnter 5 to 6 digit number "); scanf("%lld",&no); temp=no; //printf("no=%ld",no); do { while(temp!=0) { rem=temp%10; //// printf("rem=%d\n",rem); sum=sum+rem; temp=temp/10; } //printf("\nsum %d",sum); temp=sum; sum=0; // printf("\ntemp=%ld",(temp/10)); }while((temp/10)!=0); printf("\n\t_____________________________________"); printf("\n\tSum %d\n",temp); }  

  • C language

    A pharmaceutical company provides solution to complete a chemical process. Time and resources taken by chemical process depends on set of chemical compounds as an input conditions.

    The Detailed Problem Is Describe Below. A pharmaceutical company provides solution to complete a chemical process. Time and resources taken by chemical process depends on set of chemical compounds as an input conditions. Company charges on the following basis: •      If number of hours required to complete chemical process is less or equal to 48 then rates are rupees 2k per hour. •      If number of hours are more than 48 and less than 240, then the rates are up to 48 hours as serial number 1. For all the remaining rate is fixed at rupees 4k per hours. •     …

  • C language

    To calculate the average of five numbers.

    This Program calculate the average of five numbers. This gives basic working of C Program. #include<stdio.h> void main() { int no1,no2,no3,no4,no5,sum; float avg; printf("\n\tEnter First Number "); scanf("%d",&no1); printf("\n\tEnter Second Number "); scanf("%d",&no2); printf("\n\tEnter Third Number "); scanf("%d",&no3); printf("\n\tEnter Fourth Number "); scanf("%d",&no4); printf("\n\tEnter Fifth Number "); scanf("%d",&no5); sum=no1+no2+no3+no4+no5; avg=sum/5; printf("\n\t_____________________________________________"); printf("\n\n\tSum Of Above Number Is %d",sum); printf("\n\tAverage Of Above Five Numbers Is %f\n\n",avg); }