How to Install Solar Panels While living in Dorm

Hello friends, I hope you guys are doing great. In today's tutorial, we will have a look at How to Install Solar Panels While living in Dorm.  As global warming continues unchecked, the masses are becoming aware of the need for eco-friendly solutions. With numerous innovations at hand, it only takes a little effort to reduce our carbon footprint. The younger generations are much more aware of the impact of global warming and the need to become more environmentally friendly One way to effectively conserve energy is by using a clean, renewable source of energy, such as solar energy. Solar energy is an excellent way to reduce one’s carbon footprint, and numerous students are now turning to it to power their dorms.

Solar Panel Installation Guide

This Solar panel installation isn’t too complicated if you understand the technology behind it. However, the one issue that most students face is a lack of time. Students are often burdened with essay writing and papers and don’t get enough free time to themselves to be able to undertake personal projects like the installation of solar panels. If you feel like you’re burdened with more university work, than you can cope with, then you can always hire someone online to do your papers for you. You can pay such professionals a small amount to have the best articles or essays written for you. Ask any senior, and they will confidently tell you hiring someone online to do my research paper for me. Is a norm in university life.  If you do find the time, though, here are step-by-step instructions on how to install solar panels in your dorm room! However, before you start, make sure you take all safety precautions and enlist the help of a friend. You also have to take permission from authorities and fill out any necessary paperwork that may be involved.
Assess the Rooftop and build a Platform/mounting
For starters, it is essential to assess the site for the solar system installation. For a dorm room, this would usually be the rooftop of your building. You have to make sure that the roof receives adequate sunlight and has enough space for the solar panels. If you want to go the extra mile, then you can even get an engineer to assess the site for you.  After getting permission from the university, you can build a platform or mount on the rooftop of your building. Make sure the platform or mounting that you build for the solar panels is robust and firmly attached to the roof. While building the mounting, ensure that it is built in such a way that the solar panels face whichever direction gets them the maximum amount of light. The tilt angle of your solar panels should be decided according to the latitude of your location.
Installation of Solar Panels
Once the mounting structure is secured firmly to the rooftop, you can continue to assemble and mount the solar panels. You will be given a set of instructions with your solar panels that you are to follow while installing them.  Ensure that all of the solar panel's nuts and bolts have been appropriately attached so that the panels are correctly secured. Once the panels have been assembled and seem to be firmly connected and positioned, you can move on to the next step.
Wiring of the Solar Panels
Next, you have to wire the solar panels. Usually, MC4 connectors are used since they are universal connectors that can be connected with any solar panels. If you are connecting the solar panels in a series, then you have to connect the positive end of one module to the negative end of another module.  Series circuits increase the voltage and match it to the battery bank. If you are connecting the solar panels in a parallel connection, then you will join the positive end of one module to the positive end of another, and the negative end of one module, to the negative end of the other. A parallel circuit can maintain the voltage of each circuit. Install a grounding wire, which should be extended at least 6’ from the ground.
Connection b/w Solar Panel, Inverter and Battery
Establish a connection between the solar panel and the inverter first. You will have to have a safe and efficient conduit to transfer the wires from the outside to the inside. Once you have an established conduit, start connecting the wires of the solar panels to the inverter.  Connect the positive wire coming from the solar panel, with the positive terminal of the inverter, and connect the negative wire of the solar panel with the negative terminal of the inverter. If your solar panel system is off-grid, then you must install a battery to store backup power. Connect the battery to the inverter through heavy-duty battery cables.  Connect the positive terminal of the inverter to the positive terminal of the battery and then repeat the same steps for the negative terminal.
Check all Connections
If you have the solar system installed, check all the connections and cables to ensure everything has been connected correctly. You can get someone from the solar panel company to help with the installation or conduct a final check. Once everything is in order, you can use the solar panels to power your dorm.

Conclusion 

Numerous students are looking to use green energy to power their dorms. One such method is by using solar panels. These come in a variety of sizes and are relatively easy to install and work with.  However, most students don’t have the time to carry out such improvements for their dorms since they’re overburdened with work. In such cases, you can easily hire someone online and pay them a small amount to write an excellent essay or do your papers for you. If you have the time and capacity to install solar panels, though, you can follow our easy, step by step guide on how to install them yourself! Thanks for reading this tutorial, if you have a question regarding this article in your mind. You can comment below and ask us anything.

Voltmeter & Ammeter in Proteus ISIS

Hello friends, I hope you all are doing great. In today's tutorial, we will have a look at How to use Voltmeter & Ammeter in Proteus ISIS. It's our 4th tutorial in Proteus series. While designing an electronics project, voltage & current measurements are essential debugging features, as they help in understanding circuit behavior. Proteus has builtin instruments for voltage & current measurement. We have have their probes and today we will discuss them in detail. First have a look at Voltmeter in Proteus ISIS:

How to use Voltmeter in Proteus ISIS

  • DC Voltmeter is used to measure the voltage difference across any DC component.
  • In order to use DC Voltmeter, we need to click on Virtual Instruments Mode, as shown in the figure.
  • In Instruments list, we have DC voltmeter, so click it and place it in your Proteus workspace.
  • I am going to use the same circuit, which we have designed in first lecture, shown in below figure:
  • As you can see in the figure, I have placed two voltmeters, one at the input and second at the last LED.
  • Because of 100kohm resistance, there's a slight drop in the voltage at last two LEDs.
  • Moreover, Voltmeters are placed in parallel to these component.
  • We can also use Voltage Probe to measure voltage at any point in the electronic circuit.
  • So, click on Voltage Probe in the left toolbar and connect it to any point in your circuit and its voltage will be displayed.
  • I have placed two Voltage probes on my circuit, as shown in below figure.
  • Voltage Probe provides value up to five decimal points, while DC Voltmeter provides value up to 2 decimal points.
  • Voltage probes are quite helpful as they are small in size and easy to place in the circuit.
