Author: admin

Configuration Manager for SqlConnection

Reading Time: 2 minutesIn this tutorial, it is explained how to use Configuration Manager for SqlConnection. Firstly, we need to add Configuration Manager as reference to the project. Choose System.Configuration Use namespace using System.Configuration; Then we are ready to use Configuration Manager for

Tagged with: ,

Entity Framework Code First Example

Reading Time: 3 minutesIn this tutorial, Entity Framework code first example is given. We will continue from previous post and heaving code already we will make the database. This is actually the point of Entity Framework code first concept: to have classes in

Tagged with:

Basic Entity Framework C#

Reading Time: 2 minutesIn this tutorial, Basic Entity Framework C# is explained with no database, code first. To make it simple, we will prepare it as console application. We need to add reference from NuGet package. So, click on References folder and Manage

Tagged with: ,

Basic WCF Service C#

Reading Time: 2 minutesThis post explains Basic WCF Service C#. Let’s start with WCF service library Then, to existing solution add new project Choose Windows forms application Now, we need to add reference to this new Windows forms application Choose in Projects ->

Tagged with:

backgroundWorker Code Example for Cancel Button in C#

Reading Time: 2 minutesIn C#, backgroundWorker object is used to make program cancellation without blocking UI. In here, we will make Code Example for Cancel Button in C#. In your windows forms application, use backgroundWorker object. Once when backgroundWorker component is added to

Tagged with: ,

Browse SQLite Database Data at Glance

Reading Time: 2 minutesLet’s make new button that will show all SQLite database data at glance in the toast. Then, add method in MySQLiteAdapter class: Good habit in accessing the data in SQLite database is to find column indexes first, and then to

Tagged with:

Android See SQLite database content

Reading Time: 2 minutesOnce we have created our database in android SQLite, we would like to see SQLite database content. For that purpose, we need to start our application in the emulator (virtual device). Then we need tool Android Device Monitor Choose your

Tagged with: ,

Android SQLite Example

Reading Time: 5 minutesAndroid SQLite is Android database and it is very useful tool for local data storage. Later, stored data can be synchronized with other, larger database. When we deal with the databases, it is always useful to have additional class that

Tagged with: ,

Android Dynamically Change Fragment

Reading Time: 3 minutesWe have explained in previous tutorial how to add resource layout so that application is self-aware for smart device orientation change. Next step is to do the same thing but not with resource folder but dynamically. So android dynamically change

Tagged with: ,

Android Adding Alternate Layout Resource Folder

Reading Time: 3 minutesResponsive design in android programming should have answer on mobile device orientation change from horizontal to vertical (portrait to landscape) and vice versa. In that sense, it is useful to know android adding alternate layout resource folder. So let’s start

Tagged with: ,

Android Fragment Communication onSaveInstanceState

Reading Time: 2 minutesIn this tutorial we cover android fragment communication onSaveInstanceState. Point is to save counted number in the fragment and reuse it again when mobile device is rotated. Starting from previous example, add in “Upper” fragment onSaveInstanceState method. Now, add more

Tagged with:

Android Interface Class for Fragment Communication

Reading Time: 4 minutesAndroid Interface class is the best practice for fragment communication. If we want to make two fragments to communicate, we must put some effort to avoid coupling. If one fragment have reference to another, and call it directly, this situation

Tagged with: ,

Android Inter Fragment Communication

Reading Time: 3 minutesIn this tutorial android inter fragment communication is explained. Fragments in android are utilized to fully use screen area of the mobile device.  Our final target is to make an application that will have one fragment in the activity at

Tagged with: ,

Android Scrollview Example

Reading Time: 2 minutesIf you want to go beyond helloworld application, you need to learn to use Android Scrollview layout. In this tutorial we have Android scrollview example. Let’s start with new blank activity project. In the new blank activity project default layout

Tagged with: ,

Android Orientation Changes

Reading Time: 3 minutesWhen user of Android mobile devices changes its orientation in some situations we need to handle Android orientation changes programmatically. So here is how to handle runtime changes. In your brand new application, make changes in your manifest first. app→manifests→AndroidManifest.xml

Tagged with: ,

Biginteger class C#

Reading Time: 1 minuteBiginteger class C# allows us to handle really large integer numbers, much larger then standard int. In order to use it, namespace System.Numerics has  to be included in the current project. In order to include namespace System.Numerics, just click as

Tagged with: , ,

use FragmentManager class

Reading Time: 3 minutesThe most appropriate way to handle Fragments in Android is to use FragmentManager class. Using fragments in Android programming is very useful advanced concept and benefits from it are: Dynamic and flexible user interface. Reusable views. Manage different screen resolutions.

Tagged with: ,

Activity as Container for Fragments

Reading Time: 2 minutesGood practice in Android programming is to use Activity merely as a container and use Fragments for ALL UI elements, including the button you are clicking to change between them. For this purpose read as introduction.  Now, start new blank

Tagged with: ,

Introduce fragment from activity in android

Reading Time: 3 minutesConcept of the fragment is new ‘quantum leap’ in Android programming. But before you start to run, you must learn how to walk first. So, we will start to introduce fragment from activity. We will remake our greatest common divisor

Tagged with: ,

Volley git clone installation

Reading Time: 2 minutesYou suppose to have started your Android studio project, and then, you need to do volley git clone installation. To do so, make an empty folder, go there and in cmd mode type following command: git clone Then you

Tagged with:

git push origin master

Reading Time: 2 minutesIn order to push your source code, go into root folder of your project and start with the following command: git add . Then we must do commit with git commit -m “your comment” Result of commit is given in

Tagged with: , , ,

ListView with Images and Text

Reading Time: 5 minutesIn this tutorial it is explained how to insert ListView with Images and Text in Android app. ListView with Images and Text is very handy user interface for Android app. First, let’s add ListView container in content_main.xml. So we have

Tagged with: ,

FrameLayout in Android studio

Reading Time: 2 minutesFrameLayout in Android studio is an interesting layout option in Android studio. Mayor difference between frame layout on one side and Relative and Linear Layout on the other side is that FrameLayout allows widgets to flow one over another. With

Tagged with: , ,

Usage of Android Studio Debugger

Reading Time: 2 minutesBefore starting with new advanced topics in Android Studio, let’s learn usage of Android Studio debugger first. For example, if we want to add onClick method for some button, we can do it by open corresponding xml file (content_main.xml for

Tagged with: , ,

Pass a String from one Activity to another in Android

Reading Time: 1 minuteThis article is about how to pass a string from one activity to another in Android studio. This action doesn’t require any changes in layout or manifest. Code in the button in activity that send string is as follows: String

Tagged with:

Android studio Get Google Maps street name

Reading Time: 1 minuteThis article is continuation of previous first Google maps activity. In there, we were put pointer on the map in the position where given city is located. In here, we will obtain user current position, and in Android studio get

Tagged with: ,

First Google Maps Activity

Reading Time: 4 minutesThis article is about how to make your first Google maps activity, and inside it how to surround with try/catch some piece of code, how to handle permission exception, and how to add LinearLayout for fragment. Start new project in

Tagged with: , , ,

Upgrade API level for developer in android studio

Reading Time: 1 minuteUpgrade API level for developer in android studio is very useful feature when you want to add new functionality to some older application. Fortunately, in modern Android studio (version 1.4 or higher) it is really simple.  Just do right click

Tagged with:

Obtain Google api key maps

Reading Time: 2 minutesBefore proceeding to make your first Android Studio Google maps application, you must obtain Google api key maps first. So, for Google Maps Android API, in Android studio, go to: Tools→Android→SDK Manager Then click on Launch Standalone SDK Manager See

Tagged with:

Add Module in Android Studio

Reading Time: 1 minuteIf we want to add module in android Studio, we need to do following steps: Click on File→new→New Module… Then choose “Android Library” Then choose minimum SDK for new module That’s it!

Tagged with:

Use Camera in Android Studio

Reading Time: 2 minutesThere are many in-built functionalities in Android mobile devices. In this tutorial it is explained how to use camera in android studio. Once one activity using camera is added to main project, go to main java project for this activity

Tagged with: ,

Noise Generator in C#

Reading Time: 2 minutesActually random generator in C# is so good, that we don’t need additional algorithms to make noise generator in C#. On the other hand, it is useful to have efficient algorithm to generate noise, not necessarily in visual studio. In

Tagged with:

FinancialFormula Forecasting in MSChart C#

Reading Time: 2 minutesMSChart control is very powerful tool for data display and analyzing. One very powerful feature is FinancialFormula Forecasting in MSChart C#. We can, for example,  model data with Linear Regression by using FinancialFormula Forecasting. Here is an example: chart1.Series.Clear(); chart1.Series.Add(“Over

Tagged with: ,

Convert Arraylist Into Array in C#

Reading Time: 1 minuteWhy and when we need to convert arraylist into array in C#? If we have some data in RAM memory (arraylists) and want to sort the data in one arraylist by another arraylist (they have to be the same size),

Tagged with: ,

Using mschart C#

Reading Time: 2 minutesThere are variety of possibilities to display data graphically if we know how to use ms chart control in C#. So using mschart in C# will be explained with mschart example in C#. We need to include namespace for using

Tagged with: , ,

Convert Datetime to int c#

Reading Time: 1 minuteWe need to convert datetime to int in c# for example when we want to add new series of the data in chart control to previously added series of data where x axis was given in datetime format. If in

Tagged with:

Add a Second Activity using Intent in Android Studio

Reading Time: 3 minutesWhen you want to add a second activity in Android Studio, perhaps best way is to do it by using Intent class. Once when you made your first android app as single activity apk, next natural thing is that you

Tagged with: ,

Keyword out and code examples in C#

Reading Time: 1 minuteBoth keyword ref and keyword out in C# change the behavior of called method parameters. The difference is that the parameter passed as ref must be initialized before passing to the method. Parameter passed with keyword out in C# needs

Tagged with: ,

Ohms law calculator

Reading Time: 1 minuteTo use Ohms law calculator, enter two magnitudes of three (voltage, resistance or current) and click calculate button to calculate remaining magnitude VCC: V R: Ω I: A Calculate Read about Ohm’s law

Ohm’s law formula

Reading Time: 2 minutesGo to Ohm’s law calculator. Ohm’s law define current magnitude of the current that flows through out resistor like one given in figure bellow (Ohm’s law circuit). So current through resistor R, according to Ohm’s law formula is This form

Tagged with: , , , ,

Open Macro in Excel 2013

Reading Time: 1 minuteThis is just an brief instruction how to open macro in excel 2013. First go to File→Options Then click on Customize Ribbon and enable Developer option. Now developer option will appear in the excel 2013 toolbar. Then we can reduce

Tagged with: ,

Current Divider Calculator

Reading Time: 1 minuteTo use current divider calculator, enter input current, R1 and R2 and calculate currents through R1 and R2 IIN: A R1: Ω R2: Ω I1: A I2: A Calculate Read about current divider

Tagged with:

Current Divider Formula

Reading Time: 2 minutesGo to current divider calculator. Current divider is actually two resistors connected in parallel. Now, if we know input current and R1 and R2 resistor value, we can calculate how input current will split up, i.e. how much are I1

Tagged with: ,

Add Picture to Android App

Reading Time: 1 minuteWhen you want to add picture to android app, you need to insert ImageView widget first. Now, prepare your picture in PNG format (recommended size should be inside dimension of 80X80 pixels). Then paste it into app→src→main→res→drawable. Note: your PNG

Voltage Divider Calculator

Reading Time: 1 minuteTo use voltage divider calculator, enter input voltage, R1 and R2 and calculate output voltage. VCC: V R1: Ω R2: Ω VOUT: V Calculate Read about voltage divider Check your calculation on the other site.

Tagged with:

Voltage Divider Formula

Reading Time: 2 minutesGo to voltage divider online calculator. Voltage divider is actually two resistors connected in series. Now, if we know VCC and R1 and R2 resistor value, there is a question, how much is VOUT? By intuition, if R1=R2 then VOUT

Tagged with: ,

Publish Android App on Google Play

Reading Time: 2 minutesYour Android app is functional and ready. What to do next? You need to publish android app on Google play. So, click on your android building variants button. Then go to build variants and switch from debug to release. At

Add Link into Android App

Reading Time: 3 minutesOnce when you made your initial application with AdMob in it you need to put some functionality to it. If we make application for calculation of greatest common divisor, we can put in app→res→layout→activity_main.xml (design view) some large text widgets,

Your First Android App with AdMob

Reading Time: 3 minutesIf you start to develop your first android application in Android Studio or in any other programming tool, you would like to have some benefit from it. The best way to achieve this is to add Google AdMob into your

Initial Steps in Android Programming

Reading Time: 3 minutesInitial Steps in Android Programming are following: We need to install Java JDK first. Next step is to do android studio installation. But even on this early step, problems might appear, see the figure bellow. So we need to set

Keyword ref and code examples in C#

Reading Time: 1 minuteKeyword ref in C# forces an argument to be passed to the method to be passed by reference. It means that argument must be initialized before it is passed to the method. It also means that any change in the

Least common multiple calculator

Reading Time: 1 minuteEnter integer numbers and calculate least common multiple. N:   M:  LCM:  Calculate Read how least common multiple can be calculated in C#

Least common multiple in C#

Reading Time: 1 minuteCalculate least common multiple Least common multiple is the smallest positive integer that is divisible by both a and b. Now, if we know greatest common divisor of two positive, greater then zero integers a and b, we can calculate

Greatest common divisor calculator

Reading Time: 1 minuteEnter integer numbers and calculate greatest common divisor. N:   M:  GCD:  Calculate Read how greatest common divisor can be calculated in C#

Tagged with: ,

Greatest common divisor code in C#

Reading Time: 1 minuteGreatest common divisor of two positive integer numbers N and M, both larger then zero is the largest integer R that divide both N and M. If for given N and M, greatest common divisor is 1, we say that

Tagged with: ,

Serial R-C circuit impedance

Reading Time: 1 minuteGo to Serial R-C circuit impedance calculator Serial R-C circuit is given in figure bellow In the stationary regime, we can use complex impedance for capacitor and R for resistor. So final expression for serial R-C circuit impedance It is

Parallel R-C circuit impedance

Reading Time: 2 minutesGo to Parallel R-C circuit impedance calculator Parallel R-C circuit is given in figure bellow In the stationary regime, we can use complex impedance for capacitor and R for resistor. Parallel R-C impedance is So final expression for parallel R-C


Reading Time: 1 minuteIn this page, DC DC Converters online simulator is given for following DC DC converters: Boost or Step Up Converter Buck or Step Down Converter Buck-Boost Converter Flyback DC-DC Converter Forward DC-DC Converter


Reading Time: 3 minutesFirst functionality of methods in binary search tree class is to count nodes of binary search tree recursively and to measure binary search tree height. Taking the data from previous example, and starting with following array { 53, 72, 14,


Reading Time: 2 minutesMajor property of the binary search tree is self-similarity (every leaf can be root for another smaller binary search tree). For that reason, in BST we can use recursive functions to find or count the data. Searching through BST is


Reading Time: 3 minutesTime complexity is the important term in sense of how many steps has to be taken in order to complete given algorithm. In order to describe complexity, big O notation is used. For example, linear complexity is expressed in big


Reading Time: 1 minuteLINQ OrderBy operator we use to sort data in LINQ query. With using lambda expression (=>) example is follows: int[] nums = new int[] { 0, 4, 2, 6, 3, 8, 3, 1 }; var result1 = nums.Where(n => n


Reading Time: 1 minuteLINQ restriction operator where is very useful when we want to filter or restrict some data. For example, if we want to filter all numbers higher or equal 3 by using LINQ restriction operator where here is an example: int[]


Reading Time: 1 minuteLINQ Let clause i.e. LINQ Let Keyword is a part of a query expression. Let clause allows LINQ query expression to be more readable and code to be shorter and easier to understand. Let also introduces variable that can be


Reading Time: 1 minuteIn this article, we have LINQ example of usage of join operator in C#. Perhaps, the easiest way to explain usage of join operator in C# is by example. In first example we have two arrays of double type. Now,


Reading Time: 1 minuteIf we want to use LINQ Set Operators in C#, then set operations such as union, intersection and except are really one line of code. Take a look at following examples. Intersection: int[] set1 = { 1, 2, 3, 5


Reading Time: 1 minuteIf we have an array of strings, with people names for example and would like to display them in some arbitrary order given in another array of integers, we can manipulate two arrays with LINQ in C#. Here is LINQ


Reading Time: 1 minuteStack data structure is a LIFO collection and is a generic type. It exist in C#, and it is defined in namespace: using System.Collections.Generic; It can be declared as follows: Stack<int> stack = new Stack<int>(); and as any stack it


Reading Time: 1 minuteIf we use LINQ query, we can count distinct elements in array in C# by following command: int[] a = { 0,0,1,7,17,1,2,2,3 }; int count = a.Distinct().Count(); The other way to count distinct elements in array in C# if array


Reading Time: 4 minutesLINQ in C# stands for Language Integrated Query. It is brilliant programming concept implemented in C# programming language to virtualizes underlying data source. This means, that for example we can apply linq query on XML document in C# as easy


Reading Time: 2 minutesSending data over http in C# is easy if we use HttpWebRequest and WebResponse classes. Once when we have our data in json format ready for sending, we can send json text over http in C#. We need to make


Reading Time: 2 minutesTo read XML file in C# or to write XML file in C# it is best to use System.Xml namespace. Namespace System.Xml.Linq; is also useful for this purpose. Now, to write XML file, we need one object of XmlWriterSettings class.


Reading Time: 1 minuteIn previous article we discussed how to convert XML data to json format. Converting in opposite direction is as just as simple. So to convert json to XML in C# let’s assume that we have data in json format are


Reading Time: 3 minutesTo get data from Excel in C# or to insert data into Excel in C#, we need to open Excel doc in C# first. There are two ways to access Excel data in C#, either To use Microsoft.Office.Interop.Excel.dll namespace or

Creating ms access database from excel worksheet

Reading Time: 2 minutesIn this tutorial it is explained how to create MS Access database from excel worksheet. First, we need to create new MS Access database. We need to give full path and type name of new database. And then, click “Create”.


Reading Time: 3 minutesIf XML data are small in structure, there is a way to convert XML to json in C# by knowing how to serialize dictionary to json in C#. We need to use using System.Web.Script.Serialization; namespace. It has to be added


Reading Time: 2 minutesScraping data in C# is easy using HtmlAgilityPack. In this short tutorial we will focus on how to select Nodes and Subnodes with HtmlAgilityPack. In this project, we need to download htmlagilitypack.dll. Next step is to add reference, like for


Reading Time: 1 minuteTo handle MS Office documents from C# it is essential to add assembly to your C# project. Reference for handling MS Office documents is in So you need to download this dll file first. Next step is to add


Reading Time: 3 minutesIn order to make a dll file from C#, first step is to start creating class library .dll project (see figure bellow). Rest of the job is similar to writing down any other C# class, but we need to take


Reading Time: 1 minuteMaking all permutation of the given set of characters is most time effective if it is done with Heap’s algorithm. C# program for permutation with recursive function call in according to Heap’s algorithm is presented. First thing that we need


Reading Time: 1 minuteTo use paralleling of the treads in C#, we need to use System.Threading.Tasks; namespace. There are several ways to parallelize threads, including usage of PLINQ. In here, for educational purpose most simple c# parallel threading example as console application is


Reading Time: 1 minuteC# md5 hash code can be easily obtained by using following namespaces: System.Security.Cryptography; System.Globalization; System.IO; If we want to calculate md5 hash that is 32 characters long string of any input for simple string, we can do it with just


Reading Time: 2 minutesKnowing C# basic string methods can be very useful and time saving. In this article, we will use some of C# basic string methods in order to appropriately parse large string for crc bytes calculus. For that purpose, it is


Reading Time: 2 minutesRead also C# crc checksum class C# crc checksum code for binary files C# crc checksum code for MODBUS RTU CRC computation is the method for error detection in sending/receiving binary data. It is different from error auto correction, but


Reading Time: 3 minutesC# event handler for serial communication is equivalent to interrupt concept. When data arrives from outside world into serial port buffer, interrupt signal is generated. To make application that uses serial communication with event handler in c#, it is practical


Reading Time: 3 minutesModbus is serial communication protocol. It is widely spread in industry and mainly is used to connect master communication device (usually PC) to remote terminal unit (RTU). Information package from master to slave device in MODBUS protocol has following format


Reading Time: 2 minutesA cyclic redundancy check (CRC) is an error-detecting code. In this article, C# crc checksum code for binary files is given. For 16 bit CRC calculus for binary files, first step is to have all of the data (all of


Reading Time: 1 minuteWhen there is a need to program databases in C# we can access given database either by Using SqlConnection and SqlCommand class or by using ODBC connection. ODBC – Open Database Connectivity is Microsoft interface for accessing database management systems


Reading Time: 2 minutesIn order to access binary file from C# it is comfortable to use OpenFileDialog class. To handle binary, either to read binary file or to write to binary file in C#, we need to use System.IO namespace. Inside System.IO namespace


Reading Time: 2 minutesC sharp application uses timer whenever is necessary for application to regularly control something in equal time intervals, from reading the system clock to communicate with firmware via serial communication. Timer tick function must do the regular task every time


Reading Time: 3 minutesMaking Multiple-Document Interface (MDI) in C# is your next big step towards professional programming. Any good windows forms application has to have multi functionality, i.e. many child forms that should be accessible from parent form by using menu. Actually, every


Reading Time: 1 minuteEasier way to connect to database is C# odbc conncetion to database In this tutorial c sharp SQL like command for search is explained, i.e. how to search similar data with SQL query command like from C#. We continue from


Reading Time: 1 minuteEasier way to connect to database is C# odbc conncetion to database In this tutorial c sharp SQL delete command is explained, i.e. how to delete data with SQL query from C#. We continue from initial database tutorial. C sharp


Reading Time: 1 minuteEasier way to connect to database is C# odbc conncetion to database In this tutorial c sharp SQL retrieve data is explained, i.e. to retrieve data with SQL query from C#. We continue from initial database tutorial. private void clear_all_fields()


Reading Time: 1 minuteEasier way to connect to database is C# odbc conncetion to database In this tutorial c sharp SQL retrieve data is explained, i.e. to retrieve data with SQL query from C#. We continue from initial database tutorial. private void clear_all_fields()


Reading Time: 2 minutesEasier way to connect to database is C# odbc conncetion to database In this tutorial C Sharp SQL Insert command is explained, i.e. how SQL Insert Command is implemented in C#. We continue from previous example. string str_sql_insert = ”


Reading Time: 2 minutesEasier way to access database from C# is to Connect to database via odbc connection If we connect to databases in C# directly, two additional namespaces are necessary: using System.Data.SqlClient; using System.Collections; In our C# program, we need to use


Reading Time: 2 minutesThis example is for Microsoft SQL Server 2008 database connection. First step is to make right click in Solution Explorer and Add->New Item… Then, choose Service-based Database. Choose a Database Model. Choose your Database Object. Once when Data Connection is


Reading Time: 1 minuteC sharp tab control is control from TabControl Class. C sharp tab control is the part of C# Containers Toolbox. Once when it is added to Windows form, additional tabs can be added as collection. We can add two more


Reading Time: 2 minutesC sharp menuStrip and c sharp OpenFileDialog are visual controls in C# for adding application menu items and opening files, respectively. C sharp menuStrip is the part of C# Menus & Toolbars Toolbox. C sharp OpenFileDialog is the part of