Wednesday, 10 February 2021

Calculator in android studio with Source Code | Calculator in Android studio | Clcoding

 Activity Main :
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 
 xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000"
tools:context=".MainActivity">


<Button
android:id="@+id/button1"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/circle_button"
android:text="1"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.043"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.817" />

<Button
android:id="@+id/button2"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/circle_button"
android:text="2"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.352"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.817" />

<Button
android:id="@+id/button3"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/circle_button"
android:text="3"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.672"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.817" />

<Button
android:id="@+id/button4"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/circle_button"
android:text="4"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.043"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.677" />

<Button
android:id="@+id/button5"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/circle_button"
android:text="5"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.352"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.677" />

<Button
android:id="@+id/button6"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/circle_button"
android:text="6"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.672"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.677" />

<Button
android:id="@+id/button7"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/circle_button"
android:text="7"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.043"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.541" />

<Button
android:id="@+id/button8"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/circle_button"
android:text="8"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.352"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.541" />

<Button
android:id="@+id/button9"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/circle_button"
android:text="9"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.672"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.541" />

<Button
android:id="@+id/button0"
android:layout_width="185dp"
android:layout_height="80dp"
android:background="@drawable/new_but"
android:paddingRight="95sp"
android:text="0"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.061"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.957" />

<Button
android:id="@+id/button_equal"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/arithmatic_button"
android:text="="
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.99"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.958" />

<Button
android:id="@+id/button_multi"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/arithmatic_button"
android:text="×"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.99"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.541" />

<Button
android:id="@+id/button_divide"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/arithmatic_button"
android:text="/"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.987"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.406" />

<Button
android:id="@+id/button_add"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/arithmatic_button"
android:text="+"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.99"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.817" />

<Button
android:id="@+id/button_sub"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/arithmatic_button"
android:text="-"
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.99"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.677" />

<Button
android:id="@+id/button_clear"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/button"
android:text="AC"
android:textColor="#060606"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.043"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.406" />

<Button
android:id="@+id/button_para1"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/button"
android:text="%"
android:textColor="#060606"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.672"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.406" />

<Button
android:id="@+id/button_para2"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/button"
android:text="+/-"
android:textColor="#060606"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.349"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.406" />

<Button
android:id="@+id/button_dot"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/circle_button"
android:text="."
android:textColor="#ffff"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.671"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.958" />

<TextView
android:id="@+id/input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/background_light"
android:textSize="68sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.909"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.252" />

<TextView
android:id="@+id/output"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/background_light"
android:textSize="36sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.909"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.051" />

</androidx.constraintlayout.widget.ConstraintLayout>
 
Main Activity :


import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.TypedValue;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
private Button b1;
private Button b2;
private Button b3;
private Button b4;
private Button b5;
private Button b6;
private Button b7;
private Button b8;
private Button b9;
private Button b0;
private Button b_equal;
private Button b_multi;
private Button b_divide;
private Button b_add;
private Button b_sub;
private Button b_clear;
private Button b_dot;
private Button b_para1;
private Button b_para2;
private TextView t1;
private TextView t2;
private final char ADDITION = '+';
private final char SUBTRACTION = '-';
private final char MULTIPLICATION = '*';
private final char DIVISION = '/';
private final char EQU = '=';
private final char EXTRA = '@';
private final char MODULUS = '%';
private char ACTION;
private double val1 = Double.NaN;
private double val2;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
viewSetup();

b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ifErrorOnOutput();
exceedLength();
t1.setText(t1.getText().toString() + "1");
}
});

b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ifErrorOnOutput();
exceedLength();
t1.setText(t1.getText().toString() + "2");
}
});

b3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ifErrorOnOutput();
exceedLength();
t1.setText(t1.getText().toString() + "3");
}
});

b4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ifErrorOnOutput();
exceedLength();
t1.setText(t1.getText().toString() + "4");
}
});

b5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ifErrorOnOutput();
exceedLength();
t1.setText(t1.getText().toString() + "5");
}
});

b6.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ifErrorOnOutput();
exceedLength();
t1.setText(t1.getText().toString() + "6");
}
});