So, that was all about Voltmeter in Proteus. Now, let's have a look at How to use Ammeter in Proteus ISIS:

How to use Ammeter in Proteus ISIS

  • DC Ammeter is used to measure the current passing through any DC component.
  • We need to click on Virtual Instruments Mode and then click on DC Ammeter.
  • Place this Ammeter in series, as shown in below figure:
  • We aren't getting any value on our Ammeter as these LEDs are not drawing much current.
  • But, you can see we have placed the Ammeter in series, we will use it a lot in coming projects.
So, that was all about How to use Voltmeter & Ammeter in Proteus. I hope you have enjoyed today's tutorial. Till next tutorial, take care & have fun !!! :)

How to Increase Workspace in Proteus

Hello friends, hope you all are fine and having fun with your lives. Today's post is about How to increase Workspace in Proteus. It's our 3rd tutorial in Proteus series. Its quite a simple tutorial and along with this trick, I will also share few commonly used features or Proteus. Once, I was working on a simulation project in which I have to design a complete load management system in Proteus and it was quite messy as I have to include a lot of components and the area of Proteus got quite small for that and then I encountered this problem i.e. where to place the components.

You have seen in Proteus software that there's a blue rectangle which is considered as the workspace in Proteus. This area is constant and doesn't increase or decrease on its own. So if we are dealing with some messy circuit design then we have to increase this area, which we are going to discuss today. If you have downloaded my Arduino Library for Proteus, then you must have seen that the size of Arduino Mega 2560 is quite big and when I design Proteus simulations in which I need to use Arduino Mega, I have to increase the Proteus workspace to embedded all the other components. So, let's get started with how to increase Workspace in Proteus:

How to Increase Workspace in Proteus ???

  • First of all, if you are working on some project in Proteus then simply don't increase the area because when you increase the area then components get too small and its quite difficult to arrange or connect them with each other.
  • So, my suggestion is to keep using the default size, unless your circuit got messy and you actually need more space.
  • Let's open Proteus software and place few components in it, as an example I am just placing PIC Microcontrollers to cover the available space, as shown in below figure:
  • You can see in above figure, I have randomly placed 8 PIC Microcontrollers, just to fill the space.
  • Now suppose I want to add four more Microcontrollers in this Proteus file, there's no place to add them.
  • Now in order to add more components, we need to increase the size of available workspace in Proteus.
  • In order to do so, click on Systems in above menu bar and then click on Set Sheet Sizes as shown in below figure:
  • Now when you click it, a new pop up window will open up, as shown in the figure on right side.
  • You can see in the figure, there are six sizes available for the user to select.
  • First five are fixed sizes while the sixth one is user defined and you can set it to any size you want.
  • The default size of workspace in Proteus is A4, which is the first option i.e. 10inch by 7 inch.
  • So, now let's change this selection and I am selecting the fifth option so now the size is 15inch by 10 inch, as shown in below figure:
  • Now its quite obvious from the above figure that the area has increased.
  • We have the same 8 PIC Microcontrollers but now we have more free space.

Right Click to Delete Component

  • Proteus has a quick way to delete any component or wire.
  • You need to right click on your component/wire for 2 times and it will be removed/deleted from the workspace.
  • It's quite helpful, especially in designing complex simulations.

Default Terminal in Proteus

  • Let's discuss Default Terminal as well, which is used to keep the schematic organized & clear.
  • We can get them by clicking on Terminals Mode first and then click on Default, as shown in figure on right side.
  • In our previous lecture, we have designed a simple LED circuit, so let's make small changes in it, as shown in below figure:
  • You can see in above figure that I have deleted the wires and placed these default terminals on both sides.
  • In order to delete these wires, I have simply double right clicked on each wire and placed these terminals.
  • Now, double click on each terminal and provide it a name, as shown in below figure:
  • As you can see in above figure, top two Terminals are named as Terminal1 and below two terminals are named as Terminal2.
  • So, although these terminals are not connected together but Proteus considers "Terminals with same name" as connected.
  • If we run our simulation now, we will get the similar results, as shown in below figure:
  • These default Terminals are too helpful, as in complex projects, adding too much wires make the simulation quite messy. ( We will use them in coming lectures )
So, that's how you can quite easily increase workspace in Proteus ISIS. That's all for today, it was quite easy tutorial but still if you are having any problems, then ask in comments and I will resolve them. Till next tutorial, take care !!! :)

Simulate First Electronics Project in Proteus ISIS

Hello friends, I hope you all are doing great. In today's tutorial, we will simulate our First Electronics Project in Proteus ISIS. It's our 2nd tutorial in Proteus series. In our previous tutorial, we have seen a basic Introduction to Proteus and today, we will design a simple electronics circuit in it and will also simulate it. If you want to work on Proteus, then you must have some prior knowledge about electronics. Proteus doesn't provide any suggestion about circuit designing so if you don't have electronics knowledge then you can't work with Proteus. Throughout this series, I will keep on explaining electronics circuits as well and will also embedded related components' links. So, if you are new to electronics then no need to worry and just follow these instructions and also do read those embedded links to understand electronic components. So, let's Create our First Project in Proteus:

