Azure provides a REST API to manage resources. If you have a specific need and don’t want to use ‘Azure-Cli‘ or their ‘Powershell module‘, you can use pure HTTP calls using their REST API. it’s platform agnostic and easy to use.
Uncategorized
Hosting SSL protected WordPress site in Google Cloud – a complete guide

This guide covers following topics:
- Setting up a WordPress vm in GCP ( Google Cloud Platform)
- Adding a bought domain to Cloudflare
- Configuring Flexible SSL with WordPress and Cloudflare
Angular2 Pagination Component with Bootstrap

I recently started learning Angular2 and I am loving it. This article describes how to create a basic pagination component using bootstrap pagination.
Automatic ListView Grouping
Lets say you have lots of data your listview. Now you want to Group This data According to a Particular Subitem.
For Example:
Suppose i have some books data in my ListView.
this listview items contains Author name and Books Title.
And there are 2000 Books in list view.
Now i want to group the data in listview according to the Authors.
Now lets say there are 50 Unique Authors , meaning we will have to create 50 Groups in listview.
this seem hectic, and i don’t know if there is any inbuilt function to automatically group this items, but i have created mine To automatically do the above.
Hope it becomes useful to someone.
public void GroupListView(ListView lstV, int SubItemIndex) { bool flag = true; foreach(ListViewItem l in lstV.Items) { string strmyGroupname = l.SubItems[SubItemIndex].Text; foreach(ListViewGroup lvg in lstV.Groups) { if (lvg.Name == strmyGroupname) { l.Group = lvg; flag = false; } } if (flag == true) { ListViewGroup lstGrp = new ListViewGroup(strmyGroupname, strmyGroupname); lstV.Groups.Add(lstGrp); l.Group = lstGrp; } flag = true; } }
How To Use The Code:
Lets say the author’s sub item’s index is 1 and listview name is LstBooks then call the function like:
GroupListView(LstBooks,1);
Vb.net Version:
Public Sub GroupListView(ByVal lstV As ListView, ByVal SubItemIndex As Int16) Dim flag As Boolean = True For Each l As ListViewItem In lstV.Items Dim strmyGroupname As String = l.SubItems(SubItemIndex).Text For Each lvg As ListViewGroup In lstV.Groups If lvg.Name = strmyGroupname Then l.Group = lvg flag = False End If Next If flag = True Then Dim lstGrp As New ListViewGroup(strmyGroupname, strmyGroupname) lstV.Groups.Add(lstGrp) l.Group = lstGrp End If flag = True Next End Sub
Output:
Auto Increment Invoice Number For Vb.net
Let’s say you have some invoice numbers which contains Alphabets as well as numeric number.
And you want to increment it one by one.
For Example:
if Invoice number is “AZ99999999” then Next Invoice Number will be “BA00000001”
Notice here that , the invoice number’s length is 10 Characters out of which first 2 are Alphabets and the rest (8) are Numeric. invoice number can be of any digit with any combination of numeric and alphabets.
The function can be changed to your need very easily. but here i will demonstrate for the above example.
Function:
Public Function IncrementInvoice(ByVal strInvoiceNumber As String) As String If strInvoiceNumber.Length <> 10 Then Return "Error" End If Dim strAlphaPart(1) As Char strAlphaPart(0) = strInvoiceNumber(0) strAlphaPart(1) = strInvoiceNumber(1) Dim IntPart As Int64 IntPart = strInvoiceNumber.Substring(2, 8) If IntPart = 99999999 Then If strAlphaPart(1) = "Z" Then strAlphaPart(0) = Chr(Asc(strAlphaPart(0)) + 1) strAlphaPart(1) = "A" IntPart = 1 Return strAlphaPart(0) & strAlphaPart(1) & IntPart.ToString.PadLeft(8, "0") Else strAlphaPart(1) = Chr(Asc(strAlphaPart(1)) + 1) End If Else IntPart += 1 Return strAlphaPart(0) & strAlphaPart(1) & IntPart.ToString.PadLeft(8, "0") End If End Function
Output:
‘outputs example:
strTemp = IncrementInvoice(“AA99999998”) ‘Output will be: “AA99999999”
strTemp = IncrementInvoice(“AA00000005”) ‘Output will be: “AA00000006”
strTemp = IncrementInvoice(“AZ00000007”) ‘Output will be: “AZ00000008”
strTemp = IncrementInvoice(“AZ99999999”) ‘Output will be: “BA00000001”
Listing Running Processes in c#.net
1. Add List box on a Forms.
2. Now add a reference to System.Diagnostics
Code:
Process[] curProcesses = Process.GetProcesses(); foreach (Process p in curProcesses) { listBox1.Items.Add(p.ProcessName); }
Output:
A simple Class for Moving Controls At Runtime
using System;
using System.Drawing;
using System.Windows.Forms;
namespace MoveControl
{
sealed class clsMoveControl
{
public enum Direction
{
Any,
Horizontal,
Vertical
}
public static void StartMoving(Control cntrl)
{
StartMoving(cntrl, Direction.Any);
}
public static void StartMoving(Control cntrl, Direction dir)
{
StartMoving(cntrl, cntrl, dir);
}
public static void StartMoving(Control cntrl, Control container, Direction dir)
{
bool Dragging = false;
Point DragStart = Point.Empty;
cntrl.MouseDown += delegate(object sender, MouseEventArgs e)
{
Dragging = true;
DragStart = new Point(e.X, e.Y);
cntrl.Capture = true;
};
cntrl.MouseUp += delegate(object sender, MouseEventArgs e)
{
Dragging = false;
cntrl.Capture = false;
};
cntrl.MouseMove += delegate(object sender, MouseEventArgs e)
{
if (Dragging)
{
if (dir != Direction.Vertical)
container.Left = Math.Max(0, e.X + container.Left - DragStart.X);
if (dir != Direction.Horizontal)
container.Top = Math.Max(0, e.Y + container.Top - DragStart.Y);
}
};
}
}
}
How to Use Example :
1. Create a simple project .
2. On the load event of the form write the following coding
clsMoveControl.StartMoving(this);
This will make the form movable by clicking anywhare on the form and dragging it.
The same can be done for other controls like:
clsMoveControl.StartMoving(Button1);
clsMoveControl.StartMoving(Panel1);
See it Live:
Trimming a String Arrary
string[] myArray = new string[6];
myArray[0] = "a";
myArray[1] = "b";
myArray[2] = " "; //space
myArray[3] = "c";
myArray[4] = ""; //null
myArray[5] = "d";
I want to remove the space and null parts from the array.
so after trimming the array should be like this:
myArray[0] = "a";
myArray[1] = "b";
myArray[2] = "c";
myArray[3] = "d";
Code:
public string[] TrimStringArray(string[] strArray)
{
int c = 0;
foreach (string str in strArray)
{
if (str != "" && str != null)
{
c++;
}
}
string[] tempArrary = new string;
int j=0;
for (int i = 0; i < strArray.Length; i++)
{
if( strArray[i] != null && strArray[i] != "")
{
tempArrary[j] = strArray[i];
j++;
}
}
return tempArrary;
}
Examle:
myArray = TrimStringArray(myArray);
Simple Wallpaper Changer
Screen:
I works fine with Windows XP and windows 7 .
Well, i wont go to deep in code here is the complete project. enjoy.
Download: Wallpaper Changer
.Net Framework 3.0 Vs 3.5 Vs 4.0 (.Net FrameWork Comparisions)
NET Framework 3.0 consists of four major new components:
- Windows Presentation Foundation (WPF), formerly code-named Avalon; a new user interface subsystem and API based on XML and vector graphics, which uses 3D computer graphics hardware and Direct3D technologies. See WPF SDK for developer articles and documentation on WPF.
- Windows Communication Foundation (WCF), formerly code-named Indigo; a service-oriented messaging system which allows programs to interoperate locally or remotely similar to web services.
- Windows Workflow Foundation (WF) allows for building of task automation and integrated transactions using workflows.
- Windows CardSpace, formerly code-named InfoCard; a software component which securely stores a person’s digital identities and provides a unified interface for choosing the identity for a particular transaction, such as logging in to a website.
Changes in 3.5 since 3.0
- New language features in C# 3.0 and VB.NET 9.0 compiler
- Adds support for expression trees and lambda methods
- Extension methods
- Expression trees to represent high-level source code at runtime.
- Anonymous types with static type inference
- Language Integrated Query (LINQ) along with its various providers
- LINQ to Objects
- LINQ to XML
- LINQ to SQL
- Paging support for ADO.NET
- ADO.NET synchronization API to synchronize local caches and server side datastores
- Asynchronous network I/O API.
- Peer-to-peer networking stack, including a managed PNRP resolver
- Managed wrappers for Windows Management Instrumentation and Active Directory APIs
- Enhanced WCF and WF runtimes, which let WCF work with POX and JSON data, and also expose WF workflows as WCF services. WCF services can be made stateful using the WF persistence model.
- Support for HTTP pipelining and syndication feeds.
- ASP.NET AJAX is included.
Key focuses for 4.0 release are:
- Parallel Extensions to improve support for parallel computing, which target multi-core or distributed systems. To this end, technologies like PLINQ (Parallel LINQ), a parallel implementation of the LINQ engine, and Task Parallel Library, which exposes parallel constructs via method calls., are included.
- New Visual Basic .NET and C# language features, such as statement lambdas, implicit line continuations, dynamic dispatch, named parameters, and optional parameters.
- Support for Code Contracts.
- Inclusion of new types to work with arbitrary-precision arithmetic (System.Numerics.BigInteger) and complex numbers (System.Numerics.Complex).
Source: wikipedia.org