b7.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ifErrorOnOutput();
exceedLength();
t1.setText(t1.getText().toString() + "7");
}
});

b8.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ifErrorOnOutput();
exceedLength();
t1.setText(t1.getText().toString() + "8");
}
});

b9.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ifErrorOnOutput();
exceedLength();
t1.setText(t1.getText().toString() + "9");
}
});

b0.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ifErrorOnOutput();
exceedLength();
t1.setText(t1.getText().toString() + "0");
}
});

b_dot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
exceedLength();
t1.setText(t1.getText().toString() + ".");
}
});

b_para1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (t1.getText().length() > 0) {
ACTION = MODULUS;
operation();
if (!ifReallyDecimal()) {
t2.setText(val1 + "%");
} else {
t2.setText((int) val1 + "%");
}
t1.setText(null);
} else {
t2.setText("Error");
}
}
});

b_add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (t1.getText().length() > 0) {
ACTION = ADDITION;
operation();
if (!ifReallyDecimal()) {
t2.setText(val1 + "+");
} else {
t2.setText((int) val1 + "+");
}
t1.setText(null);
} else {
t2.setText("Error");
}
}
});

b_sub.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (t1.getText().length() > 0) {
ACTION = SUBTRACTION;
operation();
if (t1.getText().length() > 0)
if (!ifReallyDecimal()) {
t2.setText(val1 + "-");
} else {
t2.setText((int) val1 + "-");
}
t1.setText(null);
} else {
t2.setText("Error");
}
}
});

b_multi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (t1.getText().length() > 0) {
ACTION = MULTIPLICATION;
operation();
if (!ifReallyDecimal()) {
t2.setText(val1 + "×");
} else {
t2.setText((int) val1 + "×");
}
t1.setText(null);
} else {
t2.setText("Error");
}
}
});

b_divide.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (t1.getText().length() > 0) {
ACTION = DIVISION;
operation();
if (ifReallyDecimal()) {
t2.setText((int) val1 + "/");
} else {
t2.setText(val1 + "/");
}
t1.setText(null);
} else {
t2.setText("Error");
}
}
});

b_para2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!t2.getText().toString().isEmpty() || !t1.getText().toString().isEmpty()) {
val1 = Double.parseDouble(t1.getText().toString());
ACTION = EXTRA;
t2.setText("-" + t1.getText().toString());
t1.setText("");
} else {
t2.setText("Error");
}
}
});

b_equal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (t1.getText().length() > 0) {
operation();
ACTION = EQU;
if (!ifReallyDecimal()) {
t2.setText(/*t2.getText().toString() + String.valueOf(val2) + "=" + */String.valueOf(val1));
} else {
t2.setText(/*t2.getText().toString() + String.valueOf(val2) + "=" + */String.valueOf((int) val1));
}
t1.setText(null);
} else {
t2.setText("Error");
}
}
});

b_clear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (t1.getText().length() > 0) {
CharSequence name = t1.getText().toString();
t1.setText(name.subSequence(0, name.length() - 1));
} else {
val1 = Double.NaN;
val2 = Double.NaN;
t1.setText("");
t2.setText("");
}
}
});

// Empty text views on long click.
b_clear.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
val1 = Double.NaN;
val2 = Double.NaN;
t1.setText("");
t2.setText("");
return true;
}
});
}

private void viewSetup() {
b1 = findViewById(R.id.button1);
b2 = findViewById(R.id.button2);
b3 = findViewById(R.id.button3);
b4 = findViewById(R.id.button4);
b5 = findViewById(R.id.button5);
b6 = findViewById(R.id.button6);
b7 = findViewById(R.id.button7);
b8 = findViewById(R.id.button8);
b9 = findViewById(R.id.button9);
b0 = findViewById(R.id.button0);
b_equal = findViewById(R.id.button_equal);
b_multi = findViewById(R.id.button_multi);
b_divide = findViewById(R.id.button_divide);
b_add = findViewById(R.id.button_add);
b_sub = findViewById(R.id.button_sub);
b_clear = findViewById(R.id.button_clear);
b_dot = findViewById(R.id.button_dot);
b_para1 = findViewById(R.id.button_para1);
b_para2 = findViewById(R.id.button_para2);
t1 = findViewById(R.id.input);
t2 = findViewById(R.id.output);
}