Simulate First Electronics Project in Proteus ISIS

  • Open your Proteus ISIS software and then click on Components Mode in left menu tab, as shown in the figure.
  • After that click on the P (Pick from Libraries) Button, and a new window will open up.
  • This new window is called Pick Devices and is used to make search for electronics components.
  • Proteus has a huge database of electronics components in the form of libraries. i.e. Diode Library will have all the diode components.
  • So, from these millions of components, we need to make a search for our required components to design electronic circuit.
  • You can see Pick Devices window in below figure, so let's first discuss its layout:
  • Keywords textbox is used to make a search for any component and Proteus will display the related components in Results panel. ( We will search in a while )
  • Category Section displays all the categories available in Proteus and when you click on any category then it's components will be displayed in Results panel.
  • After that, we have Sub-category & Manufacturer, rite now I don't have any.
  • On the right side we have Schematic Preview & PCB Review, so when we select any component then its respective Previews will be shown here.
  • So, now let's make a search for LED, as shown in below figure:
  • As you can see in above figure that Proteus has provided us with 141 Results and I have boxed four LEDs, which I am going to use in my circuit.
  • Moreover, Category section is now showing only those categories which are related to searched keyword.
  • Moreover, we also have a Schematic Preview but we don't have any PCB Preview as it's not available for this component.
  • So, double click on these four LEDs and they will be added in Proteus workspace.
  • Moreover, we also need to add resistance so make a search for resistance, as shown in below figure:
  • Double click on this RES component and then close this Pick Devices window.
  • You will get these selected components in the Devices section, as shown in below figure:
  • As we are designing a simple project so we have selected just four components but in complex projects, we have a long list of components in this Devices section and it proves quite helpful.
  • So, let's place these components, one by one in the central work area.
  • You can drag & drop them OR can select by clicking and then again click to place.
  • I have placed these components in the work area, as shown in figure on right side.
  • So, now let's connect them together using wires and for that, we need to click on the pin terminal of each component.
  • I have combined these electronic components together using wires, as shown in below figure:
  • Now we need to provide voltage supply to this circuit and there are several voltage sources in Proteus. ( We will cover them in coming lectures )
  • For now, let's click on the Terminals Mode in the left Toolbar and you will get Proteus Terminals, as shown in figure on right side.
  • From these terminals, we are going to use Power & Ground, so place them in the circuit, as shown in below figure:
  • We will discuss all these Terminal Components in detail in our coming lectures.
  • If we place multiple Ground components in the circuit then Proteus will consider them all as connected/short.
  • These Terminals are quite helpful, as in complex circuits, these wires can become too messy and we can avoid them by using these terminals.
  • So, we have completely designed our circuit but we need to change the properties of these components a little.
  • So, double click on resistance to open its Properties Panel, as shown in below figure:
  • From this Edit Component window, we can edit different properties of selected component.
  • As you can see, first we have Component Reference, that's the name of our component i.e. R1. If we have multiple resistances, then there names will be R2, R3 and so on.
  • We can't have multiple items with same Component Reference, as it will create an error.
  • Second Property defines the resistance of the component and I have changed it from 10k to 1k.
  • Then we have Model Type and its analog.
  • Finally we have PCB Package, we will use it when we will be designing the PCB design of this circuit.
  • So, click on the OK Button and resistance value will change from 10k to 1k.
  • Now, double click on first LED to open its Properties Panel, as shown in below figure:
  • As LED is a bit complex component as compared to resistance, that's why it has a lot more Properties to Edit.
  • As we are designing a digital circuit, so we need to change the Model Type of LED from Analog to Digital and then click on the OK Button.
  • You need to change this Model Type for all these four LEDs.
  • So, now we have completely designed our first electronic circuit in Proteus.
  • Let's run this simulation, by clicking the Play button at the bottom.
  • If everything goes fine, then all LEDs will glow, as shown in below figure:
  • We have successfully simulated our first electronics circuit in Proteus ISIS and you can see these LEDs have different colors as specified in their Reference Value.
So, that was all for today. I hope you have enjoyed today's tutorial. In the next lecture, we will have a look at How to use Relays in Proteus ISIS. Till then take care & have fun !!! :)

Introduction to Proteus

Hello readers, I hope you all are doing great. In today's tutorial, I am going to share a detailed Introduction to Proteus. It's our first tutorial in Proteus series. Today's tutorial is for beginners but still I would suggest you to read it once, as I am going to explain why Proteus? Throughout our Engineering Course, we have to design a lot of electronics or embedded circuits and it's always a best approach to simulate these circuits first on some simulation software i.e. Proteus, PSPice etc., before assembling them on actual hardware. Among these simulation software, Proteus is my favorite one so let's get started with detailed Introduction to Proteus:

Introduction to Proteus ISIS

  • Proteus Design Suite (designed by Labcenter Electronics Ltd.) is a software tool set, mainly used for creating schematics, simulating Electronics & Embedded Circuits and designing PCB Layouts.
  • Proteus ISIS is used by Engineering students & professionals to create schematics & simulations of different electronic circuits.
  • Proteus ARES is used for designing PCB Layouts of electronic circuits.
  • It's available in four languages i.e. English, Chinese, Spanish & French.

Why use Proteus ?

