Sunday, July 9, 2017

WPF with XAML and C# - Controls

Basic controls in WPF

  1.  Text Controls
  2.  Selection Controls
  3.  List Controls
  4.  Other Controls

Simple form sample with set of basic controls

section 1 of form application

section 2 of form application


section 3 of form application


section 4 of form application


Once combined above all sections together as one xaml file, it will be a wpf simple form application with set of controls.  Design view of the given application as below;


Let's discuss on Events basics with samples in next part of this series. 

WPF with XAML and C# - Layout and Panels

There are set of main layout and panels in wpf

  1. Grid
  2. Stack Panel
  3. Wrap Panel
  4. Dock Panel
  5. Canvas
Grid rows and columns 
A Grid Panel provides a flexible area which consists of rows and columns. In a Grid, child elements can be arranged in tabular form.


Design view:



Stack Panel
In stack panel, child elements can be arranged in a single line, either horizontally or vertically, based on the orientation property. It is often used whenever any kind of list is to be created.


Design View: 


Wrap Panel
Child elements are positioned in sequential order, from left to right or from top to bottom based on the orientation property. Auto Wrapping items on wrap panel when it is resizing the view.


Design View:


Dock Panel
A Dock Panel is used to dock child elements in the left, right, top, and bottom positions of the relative elements.

Design View:


Canvas
Child elements can be positioned explicitly using coordinates that are relative to the Canvas any side such as left, right, top and bottom.


Design View:


 
     Try all yourself and enjoy it . See you in next part of series.

 ( Introduction - Part 1)                                                                 (Controls - Part 3)

WPF with XAML and C# - Introduction

WPF - Windows Presentation Foundation
XAML - Extensible Application Markup Language

 WPF is used in development of windows application and also enterprise application with c#. You can be used visual studio to build wpf application.  Xaml is also used with the development of wpf application.  XAML is the language behind the visual presentation of an application that you develop in Microsoft Expression Blend, just as HTML is the language behind the visual presentation of a Web page. (What is XAML?)


 Starting with Hello world application


  1. Open Visual studio -> File -> New -> Project -> Under visual c# -> you can select WPF Application and give project name as "HelloWPF" or any name as you want.  
  2. Then it will be created two main files. one is with .xaml extension (MainWindow.xaml) and other one is with  .xaml.cs extention (MainWindow.xaml.cs)
  3. You can easily edit your xaml file with provided toolbox and properties in vs or manually editing it as appropriate way.
  4. Below is the sample screen shot of xaml file.

    This is the xaml file of Hello world wpf application


  5. Now you can run the application.  See you in next part of this series.
(Layout and Panels - Part 2)


Wednesday, July 6, 2016

Important Technical Concepts


Learning SQLite database with helpful reference links

Introduction


SQLite is a small, fast, embedded database. This database engine and interface are combined into a single library and can be stored data in a single file. There are set of features with using SQLite database.
  • SQLite has a small memory footprint and only a single library is required to access databases, making it ideal for embedded database applications.
  • SQLite has been ported to many platforms and runs even on Windows CE and Palm OS.
  • SQLite is ACID-compliant, meeting all four criteria - Atomicity, Consistency, Isolation, and Durability.
  • SQLite implements a large subset of the ANSI-92 SQL standard, including views, sub-queries and triggers.
  • No problem of extra database drivers, ODBC configuration required. Just include the library and the data file with your application.
  • SQLite has native language APIs for C/C++, PHP, Perl, Python, Tcl etc. Native API for C# is still not present.
Further more details: http://www.codeproject.com/Articles/22165/Using-SQLite-in-your-C-Application

Basic requirements working with SQLite in C#


Adding a database to your application can be an easy way to store data and settings between sessions for your program, but it is not always feasible to use a server based DBMS to store your database. SQLite is a small, fast, and reliable database which can be used without the end user having to install anything extra (achieved by referencing a single .dll in your project). There are a few things we as developers must do to get started with SQLite:
  • Install the .NET provider for SQLite from Sourceforge.net
  • Add a reference to System.Data.SQLite to your project (and mark the .dll to be copied locally to your project)
  • Optionally Download a SQLite GUI Client and use it to design your DB (Feel free to code it by hand if that is your preference)
Further more details: http://www.dreamincode.net/forums/topic/157830-using-sqlite-with-%23/

Vacuum concept in SQLite 

Vacuum concept of SQLite is getting free disk space when you delete some rows or data from your SQLite databse. The Vacuumm command rebuilds the entire database. There are several reasons an application might do this:
  • Unless SQLite is running in "auto_vacuum=FULL" mode, when a large amount of data is deleted from the database file it leaves behind empty space, or "free" database pages. This means the database file might be larger than strictly necessary. Running VACUUM to rebuild the db reclaims this space and reduces the size of the database file.
  • Frequent inserts, updates, and deletes can cause the db file to become fragmented where data for a single table or index is scattered around the database file. Running VACUUM ensures that each table and index is largely stored contiguously within the db file. In some cases, VACUUM may also reduce the number of partially filled pages in the db, reducing the size of the db file further. 
  • Normally, the db page_size and whether or not the db supports auto_vacuum must be configured before the db file is actually created.
Further more details: https://blogs.gnome.org/jnelson/2015/01/06/sqlite-vacuum-and-auto_vacuum/

Sunday, November 8, 2015

AngularJs Issues and Solutions - 1

AngularJS Issues and Solutions (working with angularjs 1.4.x)
  • Even we write AngularJS hello world sample as below, it doesn’t work.




  • It shows error and doesn’t print actual result. It happens with the version of angular you are using.
  • Earlier versions of Angular allowed the ability to assign controller functions to the global scope like you did. Then this ability was removed from angular. There are still a lot of tutorials around that reference this older style however.

Migrating from 1.2 to 1.3

Due to 3f2232b5, $controller will no longer look for controllers on window. The old behavior of looking on window for controllers was originally intended for use in examples, demos, and toy apps. We found that allowing global controller functions encouraged poor practices, so we resolved to disable this behavior by default. You can go to below link for further details.Further Details

Saturday, November 7, 2015

Getting Ready for Technical Interviews - 3

Java Constructors

It is like a method that used to initialize the instance variables of an object invoked at the time of object creation. 

  • Every constructor has either this() call or super() call as its first statement. If we don't define custom constructor then it implicitly put super() for default constructor.
  • Never be inherited and never be overridden.
  • But it can be overloaded. 
  • Normally public, default,private and protected access modifiers can be used. 
  • Constructors name same as class name. But no return type.
  • Default constructor always no argument constructor and it has same access modifier as class.

Basic Java concepts

  • Inheritance
  • Polymorphism
  • Abstraction
  • Encapsulation

Define Inheritance ?

It is the process of where one object acquires properties and behaviors of another object of another class. It represents IS_A relationship and used for code re usability and method overloading.

What is  Polymorphism ?

It short meaning is, same thing in different form. It is ability of an object to take on many forms. 

Abstraction

It means ignoring irreverent features, properties or functions and emphasizing the relevant ones. It helps to deal with creating, understanding and managing complex systems. 

Encapsulation

Enclosing proper attributes and methods inside a single class. Benefits of encapsulation are given below.
  • Ability to modify our implemented code without breaking the code of others who use our code.
  • Maintainability
  • Flexibility
  • Extensible ability of our code 

Previous    

Getting Ready for Technical Interviews - 2

Today I am going to continue previous post (Getting Ready for Technical Interviews - 1) by adding more key areas related to technical interviews.

Debugging 

Programming errors called bugs. The process of tracking bugs down and correcting them is called debugging.

Why java is called platform independent ? 

Because translating a program into byte code instead of machine code. So it makes easier to run a program in a wide variety of environments, because only JVM needs ti be implemented for each platform. Although the details of the JVM will differ from platform to platform, all understand the same java byte code.

What do you mean by platform independent ?

We can write and compile the java source code in one platform (e.g. Windows) and can execute the class file in any other supported platform (e.g. Linux, Solaris etc)

Pointers

It is a reference which can be used to handle a memory location. Improper handling of pointers leads to memory leaks and reliability issues. Hence java doesn't support the usage of pointers.

Base class of all java classes ?

java.lang.Object

Just-In-Time Compiler (JIT) with java

It is used to improve the performance. JIT compiles parts of the byte code that have similar functionality at the same time and hence reduces the amount of time needed for compilation.

Previous                                                                                         Next