private void operation() {
if (!Double.isNaN(val1)) {
if (t2.getText().toString().charAt(0) == '-') {
val1 = (-1) * val1;
}
val2 = Double.parseDouble(t1.getText().toString());

switch (ACTION) {
case ADDITION:
val1 = val1 + val2;
break;
case SUBTRACTION:
val1 = val1 - val2;
break;
case MULTIPLICATION:
val1 = val1 * val2;
break;
case DIVISION:
val1 = val1 / val2;
break;
case EXTRA:
val1 = (-1) * val1;
break;
case MODULUS:
val1 = val1 % val2;
break;
case EQU:
break;
}
} else {
val1 = Double.parseDouble(t1.getText().toString());
}
}

// Remove error message that is already written there.
private void ifErrorOnOutput() {
if (t2.getText().toString().equals("Error")) {
t2.setText("");
}
}

// Whether value if a double or not
private boolean ifReallyDecimal() {
return val1 == (int) val1;
}

private void noOperation() {
String inputExpression = t2.getText().toString();
if (!inputExpression.isEmpty() && !inputExpression.equals("Error")) {
if (inputExpression.contains("-")) {
inputExpression = inputExpression.replace("-", "");
t2.setText("");
val1 = Double.parseDouble(inputExpression);
}
if (inputExpression.contains("+")) {
inputExpression = inputExpression.replace("+", "");
t2.setText("");
val1 = Double.parseDouble(inputExpression);
}
if (inputExpression.contains("/")) {
inputExpression = inputExpression.replace("/", "");
t2.setText("");
val1 = Double.parseDouble(inputExpression);
}
if (inputExpression.contains("%")) {
inputExpression = inputExpression.replace("%", "");
t2.setText("");
val1 = Double.parseDouble(inputExpression);
}
if (inputExpression.contains("×")) {
inputExpression = inputExpression.replace("×", "");
t2.setText("");
val1 = Double.parseDouble(inputExpression);
}
}
}

// Make text small if too many digits.
private void exceedLength() {
if (t1.getText().toString().length() > 10) {
t1.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
}
}

Tuesday, 26 January 2021

Namespace and Main Method in C# PROGRAMMING | Clcoding

What is Namespace ?

A namespace is used to organize your code and is collection of classes, interfaces, structs, enums and delegates.

To define a namespace in C#, we will use the namespace keyword followed by the name of the namespace and curly braces containing the body of the namespace as follows: 

Syntax:

namespace name_of_namespace {

// Namespace (Nested Namespaces)
// Classes
// Interfaces
// Structures
// Delegates

}

Note : 

  • If you don't want to use namespace you can use fully qualified name (FQN).
  • Two classes with the same name can be created inside 2 different namespaces in a single program.
  • Inside a namespace, no two classes can have the same name.
  • In C#, the full name of the class starts from its namespace name followed by dot(.) operator and the class name, which is termed as the fully qualified name of the class.

Example :

 // defining the namespace name1
namespace name1
{

    // C1 is the class in the namespace name1
    class C1
    {
         // class code
    }
}

What is main Method ? 

Main method is the entry point into your application. 


What is CLR (Common Language Runtime) in DotNET (.Net) Framework | Clcoding

The CLR (Common Language RunTime) :

  • Is the foundation of the .NET Framework.
  • Acts as an execution engine for the .NET Framework.
  • Manages the execution of programs and provides a suitable environment for programs to run.
  • Provides a multi-language execution environment.

The following figure shows a more detailed look at the working of the CLR:

 

Just in time (JIT) compiler converts MSIL to native code, which is CPU specific code.

When a code is executed for the first time;

⟶ The CIL ( COMMON INTERMEDIATE LANGUAGE ) code is converted to a code native to the operating system.

⟶ This is done at runtime by the Just-In-Time (JIT) compiler present in the CLR.

⟶ The CLR converts the CIL code to the machine language code.

⟶ Once this is done, the code can be directly executed by the CPU.