"Our circuit is working perfectly on Proteus but when we have implemented it on hardware, it's not working." I receive a lot of such questions from engineering students, that's why, I am explaining what's the real purpose of Proteus:
  • Proteus is quite lenient in circuit designing and it works on ideal conditions i.e. if you don't add pull up resistors in Proteus simulation, then it won't give garbage value.
  • Proteus is also used for PCB designing, we use Proteus ARES for that. ( We will discuss it in upcoming lectures )
So, when I am working on some electronics circuit, then I first design the simulation on Proteus ISIS and once I got sure that everything's working fine then I design its circuit on either the vero board or the bread board and again I perform some real world testing & when I got sure that my circuit is fully working then I design its PCB in Proteus ARES.
  • Proteus is also used for designing/testing programming codes for different Microcontrollers i.e. Arduino, PIC Microcontroller, 8051 etc.
In Embedded projects, we need to design a programming code for Microcontrollers and for designing such codes you have to perform a lot of testing, which involves uploading code to Microcontroller. So, in such projects, Proteus is a great relief. Let's say, you have to print some strings on 20x4 LCD, then its quite annoying to burn the Microcontroller several times for typographical errors. Instead, design a circuit in Proteus and test your code in the simulation and once you are sure that you are getting perfect output then burn your PIC Microcontroller and test it on real hardware. Quite easy and handy. In the coming classes, I will show you how to burn code in Microcontrollers in Proteus. Note: In code testing, there's again a possibility that you get different results in real hardware but its quite rare and mostly happens in delay functions.

Getting Started With Proteus

You can download Proteus software from it's official website and you should also read How to Download & Install Proteus software. So now I hope you have installed Proteus and ready to work on it:
  • Click on Proteus ISIS and it will open up as shown in below image.
  • In the central area surrounded by blue lines, we design our circuit i.e. place the components and then join them together.
  • As you can see in above figure that we have a lot of icons in Proteus software, so let's first understand these sections one by one.
  • In the below image, I have divided the Proteus font-end in four sections:
  • Section 1 is a toolbar which you would have seen on many simulation software, it has simple functionalities i.e. first icon to create a new layout, second one to open an existing layout, next one is to save layout, then there comes few zooming options and few other tools which we will discuss in coming tutorials.
  • Section 2 has two buttons. P is used to open the components list and E is used for editing purposes, like you want to edit the properties of any component then simply click on that component and then click on E and it will open the properties of that component and you can easily edit it.
  • Section 3 has different tools, used for designing circuits, we will discuss them in detail, at the end of today's tutorial.
  • Section 4 is the remote control section of Proteus, as it contains four buttons i.e. Play, Step, Pause & Stop. In order to run the simulation, we have to click on this play button.

Component Selection in Proteus ISIS

  • As shown in below image, click on the icon that says Click # 1, it's a Component Mode Icon.
  • After that click on P button and a new window will open up named Pick Devices.
  • In this new window there's a textbox on which Keyword is written, this text box is used for the component search.
  • Proteus database has unlimited components in it so now in order to get your desired component, you have to search for it as I did.
  • I have searched for PIC16F877A and Proteus provided me that component along with its preview in top right corner and PCB package ( if available ). Unfortunately, my Proteus doesn't have the PCB preview of PIC16F877A that's why it's blank.
  • In order to add the component in Proteus workspace, either double click on it or click on the OK button.

Instruments in Proteus ISIS

  • There are few measuring instruments available in Proteus, which you can open by clicking the Instruments Icon, as shown in figure on right side.
  • First one is oscilloscope, we use it for viewing the behavior of different signals generated.
  • Another important instrument is Virtual Terminal, it is shown on the fourth number. This Virtual Terminal is used for checking data coming through Serial Port.
  • Then there's Signal Generator, it is used to generate signal like sine wave of desired frequency.
  • We also have Voltmeter & Ammeter for both AC & DC.
  • We will discuss them in detail in our coming lectures.
  • As you can see in figure on right side, Icon A is called Graph mode, used to create graphs of voltage and current. It has different style of graphs.
  • Icon B and C are voltage and current probes respectively. Suppose you have designed some circuit in Proteus and you want to check the value of voltage at any point in the circuit. In order to do so, simply select this voltage probe and place it there and when you run your circuit, the probe will show the value of voltage above it and same for current probe.
  • Icon D is used when we want to design our own component in Proteus.
  • Icon E is a simple text editor, used for placing labels, warning or components names etc.
So, that was all for today. I hope you have enjoyed this detailed Introduction to Proteus. If you have any question, feel free to ask in comments and also subscribe through email to our mailing list, so that you don't miss any part of this tutorial series. Stay blessed. Take care.

DbContext Class in Entity Framework Core

Hello friends, I hope you all are doing great. In today's tutorial, we will have a look at what is DbContext Class in Entity Framework Core. It's our 17th tutorial in ASP.NET Core series. In our previous tutorial, we have discussed Entity Framework Core in detail and have also installed it in our web application. So, now we need understand how to work with Entity Framework Core and for that we have to look at its classes & functions. So, today we will discuss one of its class named DBContext in detail:

DbContext Class in Entity Framework Core

  • EF Core contains an important class named DbContext, which is mainly responsible for communication between Database & software objects.
  • We communicate with our database using this DbContext class and we can also map our fetched data to software objects i.e. properties.
  • So, in order to use this DbContext class, we have to create a new class and then inherit it from DbContext Class.
  • When we inherit our new class from DBContext Class, then we will be able to call all its members from our new class.
  • So, I am going to create a new class in Models folder, as Models are going to communicate with the database.
  • I have named this class TepDbContext and have inherited it from DbContext class, as shown in figure on right side.
DbContextOptions class in EF Core
  • DbContextOptions class in EF Core contains all the configuration information about database i.e. database name, database provider, database connection string etc.
  • We need to use DbContextOptions class along with DbContext class, so let's create a Constructor of DBContext class, as shown in below figure:
  • You can see in above figure that I have created a constructor of TEPDbContext class and then instantiated DbContextOptions class as a parameter.
  • After that, I have provided TepDbContext as a parameter inside < >, thus this option class is applied to our newly created TepDbContext class.
  • Next, I have created its object titled options and finally called the base constructor from DBContext class and provided this options object as a parameter.
DbSet Property in EF Core
  • So far, we have discussed two classes from EF Core and now it's time to have a look at this property in EF Core titled DBSet.
  • DBSet Property is used to map the data from software objects to underlying database.
  • Currently, we have just Engineers.cs file, which has the data properties, that need to be stored in our database.
  • So, let's create a new property in our TepDBContext class named DBSet, as shown in below figure:
  • As you can see we have created a new DbSet Property of type Engineers and given it a name DbEngineers. ( We will use it later )
So, we have successfully created our TepDbContext class and have updated it, so, now its time to register this newly created class with dependency injection of ASP.NET Core.

Database Connection String in App Settings

  • We need to provide authentication settings for our database, which we will add in appsettings.json file, so that we could use it anywhere in our project.
  • I am using MySQL database and thus provided its connection string, as shown in below figure:
  • You can see in above code that I have created a new section named ConnectionStrings and inside it, I have create DbConnection variable and have assigned DB connection string to it.
  • In the connection string, I have first provided the server i.e. localdb and then provided name of the database i.e. TepDB and finally I have declared it a trusted connection.
  • This MSSQLLocalDB is already available in Visual Studio and we will discuss it in detail in our coming lectures.
  • When we upload our web application on a real server then we will change these server settings but for now, we will use localdb available.

Dependency Injection for DbContext class

  • We have studied Dependency Injection in ASP.NET Core in detail, so now let's register TepDbContext class & provide SQL database connection string using Dependency Injection
  • For that, open your startup.cs file and in ConfigureServices method, on IServicesCollection instance, we have called AddDbContextPool method, as shown in below figure:
  • We have also specidified that we are using SQL Server & have provided the database connection string as well, I have placed a red boundary across it.
  • In order to get the Connection string from appsettings.json file, I have injected IConfiguration using Constructor Injection and have placed a green boundary across it.
  • So, our TepDBContext class is now registered with ASP.NET Core and we have also specified the Database provider & Connection String.
So, that was all for today. We have completed all our settings for database but we haven't yet created it. So, in our next lecture, we will see How to Create Database using EF Core Migrations. Till then take care & have fun !!!

Introduction to JavaScript

Hello folks, I hope you are having a great day. Today, I am going to start this new tutorial series on JavaScript and here's our 1st tutorial titled Introduction to JavaScript. This is a beginner level tutorial series, where we will start from very basics & will slowly move towards complex concepts. If you're not a beginner or looking for secure development training or advanced tutorials, stay tuned, more training is coming. We can use any development Editor for running JavaScript and for this tutorial series, I will use Microsoft Visual Studio Code, which is free to use & you can download it from official site. You don't need to be an expert programmer, in order to learn JavaScript, but you must have some basic knowledge of HTML & CSS. So, let's get started with today's lecture:

What is JavaScript - A Quick Definition

  • JavaScript ( initially named as LiveScript, officially named as ECMAScript ) is a client-side scripting language, developed by Brendan Eich in 1995 and is used to create interactive webpages and mostly used in game development.
  • Before JavaScript, webpages were dull and has no way to interact with the user, as we had only server side languages ( php, java etc. ) at that time and in order to get any action done, we have to send request to the server.
  • With JavaScript, now we can perform any complex task without refreshing the page, JavaScript works on client side that's why there's no need of page refreshing.
  • You must have noticed on your Facebook / Twitter profile that they update automatically, that's because of JavaScript.
  • As JavaScript is a client side language so it can't communicate directly with the server i.e. database or file system.
  • JavaScript is normally confused with Java, but they are two entirely different languages, Java is server side complex language while JavaScript is a simple scripting language.
How to Run JavaScript Code?
  • As I mentioned earlier, JavaScript is a client side scripting language, so we don't need any compiler or editor for running JavaScript.
  • Instead, JavaScript is directly executed by the web Browsers, similar to HTML & CSS, which are also client side languages.
  • When a user makes an HTTP request, then browser reads the webpage and along with HTML,CSS etc. it also finds the JS scripts and executes them.
  • All modern browsers support JavaScript and you can enable / disable JavaScript in your browser's settings.
  • Moreover, JavaScript works on almost all operating platforms i.e. Windows, Linux, Mac, Ubuntu etc.
  • So, in order to run JavaScript, you can use any Programming Environment / Editor i.e. Sublime, Notepad++, Visual Studio Code etc.
Uses of JavaScript
So, now let's have a look at few uses / advantages of Javascript:
  1. Developing Mobile Applications & Games.
  2. Web Browser-based Games.
  3. Add interaction to websites.
  4. Back end web Development.
  5. Rich interface for Applications and web pages.

How to Include a JavaScript Code in HTML WebPage

  • As I have mentioned earlier, we don't need any editor to run or execute JavaScript. Instead, web browsers execute the JS code on their own.
  • But question is, How web Browsers are going to recognize that its a JS code ??
  • And the answer is, the code placed between <script> </script> tags will be treated as a JavaScript Code.
  • There are two ways to include the JavaScript code in an HTML webpage, discussed as follows:
Embedding JavaScript Code directly in HTML Page
  • When we add JavaScript directly in <body> tag of our HTML page, it is termed as Embedded JavaScript.
  • In our HTML page, we can place JavaScript Code in the <script> </script> tags, as shown in the figure:
  • You can see in the figure that I have added a simple JavaScript Code:

<script> alert(“I am learning JavaScript”);    </script>

  • To run this code you have to add an extension. Go to the left side of visual studio and click on extension or press Ctrl + Shift + X buttons. 
  • Afterwards, Search “Open in browser” and install the first file. Look below in the image for more detail.
  • When your exertion is installed, now go back to your HTML file and press Alt + B.  It will run your code. 
  • You will see something similar to below image, in your browser.
  • This is a simple JavaScript alert message, displaying our content.
Include External JavaScript File in HTML WebPage
  • If we add JavaScript Code directly in HTML page then it will make the code quite messy.
  • So, it's always a best practice to create a separate file for JavaScript ( extension .js ) and then include this file in your webpage.
  • By convention, If your JavaScript code is more than 10 lines, then it's better to add an external JavaScript file.
  • It also reduces the code repetition i.e. if you are using your JS code for multiple pages.
  • Let's see now, how to add an external JavaScript file:
Steps to Follow:
  • Create a new file by pressing Ctrl + N and add  alert("Introduction to JavaScript");”  content in this file. Save it with the name “Test.js”.
  • As you can see on the right side in the figure.
  • Now go back to the “index.html” file and add the code as you can see in below figure:
  • When you will refresh the web browser then it will automatically reload a JS file through source code, as shown in below figure:
What Is The Best Way To Include JavaScript File in Html
  • You can add <script> tag in the <head> section of your HTML file, in the start of the <body> tag and also at the start or end of the body tag.
  • But I would advise you to add it at the end of the <body> tag. I will show you why it should be at the bottom of the body tag.
  • The HTML page always loads from top to bottom. And if your JS file will be in <head> tag or opening of the <body> tag. Therefore, it’s gonna run JavaScript first before loading any of the content in and it will leave a negative impact on your webpage. Let me show you now how it will drop a negative impression on your website.
  • Here is a basic example for you. As you can see in below image that I have added <script> tag at the start of <head> tag and add a new tag of <h1> for your understanding.
  • Save these file and press ALT + B to execute this code. You will notice that as you see in the picture underneath that only <script> tag alert comes up first without loading the rest of page.
  • But once I click at ok then it has loaded the rest of the page now. As indicated in the image here.
 
  • It leaves a bad impact on users because the page is loading step by step but not at once. Now I am gonna add  <script> at the bottom of the <body> tag and as you can see in image down.
  • Now save it go again to the browser and reload the page.  Instantly you can see the content and alert form at the same time. This is a perfect way of adding JS.
I am sure you all already know HTML and CSS but you have attempted to learn JavaScript many times but failed for some reason and you drop it. But I am sure now you are going to stick with me since I am going to describe you step by step each code. From the next lesson onward, I am going to tell you more in detail what is the Syntax of JavaScript and where to place JavaScript file. I hope you guys understand this lesson and I will see you in my next tutorial. Till then take care of yourself. If YOU have any question regarding this post feel free to comment below and ask about it.  I will definitely reply to your query as soon as possible. 

How to perform Software Testing and Debugging

Hello everyone, I hope you are having a fine day. In today’s tutorial, I am going to discuss “Software Testing and Debugging”

During testing and debugging, seek advice for the various techniques of detecting and eliminating mistakes in a program, so that it produces the desired result. Every programmer needs to be aware of the truth that a program does not always run perfectly for the first time. It is consequently vital to make efforts in case you do stumble on the errors. First, determine and note any errors which are found during the very first building and running of the program.

Errors that Occur during Initialization of the Program

Many errors can occur when running a program, some apparent, and others are not. All these mistakes can be grouped under four types, namely: syntax errors, run-time errors, logical mistakes, and latent mistakes.

Syntax problems are any violation of regulations specified within a  programming language results in syntax mistakes. The compiler during the build and run process of the code will automatically define such errors. When syntax errors are found in the source code of the program, the compilation fails and terminates after listing the errors and the line numbers within the source code of the application where the errors have occurred. 

Remember, in a few cases, the line quantity won't precisely suggest the vicinity of the mistake. In different instances, syntax error can also result in an extended listing of mistakes. Correction of one of the mistakes at the beginning of the build of the system may also take away the entire listing.

Run-time mistakes  include mismatch of data types or referencing out-of-variety array details, go undetected by the compiler. An application with those mistakes will run. However, it produces misguided consequences. It should be noted that isolating run-time blunders is usually a hard challenge.

Logical errors: As the name suggests, these mistakes are related to the common sense of program execution. Such moves as taking a wrong direction, failure to forget a particular situation, and incorrect order of assessment of statements belong to this category. Logical mistakes do now not show up as collect-generated mistakes messages. Rather, the program outputs the wrong results during execution. These errors are due to adverse information and incorrect translation of the set of rules by the program.

