Posts

Python Programming Guides

Python is a popular programming language among programmers and learned by many. Python has rich set of libraries that makes writing any program is possible and certainly different from other popular languages. Here are some basic topics to kick start journey in learning Python. https://parttimetutor.blogspot.com/p/python.html  

Drawing Simple Pie Chart

Image
To draw pie chart with 5 sectors. The program calculates the total of all the input given by user and find the angle in degrees to draw each sectors. When the program first loads, chart based on default values is painted by the program. User can edit the values in the text field and presses draw button to redraw the chart. Each time the draw button is pressed, new set of angle is calculated and repainted. I have attached the the sources for this program. It is simple and needs upgrades. Pie.java This class executed the program and initializes the components JTextField and JPanel to draw the chart. package coolApp.graphics; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Pie { JTextField a,b,c,d,e; JButton btnDraw; double total; JPanel contentPane; Pie(){ JFrame frame = new JFrame("Pie - CoolApps"); frame.setSize(500,500); contentPane = new JPanel(); contentPane.setLayout(new BorderLayout()); frame

Bootstrap 4

Image
Bootstrap provides CSS classes to style your webpages on the go. This saves a lot of time building web page. Before start  we need to  either download the bootstrap and include them in project or refer to bootstrap CDN. Copy and paste following, that links to bootstrap.min.css beta version 4.2 (latest version as of 5 Jan 2019) <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"> Also copy and paste following javaScript <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" ></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script> Template The template showing where to place the link to bootstrap CSS and javascripts. <!doctype html> <html lang="en"&

VB.net connecting to SQL Server

Connecting to SQL server 2014 from VB.Net 2017, read values from the database and display the data in windows form. Before begin to write this program, first we need to import SqlClient class. Imports System.Data.SqlClient Step 1 Create a sql connection object. This is to make connection to object. Dim conn As New SqlConnection() Step 2 Set the connection string to the sqlconnection object: conn.ConnectionString = connStr Road block The variable connStr is a connection string. Connection object need connection string to make connection to database. It has information like who providing the database, the name of the database and some security information. Dim connStr As String = "Data Source = ServerInstanceName;Initial Catalog=testDB;Integrated Security=True" Let's break down the connection string into the three main components. Dim provider As String = "ServerInstanceName;" Dim database As String = "Initial Catalog=testDB;" Dim

Setting up data set and display it

Before we display some data in DataGridView control in Visual Basic window we must create a data set. Data Set is an object that can hold data tables where all the data is stored in rows and columns. the first step is to create a table. Dim  dataTableObjectName as DataTable = New DataTable(tableName) this will create a table which is reference using the dataTableObjectName Example Dim userTable As DataTable = New DataTable("Users") Next step is adding columns to the table Dim column as DataColumn dataTableObjectName.Columns.Add (columnName, columnType) Example userTable.Columns.Add("userID", Type.GetType("System.Int.32")) ' adding second and third column userTable.Columns.Add("userName", Type.GetType("System.String")) userTable.Columns.Add("userContact", Type.GetType("System.String")) once we we columns in the table we can add row The rows contains records or the data for each user. dat

VB.net

a quick and convenient way to build a window based application. basically there is two main components in VB, the design view where we place the controls on a window form. then we have the code view where we write implementation for each controls on the form. Typically the control implementation or procedures are executed when certain events happens to the controls. Events like mouse click, or value change on text box, form load, form close and so on. After working with programming language like C, C++ and Java, getting use to VB is a bit challenging. its because first of all, VB don't use curly bracket to specify code blocks, and the statements don't end with semicolon. variable declaration for example is written as dim age As Integer in C, C++ and Java it written int age; in VB, variable declaration start with dim keyword, it means dimension and the functions are written as Function addNumber(ByVal num1 As Integer, ByVal num2 As Integer) As Integer addNumber

Controlling motor to affect rover movement direction

Image
This post is to capture finding on 2 wheeled rover movement   procedure. the rover is connected to Laptop via serial connection provided by Arduino micro controller which will be referred to as only Arduino. Command sent from laptop is interpreted by Arduino and sends appropriate signals to motor controller. The motor controller allows direction of the wheel rotation to be changed and supply power to the wheels both left and right. Arduino supplies 5 v to each wheels. And in the sense of direction of the wheels, its either in clockwise or anti clockwise. These can be achieved by changing the polarity of the terminals. When signal 1 is sent to these circuit, the wheel rotates clockwise and if signal 2 the wheel rotates anticlockwise. So, direction of a wheel rotation is controlled by a pair of signals. Since we have two wheels, left and right, each wheel rotation direction controlled by a pair of signal that comes from Arduino. This means we have 4 signals that comes into moto

Popular posts from this blog

Drawing Simple Pie Chart

VB.net connecting to SQL Server

VB.net