Others

Sunday, 16 December 2018

Arduino Connecting speaker

Simple application to check that the Speaker is connected to the  Arduino or not and how it will produce sound.

Required Items.
1. Speakar
2. Arduino
3. 5V

Follow the below code and upload into arduino for speaker connection

void setup()
{
 
}

void loop()
{
  tone(8,33, 500);
  delay(2000);

   tone(8,37, 500);
   delay(2000);

   tone(8,41, 500);
   delay(2000);
}
Circuit for Arduino Connecting speaker 




for more info you can see the below link. for creating melody Arduino Connecting speaker 

https://maker.pro/arduino/projects/arduino-speaker

Saturday, 15 December 2018

Arduino : Blinking LED

Simple and first program of Arduino  for blinking of LED. [ This program is look like "Hello World"  for arduino.

Required Items.
1. LED
2. Arduino
3. 5V

Program for blinking of LED in Arduino.

Saturday, 8 December 2018

Issues on Python configurations



Register the python in environment variable if Python command in Giving error in your terminal.
To see the Environment variable in command Terminals as
Echo %path%

To set the environment variable in the terminal.
setx path "%path%;C:\Python27;"

If above one will not work then set environment using the below path.
Control Panel à View Advance System setting à Go to Advance Tab à Envinoment Variable à Edit

Chat bot in Python using Chatterbot



Here is the sample code demonstration for how to create simple chatbot using chatterbot  in python.
Chatbot will answer the question based on training data that you have provided.


Sunday, 23 September 2018

Machine Learning - Data Processing


Chapter 2  - Data Processing: It is crucial part of machine learning.

1.       Dataset : Get the dataset that we will use for pre-processing. Suppose you have the dataset like below.

It is in data.csv

In machine learning model we need to check that the Dependent Variable and Independent variable.

In Below example there first three colum are independent variable and Purchased colum is dependent variable

Name
Age
Salary
Purchased
Bon
44
72000
No
Ram
27
48000
Yes
Sohan
30
54000
No
eric
38
61000
No
Mat
40

Yes
Denie
35
58000
Yes
Andie

52000
No
Rus
48
79000
Yes
Mak
50
83000
No
Mark
37
67000
Yes

Saturday, 22 September 2018

Python Lab - Day 3


Python Labs : 3rd    Day

1.       User defined Exception
2.       Machine Learning Beginning
3.       File Demo
4.       Database Connection with Sqlite in Python
5.       Pickle  demo


Lab 1
User defined Exception
bb = 60

  

  class C(Exception) :

    pass

  

Friday, 21 September 2018

Python Lab - Day 2


Python Labs  2nd   Day
  1. Class Demo in Python
  2. Constructor and Destructors in Python
  3. Data Hiding in Class in Python
  4. Inheritance in Python
  5. Self Keyword in python
  6. Exception Handling in Python
  7. Documentation functions
  8. Consume User Module in Python
  9. OS import module demo in python Lab
  10. Time and calendar import demo in python

Thursday, 20 September 2018

Python Lab - Day 1


Python Labs  : 1st Day

  1. Print Hello World
  2. Variables in Python
  3. Arithmetic Operation in Python
  4. Conditional Statement in Python
  5. Loops in Python. While, for
  6. Jumping Statement in python
  7. Datastructure in python,  python contains four  types of collection datatype  List, Tuple, Dictionary , set
  8. Formatting the String  function for print
  9. Function demo in Python
  10. Implementing inbuilt function of python
  11. Importing math functions in python

Friday, 20 July 2018

Angular 4 Tutorial - Day 4

Day 1
Day 2
Day 3
Day 4

Today it will cover as form handling in angular.

1.       Template based approach – ngModel
2.       Model driven approach – form builder

Create new services as enquiry service.




Wednesday, 18 July 2018

Angular 4 Tutorial - Day 2

Day 1
Day 2
Day 3
Day 4

Send Data from Parent to child (Lab 4)

Making the child relation and Parent relation and passing the data from Parent to child.
That can be possible by defining @Input directive in the Child Component.

Suppose you have some value in Parent component and that you need to pass to the child component as like below.



Sunday, 17 June 2018

Angular 4 Tutorial - Day 1



Prerequisite of angular Framework
History of angular
Angular Features
Node Configurations (Lab 1)
File Structure of Angular
First Application (Lab 2)
Create Child Component (Lab 3)
Angular Directives
Directive Code practice (Lab 3)

Prerequisite of angular Framework

HTML
CSS
NodeJs
Typescript

 History of angular

Angular 1.x
Angular 2 -- Angular
Angular 3 - routing -- 3.x
Angular 4,5,6


Saturday, 26 May 2018

OAuth Integration with MVC WebApi


What is OAuth

oAuth stands for Open Authorization. It helps to access the resource in secured way , when the resource owner want it to share to any third party provider.
Like you logged in to the twitter and now you want to send a friend request to all your google address book user. So you can login securely to the google and than google will authenticate and share the entire address book to twitter and that you can use to send the friend request.

How it Work


User has logged into as is user credential  into seeker Resource (SR) now he want to get the details from third party resource(RO)  where he already have account. He has to provide the credentials than third party resource owner (RO) will allocate the security token. Then Seeker Resource (SR) will send the Security token to the resource Owner(RO), and it will give the details of resource what Seeker Resource want.

Add a startup.cs class to your application


Startup page is mostly using to configuration for startup of the application when you are configuration OWIN or the OAuth authorization.

There are two what you can directly add it and  as a class file and decorate it as. OWinStartup:

  [assembly: OwinStartup(typeof(WebApiOAuth_1.App_Start.Startup))]


Or you can create startup.cs through the Visual Video by using the below process.
a.       Rt click on App_Start à Add à Class

XMLformatting in c#



Format the minify XML into readable way which help to view it properly and easy to read in C#. You can make your simple xml formatter by using the below few lines of code in C#.
static void Main(string[] args)
        {
            try
            {
                string xml = @"<?xml version='1.0' encoding='UTF - 8' ?><employees><employee><id>1</id><firstName>Leonardo</firstName>
            <lastName>DiCaprio</lastName><photo>http://1.bp.blogspot.com/-zvS_6Q1IzR8/T5l6qvnRmcI/AAAAAAAABcc/HXO7HDEJKo0/s200/Leonardo+Dicaprio7.jpg</photo>
            </employee><employee><id>2</id><firstName>Johnny</firstName><lastName>Depp</lastName>
            <photo>http://4.bp.blogspot.com/_xR71w9-qx9E/SrAz--pu0MI/AAAAAAAAC38/2ZP28rVEFKc/s200/johnny-depp-pirates.jpg</photo>
            </employee><employee><id>3</id><firstName>Hritik</firstName><lastName>Roshan</lastName><photo>http://thewallmachine.com/files/1411921557.jpg</photo>
            </employee></employees> ";

Thursday, 24 May 2018

Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'


Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 


Sunday, 20 May 2018

Binding DropDownList in MVC


In MVC we have 2 ways to bind the dropdown is strongly type and nomal way.
There are various ways that you can bind the dropdownlist in MVC.

1.       Binding Dropdownlist  using the view bag in MVC
Binding SelectedList to Dropdown

  List<SelectListItem> items = new List<SelectListItem>();
            items.Add(new SelectListItem() { Text = "Male", Value = "Male", Selected = false });
            items.Add(new SelectListItem() { Text = "Female", Value = "Female", Selected = true });

            SelectList selectList = new SelectList(items, "Value", "Text");


            ViewBag.Gender = selectList;

Binding it in HTML, like below
  @Html.DropDownList("Gender", ViewBag.Gender as SelectList)

Will get output as below.

Friday, 18 May 2018

Format date in ui-grid cellTemplate


This sample is using when you are implementing MVC with Angular 1.x and Angular Ui Grid.
Formatting of date field will be appearing like:



Sunday, 13 May 2018

Handling Exception in Global.asax in MVC



Instead of writing the try and catch throughout the application, global.asax , application_error method is the common place to handle all the error and based on the type of exception it will redirect to the page.



Tuesday, 8 May 2018

Selecting the active link in MVC



Based on selection or opening of the controller action the link will select in MVC like below.




There should you need to provide the css dynamically which is based on the action. You need to create the CSS style.
.activelink {
    color: #ffffff;
    background-color: #de0301;
    border-radius: 10px;
    margin-left: 4px;
}
If you see the below code there we are checking the (ViewContext.RouteData.Values["Controller"].ToString() == "Home"

Thursday, 19 April 2018

Provide security to Your WebApi using HttpMessageHandler


Using of HttpMessageHandler, help you to secure your WebApi action method, Even though it’s not the full proof security. But it is good to provide security based on tokens.

Step 1: Create A Web API project.
Follow below:

Step 2: Add a class file and giving the name as:

That You can give as any name





Wednesday, 14 February 2018

simple jquery popup example code


Simple jquery popup which generally use to show or to perform some operations as supplementary operations.

You will get the popup as like below.

This popup doesn’t need any plugin, you only need to take the reference of the

Saturday, 20 January 2018

cordova "no java files found that extend cordovaactivity"

Getting Error as:

Severity Code Description Project File Line Suppression State Error No Java files found which extend CordovaActivity. OilFreeRecipes 1

This issue is causing due to missing of MainActivity.Java File Generally it is residing on the below path.
[Application Name]\platforms\android\src\com
Here it should have the folder name based on the namespace you have given. Suppose I have given namespace as com.passion.oilfreerecipes So there should have folder passion --> OilfreeRecipes

Read Array object in Javascript Based on Query String

Please check the previous article  Click here to see how we can read the value which we pass in query string
Now Framing the javascript array  Object,


var val = [
        { Id: 1, Image: 'Content/Images/2.jpg', Value:'This is 1 content' },
        { Id: 2, Image: 'Content/Images/2.jpg', Value:'This is 2 content' }
    ];

Code to read array of object is javascript