Latent errors are a 'hidden' error that pops up when a particular set of information is used — for instance, subsequent declaration.

Various Ways of  Testing a Program

Testing is the process of reviewing and executing a program to detect mistakes, which can belong to any of the four types mentioned above. We know that while the compiler can locate syntactic and semantic errors, it can't come across run-time and logical mistakes that show up all through the execution of the program. Testing, therefore, should include vital steps to detect all viable mistakes in the software. It is important to remember that it is miles impractical to find all the mistakes. The testing procedure can also encompass the subsequent two degrees:

  • Human testing
  • Computer-based trying out

Human checking out is a powerful error-detection procedure and finishes earlier than the computer-based tryout. Human testing methods encompass code inspection by the programmer, code inspection with the aid of a test institution, and a review by an essay writing service or a peer organization. The test is achieved through a statement and is analyzed with a tick list of common programming mistakes. In addition to finding the errors, the programming style and preference of algorithms are also reviewed.

Computer-based testing entails a list of degrees, particularly the compiler tryout and run-time check out. Compiler testing is the most effective of the two and also detects undiscovered syntax errors. The software executes while the compiler detects greater mistakes. 

Should this mean that this system is correct? Will it produce the expected consequences? The answer is no. The software might comprise both run-time and logical errors, which in any case won't affect the compiling process of the program.

Program Debugging And Error Checking 

Debugging is the process of discovering and correcting the mistakes in a program’s source code. One simple technique of debugging is locating print statements or logs output by the compiler during the build process of the system that shows the values of variables. It displays the dynamics of a program and allows us to observe and compare statistics at various points. Once the area of a blunder is recognized and is error corrected, the debugging statements may be eliminated. We can use the conditional compilation statements, to switch on or off the debugging statements.

Another method is to use the technique of deduction. The area of a blunder is arrived at by the use of elimination and refinement. It is done through the listing of possible reasons for the mistake.

In Conclusion

Two critical resources of a computer gadget are execution time and memory. The performance of an application is measured in phrases of those two sources. Efficiency can be progressed with true design and coding practices.

Thank you so much for reading this article. If you have any question regarding this article, you can comment below and ask us. We are looking forward for your feedback.

Introduction to Entity Framework Core

Hello friends, I hope you all are doing great. In today's tutorial, we will have a look at detailed Introduction to Entity Framework Core. It's our 16th tutorial in ASP.NET Core series. So far, we have covered the the MVC architecture and few concepts related to object oriented programming and now we are ready to get our hands on Databases. So, today we will cover data handling in detail, which is done by Entity Framework Core in .NET Core applications. So, let's first understand this Entity Framework Core:

Introduction to Entity Framework Core

  • Entity Framework Core ( normally called EF Core ), designed by Microsoft, is an open source, flexible, extensible, lightweight and cross-platform framework, which is used for storing & retrieving data from database.
  • EF Core creates a bridge between Objects in Programming & relational databases, thus referred as Object-Relational Mapper. ( O/RM )
  • In simple words, EF Core acts as a middle layer between our .NET Core Application & database.
  • EF Core is written from scratch for .NET Core, but also works with standard .NET 4.5+, and is an enhancement of ADO.NET.
Why need Entity Framework Core ?
  • If you have worked on any database i.e. SQL, MYSQL, Oracle etc. then you must have the idea about query strings.
  • In order to send or request data from these databases, we need to use query strings, which are normally quite lengthy and prone to errors.
  • In order to avoid this direct interaction with databases using query strings, we have many third party frameworks which handle these underlying query strings themselves and provide programmers with easy programming methods to deal with the data.
  • Entity Framework Core is an official data handling framework designed by Microsoft and works perfectly with ASP.NET Core.
  • EF Core supports a wide range of relational database using third party libraries called database providers, we install these libraries as NuGet Packages.
  • For example, if I want to work on SQL database, then I will install SQL NuGet Package, we will install one later.
EF Core Approach
  • We can use two approaches in Entity Framework Core, which are:
    • Code First Approach
    • Database First Approach
  • We have very limited support available for "Database First Approach" for now and we use this approach, when we already have the database. ( will cover it in future lectures )
  • In Code First Approach, we design our database from scratch and using dbContext class, we transfer data from  app to database & vice versa.
EF Core Package
  • Now we need to select the type of database i.e. SQL, MYSQL, Oracle etc., which we want to use for our web application, so I am going to use Sql Database.
  • In order to use SQL Database with EF Core, we need to install its NuGet Package called Microsoft.EntityFrameworkCore.SqlServer.
  • This NuGet package is actually the Database provider, so if you are using any other database i.e. MYSQL, then you need to install its NuGet Package. ( We will install one in the next section )
  • SQL Server NuGet Package has a dependency on EF Core Relational Package called Microsoft.EntityFrameworkCore.Relational.
  • Relational package contains the functionality, that are common in all relational databases i.e. SQL, MYSQL, Oracle etc.
  • This relational package, in turn has a dependency on Main EF Core Package called Microsoft.EntityFrameworkCore.
  • That's the main base EF Core NuGet Package that will enable EF Core on our web App.

