Blog
Technical articles about C#, .NET, SQL Server and other technologies
C# - monitor directory activity using FileSystemWatcher class
Posted on
22 473 views
System.IO.FileSystemWatcher class allows you to monitor physical directory activity, listen to the file system change notifications and raises events when a directory, or file in a directory changes.
I'we made small WPF application that will demonstrate you how use this class.
I'we made small WPF application that will demonstrate you how use this class.
C# - serialize object to JSON format using JavaScriptSerializer
"Serialization is the process of converting the state of an object into a form that can be persisted or transported.
The complement of serialization is deserialization, which converts a stream into an object.
Together, these processes allow data to be easily stored and transferred."
How to clear connection history in SQL Server Management Studio?
When connecting to database server using SQL Server Management Studio, all the past connections and it's details are remembered in history.
This can be problem in situations when you would like to clear that history because:
This can be problem in situations when you would like to clear that history because:
Export data to Excel using C#
In this article I will show you how to export data from generic collection to Excel file.
Assume you are working with list of Car entities. Car has some properties like name, color, and maximum speed. In this case, your entity would look like this...
Assume you are working with list of Car entities. Car has some properties like name, color, and maximum speed. In this case, your entity would look like this...
Summarizing Data Using CUBE - T-SQL
Posted on
3 971 views
"The CUBE operator is specified in the GROUP BY clause of a SELECT statement.
The select list contains the dimension columns and aggregate function expressions.
The GROUP BY specifies the dimension columns and the keywords WITH CUBE.
The result set contains all possible combinations of the values in the dimension columns,
together with the aggregate values from the underlying rows that match that combination of dimension values."
C# - using LINQ to Query DataTable
In this article you will learn how to "walk" through data stored in DataTable using LINQ.
Visual Studio 2008 with Team Foundation Server 2010? Well, it CAN be done!
Posted on
6 976 views
If you ever tried to connect Visual Studio 2008 with Team Foundation Server 2010, you ran into a problem. These two aren't compatible unless you do some additional installations. To achieve this just follow the steps bellow.
Advanced using of delegates in C# - Part II
In first article about the delegates, I tried to explain, basic concept of
delegates, and how it could be used.
In this article I shall present you the use of delegates in real world situations!
If you liked concept of delegates in my previous article, feel free to keep on reading! :)
In this article I shall present you the use of delegates in real world situations!
If you liked concept of delegates in my previous article, feel free to keep on reading! :)
Understanding and using delegates in C# - Part I
Posted on
4 777 views
Delegate is a type that defines a method signature. It is also an object that receives that method as parameter when constructed and then call's that method to do some operation.
public delegate int MathematicalOperation(int numberA, int numberB);
public delegate int MathematicalOperation(int numberA, int numberB);
How to repair a Suspect Database in SQL Server?
Suspect state of SQL Server database is a state when you are unable to connect to the database.
In this state you cannot do anything with your database: no opening, no backup and no restore.
Possible cause for this problem can be one of the following:
In this state you cannot do anything with your database: no opening, no backup and no restore.
Possible cause for this problem can be one of the following:
Running a ClickOnce Application as Administrator
Using ClickOnce to deploy your Windows application is the easiest way you can imagine.
BUT, as it gets with all automatic process, there are situations when you ran into a problem: my ClickOnce deployed application wouldn't start on Windows 8 operating system.
BUT, as it gets with all automatic process, there are situations when you ran into a problem: my ClickOnce deployed application wouldn't start on Windows 8 operating system.
Get computer IP address - LAN & Internet using C#
There are two ways to get your IP address!
First is for LAN IP, which indicates your computer address in local network, while the second way is to get your INTERNET IP, which is stored in your router.
#1 - Get computer LAN address like 192.168.1.3
#2 - Get computer INTERNET address like 93.136.91.7
First is for LAN IP, which indicates your computer address in local network, while the second way is to get your INTERNET IP, which is stored in your router.
#1 - Get computer LAN address like 192.168.1.3
#2 - Get computer INTERNET address like 93.136.91.7
Check if Internet connection is available using C#
There can be situations when you need to check, whether your application has Internet access.
Maybe you have to download/upload some file or database, or just run some application check.
Many developers are solving that "problem" just by ping-ing Google.com. Well...? :/ That will work in most (99%) cases, but how professional is to rely work of Your application on some external web service?
Instead of pinging Google.com, there is an very interesting Windows API function called InternetGetConnectedState(), that recognizes whether You have access to Internet or not.
Maybe you have to download/upload some file or database, or just run some application check.
Many developers are solving that "problem" just by ping-ing Google.com. Well...? :/ That will work in most (99%) cases, but how professional is to rely work of Your application on some external web service?
Instead of pinging Google.com, there is an very interesting Windows API function called InternetGetConnectedState(), that recognizes whether You have access to Internet or not.
Developing in HTML5? Test your client's browser!
Posted on
2 955 views
If you are beginner or even advanced developer in HTML5, this article is MUST READ for you!
IMAGINE yourself developing some super-cool HTML5 web application where you spend weeks or even months in development, and then you figure some cool feature in HTML5 and you integrate it!
Everything works perfect, until you find out, that this feature is not supported by some browser(s). Problem gets whole lot bigger when you find out that nearly 20% of your user uses that browser(s)!
IMAGINE yourself developing some super-cool HTML5 web application where you spend weeks or even months in development, and then you figure some cool feature in HTML5 and you integrate it!
Everything works perfect, until you find out, that this feature is not supported by some browser(s). Problem gets whole lot bigger when you find out that nearly 20% of your user uses that browser(s)!
SQL - Calculating time difference in Minutes, Hours, Days, Weeks, Months, Years...
In this article I will show you how you can easily in SQL, calculate time difference
between two dates in minutes, hours, days, and even weeks, months and years!
The key of this calculation is in Modulo operator, %. It returns the remainder (NOT the result!) of one number divided by another!
The key of this calculation is in Modulo operator, %. It returns the remainder (NOT the result!) of one number divided by another!
Accessing Controls running in different Thread
Posted on
4 830 views
If you worked with System.Threading.Thread in desktop applications, you probably ran into problem,
where you wanned to access some control, and update her condition / property.
Controls in Windows Forms are bound to a specific thread and are not thread safe. Therefore, if you are calling a control's method from a different thread, you must use one of the control's invoke methods to marshal the call to the proper thread.
Controls in Windows Forms are bound to a specific thread and are not thread safe. Therefore, if you are calling a control's method from a different thread, you must use one of the control's invoke methods to marshal the call to the proper thread.
[VIDEO] What is HTML5?
Posted on
3 073 views
Well, it's a lot more than HTML language - it is the synchronization of ALL desktop and mobile browsers!
In common tongue: one STANDARD to rule them all! :)
The goal of HTML is to create standard and consistent web expirience (browsing) across all devices and browsers. Whateaver you are on desktop computer, notebook, tablet, mobile phone, regardles what browser does your devices is using - EXPERIENCE is the same!
In common tongue: one STANDARD to rule them all! :)
The goal of HTML is to create standard and consistent web expirience (browsing) across all devices and browsers. Whateaver you are on desktop computer, notebook, tablet, mobile phone, regardles what browser does your devices is using - EXPERIENCE is the same!
Using PLINQ (Parallel Language In Query) in .NET 4.0
Posted on
3 830 views
Parallel LINQ (PLINQ) is a parallel implementation of LINQ to Objects. It is located in System.Threading.Tasks.Parallel.
In many scenarios, PLINQ can significantly increase the speed of LINQ to Objects queries by using all available cores on the host computer more efficiently.
I bring you my example, where I tested the speed of PLINQ, and the increase of speed was enormous!
In many scenarios, PLINQ can significantly increase the speed of LINQ to Objects queries by using all available cores on the host computer more efficiently.
I bring you my example, where I tested the speed of PLINQ, and the increase of speed was enormous!
Tuple in C# 4.0
Posted on
3 801 views
A System.Tuple is static class that allows you to create collection of specific data-typed values.
You can store values like...
Tuple tuple = new Tuple<int, string, string, bool>(1, "Matija", "Božičević", true);
...or you can create it in more easy way...
var tuple = Tuple.Create(1, "Matija", "Božičević", true);
You can store values like...
Tuple tuple = new Tuple<int, string, string, bool>(1, "Matija", "Božičević", true);
...or you can create it in more easy way...
var tuple = Tuple.Create(1, "Matija", "Božičević", true);
Android with WCF service using JSON
In this article I will show you simple example how to:
- Create simple .NET WCF service
- Connect Android application with .NET WCF service, get some data in JSON format, and show data in Android's ListView
TOP 5 reasons for building web application over "classic" desktop
Posted on
3 020 views
Today's web technologies are more advanced than they have ever been, and they have so much to offer to your business.
Make the most of these advantages by using them!
Why build your own CUSTOM web application?
Posted on
3 078 views
Building your own custom web application gives you comfort and ease in your daily work, for you and your employees.
It also guarantees you the ability to modify and upgrade your application in anyway and anytime it suits you.
Doing so, you keep your software infrastructure up to date with all your business process. It also maximizes performance of your team and employees, because you give them the right tool to be more effective and satisfied.
Doing so, you keep your software infrastructure up to date with all your business process. It also maximizes performance of your team and employees, because you give them the right tool to be more effective and satisfied.
bla bla...