Monday, 11 January 2021

Introducing Flutter | What is Flutter ? | Flutter | Clcoding

Flutter is an open-source mobile application development framework created by Google. It is used to develop application for Android and iOS, as well as being the primary method of creating application for Google Fuchsia.

History 

The first version of Flutter was known as "Sky" and ran on the Android Operating system. It was unveiled at the 2015 Dart developer summit, with the started intent of being able to render consistently at 120 frames per second.

During the keynote of Google Developer Days in Shanghai, Google announced Flutter Release Preview 2 which is the last big release before Flutter 1.0. On December 4th 2018, Flutter 1.0 was released at the Flutter Live event, denoting the first "stable" version of the framework.

Flutter - Saving Files to Application Folder and Gallery | Flutter Tutorial  - YouTube

Framework Architecture :

The major components of Flutter include :

  • Dart platform
  • Flutter engine
  • Foundation Library 
  • Design-specific widgets

 Dart Platform :

Flutter apps are written in theDart language and make use of many of the language's more advanced features.

On Android, and on Windows macOS and Linux via the semi-official flutter Desktop Embedding project, Flutter runs in the Dart virtual machine features a just-in-time execution engine. Due to App Store restrictions on dynamic code execution, Flutter apps use ahead-of-time (AOT) compilation on iOS.

A notable feature of the Dart platform its support for "hot reload" where modifications to source files can be injected into a running application. Flutter extends this with support for stateful hot reload, where in most cases changes to source code can be reflected immediately in the running app without requiring a restart or any loss of state. This feature as implementation in flutter gas received widespread praise.

Flutter Engine :

Flutter's engine, written primarily in C++, provides low level rendering support using Google's Skia graphics library. Additionally. it interfaces with platform-specific SDKs such as those provided by Android and iOS. The Flutter Engine is a portable runtime for hosting Flutter applications. It implements Flutter's core libraries, including animation and graphics, file and network I/O, accessibility support, plugin architecture, and a Dart runtime and compile toolchain, Most developers will interact with Flutter via the Flutter Framework, which provides a modern, receive framework, and a rich set of platform, layout and foundation widgets.

Foundation Library :

The foundation library, written in Dart, provides basic classes and functions which are used to construct application using Flutter, such as APIs to communicate with the engine.

Design-specific widgets  :

The Flutter framework contains two sets of widget which conform to specific design languages. Material Design widgets implement Google's design language of the same name, and Cupertino widgets Imitate Apple's iOS design. .Flutter Tutorial - Creating Navigation Drawer in Flutter

Friday, 13 November 2020

Webscrapping of matlabcoding.com website using python with complete code

Webscrapping of matlabcoding.com website t get the latest post published by the website.  In this code bs4 is used. 

Using BeautifulSoup and Telegram, All the new post are updated in our telegram channel. 

for any doubt please do comment. 

Complete python code: 

import requests from bs4 import BeautifulSoup page = requests.get("https://www.matlabcoding.com") soup = BeautifulSoup(page.content, 'html.parser') x = soup.find('div',id="content-wrapper") y = x.find('div',class_="post-outer") z = y.find('a',href=True) msg = z['href'] import telegram chat_id =-1001454266592 token_id = '1428056219:AAHN7iwCdMC9tNKjH-3HK2Y0Hx8uloMqSAk' def send(msg,chat_id=chat_id,token=token_id): bot = telegram.Bot(token=token_id) bot.sendMessage(chat_id=chat_id,text=msg) send(f"New Matlab udate on matlabcoding.com : {msg}")







Telegram: https://t.me/clcoding_python

Thursday, 5 November 2020

Sunday, 1 November 2020

Python Code for CORONA Updates on Telegram





#Python Code for CORONA Updates on Telegram
from bs4 import BeautifulSoup 
import requests  
import pandas as pd 
x=[] 
x1=[] 
source=requests.get('https://www.worldometers.info/coronavirus/country/india/').text 
soup=BeautifulSoup(source,'lxml') 
z=soup.find_all('div',id='maincounter-wrap') 
z1=soup.find_all('div',class_='maincounter-number') 
 
for k in z: 
    y=k.h1.text 
    x.append(y) 
 
for i in z1: 
    y1=i.span.text 
    x1.append(y1) 
     
df=pd.DataFrame(x1,x,['Number']) 
df.head() 

import telegram
chat_id = 957639882
token_id = '1339570026:AAE39zN86JK6mxgAGpkJo876Mq75IQW5WZU'
def send(msg,chat_id=chat_id,token=token_id):
    bot = telegram.Bot(token=token_id)
    bot.sendMessage(chat_id=chat_id,text=msg)
    
send(f" Todays's Corona Update:\n{df}")


Telegram: https://t.me/clcoding_python

Wednesday, 21 October 2020

Matplotlib library in Python

Matplotlib is a plotting library for the Python programming language and its numerical mathematics extension NumPy. It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits like Tkinter, wxPython, Qt, or GTK+. There is also a procedural "pylab" interface based on a state machine (like OpenGL), designed to closely resemble that of MATLAB, though its use is discouraged.[3] SciPy makes use of Matplotlib.

Matplotlib was originally written by John D. Hunter, since then it has an active development community,[4] and is distributed under a BSD-style license. Michael Droettboom was nominated as matplotlib's lead developer shortly before John Hunter's death in August 2012,[5] and further joined by Thomas Caswell.[6][7]

Matplotlib 2.0.x supports Python versions 2.7 through 3.6. Python 3 support started with Matplotlib 1.2. Matplotlib 1.4 is the last version to support Python 2.6.[8] Matplotlib has pledged to not support Python 2 past 2020 by signing the Python 3 Statement.















Sunday, 31 May 2020

User defined function | Python | part 2

Saturday, 30 May 2020

User defined function | Python | part 1



Friday, 29 May 2020

Logistic Regression in python (part02) | python crash course08

Logistic Regression in python (part02) :

Hello friends, in the previous post we see input data processing methods. In this post we are going to see How create an Array and How to split data into train,test model. Let's start:
We have about forty-Two thousand and odd record. If we use this entire data for model building, we will not left with any data for testings. So generally, we split the entire data set into two part, say 60/40 percentage. We use 60% of the data for model building and the rest for testing the accuracy in prediction of our created model. You may use a different splitting ratios as per your requirements.

Creating Feature Array:

Before we spliting the data, we separate out the data into two array X and Y. The X arrays contain all the feature that we want to analyzed and Y arrays is a single dimensional arrays of boolean value that is the outputs of the prediction. To understand this, let us run some codes.
 Execute the following Python statements to create the X array −
In [06]: X = data.iloc[:,1:]
To examine the content of X use head to print a few initial record. The following screen show the contents of the X arrays.
In [07]: X.head ()
Initial Records
The arrays has several row and column.
Next, we will be create output array containing “y” value.

Creating Outputs Array:

To create an array for the predicted values columns, use the following Python statements−
In [08]: Y = data.iloc[:,0]
Examine its content by calling head. The screen outputs below show the results −
In [09]: Y.head()
Out[09]: 0   0
1    0
2    1
3    0
4    1
Name: y, dtype: int64
Now, splits the data using the following commands −
In [10]: X_train, X_test, Y_train, Y_test = train_test_split(X, Y)
This will be create the four array called X_train, Y_train, X_test, and Y_test. As before, you may examine the content of these array by using the head commands. We will use X_train and Y_train array for training our models and X_test and Y_test array for testing and validating.
Next Step to built Classifier We will see this into it in the next chapter.
                                                        BEST OF LUCK!!!!

Popular Posts

Categories

100 Python Programs for Beginner (53) AI (34) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (173) C (77) C# (12) C++ (82) Course (67) Coursera (226) Cybersecurity (24) data management (11) Data Science (128) Data Strucures (8) Deep Learning (20) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (34) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (59) Meta (22) MICHIGAN (5) microsoft (4) Nvidia (3) Pandas (4) PHP (20) Projects (29) Python (932) Python Coding Challenge (358) Python Quiz (23) Python Tips (2) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (3) Software (17) SQL (42) UX Research (1) web application (8) Web development (2) web scraping (2)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses