A Developer Journey who codes for fun

Daily Dose Of Code

  • Home
  • Dot.Net Basics
    • .Net Basics
      • CTS
      • CLS
      • CLR
      • Strong Vs Weak Ref
      • .Net Framework
      • What is Manifest
    • Memory Management
      • Garbage Collection 1
      • Garbage Collection 2
      • Circular Reference
  • C Sharp
    • Abstract Class in C#
    • Interfaces in C#
    • Value type by Val and By Ref
    • Var keyword
    • Null Coalescing Operator
    • Buit-in code snippets
  • OOPS
    • Abstraction and Encapsulation
    • Polymorphism
    • Inheritence
    • Aggregation
  • Threading
    • Delegates
      • Calling Delegate using Invoke, BeginInvoke
      • Multicast Delegate
      • Exception Handling in Multicast Delegate
      • Action
      • Predicate
      • Func
    • Synchronization
    • Thread Pool
    • Exception Handling
    • TPL
  • Design Pattern
    • Creational Patterns
      • Singleton Pattern
      • Factory Pattern
      • Abstract Factory Pattern
      • Prototype Pattern
      • Builder Pattern
    • Structural Patterns
      • Adapter Pattern
      • Bridge Pattern
      • Composite Pattern
      • Proxy Pattern
      • Facade Pattern
      • Decorator Pattern
      • Flyweight Pattern
    • Behavioral Patterns
      • Command Pattern
      • Interpreter Pattern
      • Iterator Pattern
      • Mediator Pattern
      • Memento Pattern
      • Observer Pattern
      • State Pattern
      • Strategy Pattern
      • Visitor Pattern
      • Chain Of Responsibility Pattern
      • Template Pattern
  • Data Structures
    • Generic List in C#
    • 2d array to 1d array
    • 3d arrayto 1d array
    • Linked List
      • Singly Linked List in C#
    • Queue
      • Dummy Data 1
    • Stack
      • Dummy Data 2
    • Tree
      • Dummy Data 3
    • Graph
      • Dummy Data 4
  • WCF
    • WCF Service using VS 2015
  • Scripts
    • Chrome Extensions
      • Create a Chrome Extension
      • Facebook autologout script
      • Gmail autologout script

Singleton Class Uses and Drawbacks

 Unknown     11:42 PM     Happy to code     No comments   

Singleton :-Singleton is controversial design pattern of OOPS. It allows you to restrict the number of instances of an object.It's an interface that allows a class to enforce that it is only allocated once. Sample Code :-Namespace :-using system.text;using System.collections;class SampleProgram{ public static void Main() { SingletonStructure...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to read XML Node using C#

 Unknown     1:53 PM     No comments   

Load an XML FileXmlDocument xdXml = new XmlDocument();xdXml.Load("Index.xml"); Make a nodelist XmlNodeList xnNodes = xdXml.SelectNodes("/Tools/Download"); Walk through the list foreach (XmlNode node in xnNodes) { if (node.FirstChild.InnerText == ddlTools.Text) { //Get all the child nodes XmlNodeList childNodes = node.ChildNodes;...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Transparent images not displaying correctly

 Unknown     1:27 PM     No comments   

If images are not displaying correctly or showing a black spot at the back side of the image then play with the color depth property of imagelist or picture box.Example :- ImageList imageList = new ImageList();imagelist.colorDepth = colorDepth.32B...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to make Regular Expressions

 Unknown     12:26 PM     Enjoy..coding     No comments   

If you want to learn how to make regular expressions then visit this link this will be helpful for you...http://www.zytrax.com/tech/web/regex....
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Collection of Regular Expressions

 Unknown     11:35 AM     1 comment   

Regular expression to match email address1 :- [\w-]+@([\w-]+\.)+[\w-]+2 :- (?(?![ ])(\w|[.])*@(\w|[.])*)3 :- ^[\w\.=-]+@[\w\.-]+\.[\w]{2,3}$4 :- /(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@ ([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/iRegular Expression to validate US-Phone number.Example :- (999) 999-9999 or (999)123-78691 :- /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/Regular...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to make Recycle - Bin in .net using C#

 Unknown     11:08 AM     No comments   

Visit this article and make your recycle binhttp://www.codeproject.com/KB/shell/recyclebin.a...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Detect the Encoding Type of given file

 Unknown     10:43 AM     No comments   

Encoding type : To add new Encoding we have to add new member in here,with the CodePage value as an value of the new encoding and have to modify FileHandler.DetectEncoding function.public enum EncodingType{ WindowsANSI = 1252, Unicode = 1200, UnixANSI = 28591}You can pass the path of the file and this method returns the encoding...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Sorted List Implementation

 Unknown     10:35 AM     No comments   

In C# You can implement Sortedlist and sort the values according to the key.using System;using System.Collections;Code:static void Main(string[] args){ values in sorted list are sorted according to key SortedList myList = new SortedList(); myList.Add(12, "December"); myList.Add(9, "September"); myList.Add(10, "October"); ...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Hash Table Implementation

 Unknown     10:28 AM     No comments   

using System;using System.Collections; Code:static void Main(string[] args){ Create an object of hash table Hashtable myHash = new Hashtable(); Add key-pair values myHash.Add("Saurabh", 1); myHash.Add("Sandy", 2); myHash.Add("Vivek", 3); Move through hashtable data in cycle foreach (DictionaryEntry item in myHash)...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Get System Boot Configuration using C#

 Unknown     10:22 AM     No comments   

using System;using System.Management; Code:static void Main(string[] args){ WqlObjectQuery query = new WqlObjectQuery("SELECT * FROM Win32_BootConfiguration"); ManagementObjectSearcher find = new ManagementObjectSearcher(query); foreach (ManagementObject mo in find.Get()) { Console.WriteLine("Boot directory with files...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Get Environment variables..

 Unknown     10:17 AM     No comments   

Namespaces:using System;using System.Management;Code:static void Main(string[] args){ WqlObjectQuery query = new WqlObjectQuery("Select * from Win32_Environment"); ManagementObjectSearcher find = new ManagementObjectSearcher(query); Console.WriteLine("Description - Name - User Name - Value"); foreach (ManagementObject mo...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Obtain IP address and host

 Unknown     6:40 AM     No comments   

Namespaces:using System;using System.Net; Code:static void Main(string[] args){ Get Host Name string host = Dns.GetHostName(); Console.WriteLine("Hostname is: {0}", host); GetIP Entry IPHostEntry entry = Dns.GetHostByName(host); foreach (IPAddress ip in entry.AddressList) { Console.WriteLine("IP...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Send mail message to .net Environment (Enjoy Mail System)

 Unknown     6:36 AM     No comments   

Namespaces:using System;using System.Web.Mail; Code:static void Main(string[] args){ MailMessage mailMsg = new MailMessage(); mailMsg.From = "saurabhsingh_jnu06@yahoo.co.in"; mailMsg.To = "saurabhjnumca@gmail.com"; mailMsg.Cc = string.Empty; mailMsg.Bcc = string.Empty; mailMsg.Subject = "Here goes a subject"; mailMsg.Body...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Network Operations in C# (Play with system)

 Unknown     6:23 AM     No comments   

Retrieve DNS computer namepublic static void Main(string[] args){ Console.WriteLine(“DNS: {0}”, System.Net.Dns.GetHostByName“LocalHost”).HostName);}Retrieve NetBIOS computer namepublic static void Main(string[] args){ Console.WriteLine(“NetBIOS: {0}”, System.Environment.MachineName...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

To get the system Icons(handle of system imagelist)

 Unknown     6:12 AM     No comments   

[StructLayout(LayoutKind.Sequential)] public struct SHFILEINFO { public IntPtr hIcon; public IntPtr iIcon; public uint dwAttributes; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szDisplayName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] ...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

To close the application from task manager.

 Unknown     6:08 AM     No comments   

If you have closed your appplication but still it runs in task manager then you can use this method to kill the thread.It happens only when some thread of your application is not closed.Code:-public const int SC_CLOSE = 0xF060; public const int WM_SYSCOMMAND = 0x0112; //Override method when You will close the windowprotected override void WndProc(ref...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Play with Date-Time-Formats in C#

 Unknown     5:52 AM     No comments   

Code:public static void Main(string[] args){ //Get the cureent date time DateTime datetTime= DateTime.Now; Formatting DateTime to full pattern (dddd, MMMM dd, yyyy hh:mm:ss) Console.WriteLine(dt.ToString("F")); Formatting DateTime to short date- time pattern (dddd, MMMM dd, yyyy, hh:mm) Console.WriteLine(dt.ToString("f")); ...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to get Memory Info

 Unknown     5:45 AM     No comments   

Namespaces:using System;using System.Management; Code:static void Main(string[] args){ WqlObjectQuery query = new WqlObjectQuery("SELECT * FROM Win32_PerfFormattedData_PerfOS_Memory"); ManagementObjectSearcher find = new ManagementObjectSearcher(query); //Traverse each management object. foreach (ManagementObject mo in find.Get())...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Open Control Panel Items using Shell (COM)

 Unknown     5:39 AM     No comments   

Namespaces:using System;// this is COM component that can be found under the name "Microsoft Shell Controls And Automation"// this must be added to project referencesusing Shell32;Code:static void Main(){ //Creating an object of shell to access all the control panel items. Shell shell = new Shell(); // accessibility options shell.ControlPanelItem("access.cpl");...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Get folder items using Windows folder dialog

 Unknown     5:30 AM     No comments   

Namespaces: using System; using Shell32; Code:static void Main(){ Shell shell = new Shell(); // open dialog for desktop folder // use appropriate constant for folder type ShellSpecialFolderConstants Folder folder = shell.BrowseForFolder(0, "folderPath/FilePath",0 ,ShellSpecialFolderConstants.ssfDESKTOP);...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

About The Author

Unknown
View my complete profile

Total Pageviews

Popular Posts

  • Clr - Common Language Runtime
    .Net framework provides a run time environment - CLR. Common language runtime takes the IL code from the compiler( language specific) and p...
  • Auto logout chrome extension for Gmail
    Hello Friends, In the last article we learned to create a sample chrome extension. Here we are going to create auto logout Gmail script as...
  • Predicate delegate in C#
    Hello Everyone, In the article we will talk about Predicate delegate. Predicate is also a delegate which encapsulate a method that takes...
  • .Net Framework overview
    Hello friends : Here i am writing my first article on .Net framework anyways....So the question is What is .Net Framework ? The .Net fram...
  • Nagarro Placement Papers..
    Ques.1 :- Seat Reservation prog for the theatre. Write a function for seat allocation for the movie tickets. Total no of seats available are...
  • What does it mean by disconnected data access architecture of ADO.Net?
    ADO.Net introduces the concept of disconnected data architecture. In traditional data access components, you make a connection to the databa...
  • Calling the Delegates using Invoke(), BeginInvoke() and DynamicInvoke() ?
    Hello Guys, So in the last article we talked about What is delegate and how can we create a delegate. In this article we will discuss w...
  • C code to Check the string has valid identifier or not in.
    #include #include #include char keyword[][10]={"auto","break","case","char","const","...
  • Garbage Collection - Automatic Memory Management Part II
    Welcome friends in the second article of Garbage Collection. Those who have missed the first one can visit here . So in this article i will...
  • Delegates in C Sharp
    A Delegate is a type variable that holds the reference to a method. Delegates are similar to Pointer to functions in C and C++ When we...

Blog Archive

  • ►  2016 (4)
    • ►  September (2)
      • ►  Sep 03 (2)
    • ►  August (1)
      • ►  Aug 28 (1)
    • ►  April (1)
      • ►  Apr 24 (1)
  • ►  2015 (12)
    • ►  September (10)
      • ►  Sep 30 (1)
      • ►  Sep 29 (1)
      • ►  Sep 28 (1)
      • ►  Sep 27 (2)
      • ►  Sep 26 (3)
      • ►  Sep 20 (1)
      • ►  Sep 19 (1)
    • ►  August (1)
      • ►  Aug 16 (1)
    • ►  March (1)
      • ►  Mar 31 (1)
  • ►  2013 (10)
    • ►  June (1)
      • ►  Jun 16 (1)
    • ►  April (1)
      • ►  Apr 21 (1)
    • ►  February (8)
      • ►  Feb 18 (3)
      • ►  Feb 17 (2)
      • ►  Feb 16 (2)
      • ►  Feb 15 (1)
  • ►  2012 (1)
    • ►  May (1)
      • ►  May 27 (1)
  • ►  2010 (22)
    • ►  October (14)
      • ►  Oct 21 (1)
      • ►  Oct 06 (12)
      • ►  Oct 04 (1)
    • ►  April (2)
      • ►  Apr 22 (1)
      • ►  Apr 16 (1)
    • ►  March (1)
      • ►  Mar 30 (1)
    • ►  January (5)
      • ►  Jan 08 (3)
      • ►  Jan 01 (2)
  • ▼  2009 (110)
    • ►  December (8)
      • ►  Dec 18 (2)
      • ►  Dec 05 (1)
      • ►  Dec 04 (5)
    • ►  November (1)
      • ►  Nov 27 (1)
    • ►  October (14)
      • ►  Oct 09 (4)
      • ►  Oct 07 (1)
      • ►  Oct 06 (3)
      • ►  Oct 05 (3)
      • ►  Oct 01 (3)
    • ►  September (17)
      • ►  Sep 30 (1)
      • ►  Sep 29 (1)
      • ►  Sep 28 (1)
      • ►  Sep 25 (1)
      • ►  Sep 24 (1)
      • ►  Sep 17 (2)
      • ►  Sep 15 (3)
      • ►  Sep 11 (2)
      • ►  Sep 09 (3)
      • ►  Sep 08 (2)
    • ►  August (31)
      • ►  Aug 31 (1)
      • ►  Aug 27 (3)
      • ►  Aug 26 (1)
      • ►  Aug 25 (2)
      • ►  Aug 24 (1)
      • ►  Aug 22 (2)
      • ►  Aug 21 (3)
      • ►  Aug 20 (2)
      • ►  Aug 19 (3)
      • ►  Aug 18 (1)
      • ►  Aug 16 (1)
      • ►  Aug 12 (2)
      • ►  Aug 11 (1)
      • ►  Aug 10 (3)
      • ►  Aug 07 (4)
      • ►  Aug 06 (1)
    • ▼  July (24)
      • ►  Jul 25 (4)
      • ▼  Jul 24 (20)
        • Singleton Class Uses and Drawbacks
        • How to read XML Node using C#
        • Transparent images not displaying correctly
        • How to make Regular Expressions
        • Collection of Regular Expressions
        • How to make Recycle - Bin in .net using C#
        • Detect the Encoding Type of given file
        • Sorted List Implementation
        • Hash Table Implementation
        • Get System Boot Configuration using C#
        • Get Environment variables..
        • Obtain IP address and host
        • Send mail message to .net Environment (Enjoy Mail ...
        • Network Operations in C# (Play with system)
        • To get the system Icons(handle of system imagelist)
        • To close the application from task manager.
        • Play with Date-Time-Formats in C#
        • How to get Memory Info
        • Open Control Panel Items using Shell (COM)
        • Get folder items using Windows folder dialog
    • ►  April (15)
      • ►  Apr 10 (3)
      • ►  Apr 07 (9)
      • ►  Apr 06 (3)

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments
copyright @ TechGiant 2015. Powered by Blogger.

Disclaimer

This is my personal blog and i write articles on .Net, WPF, C#, OOPS, Threading and other .Net technologies. This is not related to any of my employer and organizations. This is the result of my personal interest.

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Followers

Copyright © 2025 A Developer Journey who codes for fun | Powered by Blogger
Design by Hardeep Asrani | Blogger Theme by NewBloggerThemes.com