How to Install Entity Framework Core

  • Now, let's install EF Core on our web application, so right click on the Project's Name in Solution Explorer.
  • Now click on Manage NuGet Packages, and NuGet Package Manager will open up.
  • In the Browser tab, make a search for EntityFrameworkCore.SqlServer and you will get results, as shown in below figure:
  • You can see in above figure that first one appeared in the search, is our required NuGet Package, so let's install this one.
  • As this SQL NuGet Package has a dependency on Relational, which in turn has dependency on EF Core, so when we install SQL Server Package, the other two will automatically be installed by the Visual Studio.
  • So, click on the Install Button and then accept the terms and this SQL Server NuGet Package will be installed.
  • After complete installation, you need to open Dependencies in Solution Explorer, as shown in figure on right side.
  • You will find Packages in Dependencies, so open it up and inside it you will find our SQL Server NuGet Package.
  • Expand this SQL Server Package and you will find its dependencies i.e. Relational etc.
  • So, we have successfully installed Entity Framework Core for SQL Database on our web app.
So, that was all for today. We have successfully installed EF Core on our web application but we haven't yet created our SQL Database. In the next video, we will have a look at DbContext Class in Entity Framework Core. Till then take care & have fun !!!

Form Validation in ASP.NET Core

Hello friends, I hope you all are doing great. In today's tutorial, we will have a look at Form Validation in ASP.NET Core. It's our 15th tutorial in ASP.NET Core series. In our previous lecture, we have created a Registration Form for our engineering website. But we haven't added any validations on the submitted data. So, even if users don't fill any boxes and just hit the Register Button, a new user will be created without any personal info. So, today we will place some checks on these text boxes to validate the user submitted data. So, let's get started with it:

Form Validation in ASP.NET Core

  • Validations in ASP.NET Core are available in the form of attributes & Tag Helpers.
  • Validation Attributes are applied on Properties in Model classes and validate the user submitted data.
  • Validation Tag Helpers are used in Views and provide validation errors to the users.
  • So, let's add few validations to our registration form and show errors, if inappropriate data is submitted.

Validation Attributes in ASP.NET Core

  • ASP.NET Core has many builtin Validation Attributes to verify the incoming data, few of them are as follows:
    • [Required] : Value is required.
    • [Regular Expression] : Value must match the regular expression provided.
    • [Compare] : Compares two properties i.e. Verify Email.
    • [Range] : Value must lie between specified range.
    • [MinLength] : Specifies the value's minimum length.
    • [MaxLength] : Specifies the value's maximum length.
    • [DataType] : Value must be of specified datatype.
  • So, let's apply few of these Validation Attributes on our Properties in Engineers.cs file, placed in Models folder.
  • We have already linked these properties with text boxes using asp-for Tag Helper.
  • So, open this file & in Engineers class, place these validation attribute before properties, as shown in below figure:
  • As you can see in above figure that before Username property, I have used two validation attributes i.e. Required & MaxLength.
  • I have set the MaxLength to 50 and have also added a custom ErrorMessage.
  • On the Email property, I have used Required & RegularExpression, this expression will verify the email format.
  • On the FullName property, I have used Display attribute (it's not a validation attribute), and changed the name to "Full Name", it will change the label of this text box.
  • Moreover, I have also made my enums properties null-able, as you can see I have placed ? sign infrom of DeptEnum & UniEnum. ( We will see later why null-able)
  • We have added the validation attributes on our properties and now let's place a check in our Home Controllers class using builtin validation property.
Check if Data is Valid
  • So, open you HomeController.cs class placed in the Controllers Folder.
  • In HomeController class, we need to place validation check on the Registration action method of [HTTPPost] type, as this method is going to execute on pressing the Register button.
  • As you can see in above code, I have placed an IF loop and have placed a Boolean property in it called ModelState.IsValid.
  • This Boolean property will return TRUE, if there's no validation error & will return FALSE, if there's any validation error appeared.
  • So, if it's true then I have added the submitted user data and displayed it in Info link by redirecting it to Info action method and if its FALSE, then simply returned the Registration View itself.
  • One more thing to note here is that I have changed the return type of action method to IActionResult, as it contains both RedirectToAction() & View() result types.

Display Validation errors in ASP.NET Core

  • Now it's time to display validation errors on the form itself, so now open your Registration.cshtml View file.
  • Below each textbox, we need to add a <span> element, as shown in figure on right side.
  • Inside this <span> element, I have use Validation Tag Helper named asp-validation-for and this Tag Helper is taking Username as a value.
  • So, if there's any validation error appeared for Username, then it will be displayed here.
  • Let's add this <span> element below all the textboxes, as shown in below figure:
  • You can see in above figure, that I have placed <span> element containing asp-validation-for Tag Helper, below every input field.
  • One more thing to note here is that I have added an option element Please Select, in both of my <select> tags, I have encircled them in above figure.
  • Now let's run our application, and without entering any data, hit the Register button, and we will get validation errors, as shown in below figure:
  • You can see in above figure that we are getting the Validation Error Messages for each component and at the end we have the summary of Validation errors.
  • Moreover, for our Select boxes now we have a default option "Please Select", that's why we are getting Validation Errors for them as well, as now their value is null.
  • If we select any option, then it will get value from the respective enum but in case of Please Select, its null-able and giving us Validation Error.
  • We haven't added any Bootstrap design on these elements, as I want to keep things simple for now. ( We will design them later )
So, that was all for today. I hope you have enjoyed today's lecture. In next tutorial, we will have a look at detailed introduction to Entity Framework Core. Till then take care & have fun !!!
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir