Hello, An easy way to determine if the path is a network path: [DllImport(“shlwapi.dll”)] public static extern bool PathIsNetworkPath(string pszPath); Yes, that’s all… Bye bye
C# – Check Write Access To Folder
Hi, An easy way to know if the user have write access to a folder can be done this way: public static bool HasWriteAccessToFolder(string folderPath) { try { // Attempt to get a list of security permissions from the folder. // This will raise an exception if the path is read only or do not […]
C# – Timer Elapsed
Time is money! But how do you manage the time in code? The simplest way of doing it is by using a Timer (System.Timers): using System; using System.Timers; namespace TimerEvent { class Program { static void Main(string[] args) { var keyPressed = false; const int delay = 1000; //Define the delay for the Timer var […]
C# – Determine the available space on a network drive
Hi peeps, Today at work I had an issue with a shared drive on the network which has a quota. So I was wondering how to know if the allowed space is already full or not. According to my readings on Google, there are only two methods that works for a network drive: WMI or […]
C# – Coma and Dot decimal separator
Hi peeps, You probably know the common issue with the decimal seprator. Depending on the country, the keyboard or what your client wants (which can be variable…), the separator will be a coma or a dot (or even something else…). In my case, the Culture is “en-US“, on a Belgian keyboard where the decimal separator […]
Share your Windows WiFi – Make your HotSpot – no app needed
Useful tip when you’re travelling and you are in a hotel where they give you only one voucher for one device. Use that voucher on your Windows 10 and you will be able to share your Internet connection with your other devices. No software needed, Windows 10 have a scriptable command called NetSh which is […]
C# – Store Variables and Collections in Config file
In this article, we will talk about the config file used for a C# application. What is the goal of it, and how to use it. How to get values and create your own config section. What is a config file? It happens sometimes (quite often actually) that we need to store some parameters, default […]
Install Docker on Raspbian
When I received my first Raspberry Pi 2, I thought: “maybe I can use it as a web server to host a few of my websites”. Trying different configurations and security options, I had to start all over a few times… Hours and hours redoing more or less the same things again and again. Now […]
Raspberry Pi 3 – Integrated Wi-Fi setup
Hello Devz, I received my new Raspberry Pi 3 today with its integrated Wi-Fi, and I was wondering how to setup the ip address in a permanent way with console only. sudo nano /etc/network/interfaces Then find a line containing “wlan0” (zero) and replace the text by this: allow-hotplug wlan0 auto wlan0 iface wlan0 inet dhcp […]
WPF – Change color of a row in a DataGrid depending on the value with DataTrigger
Hi folks, Today we will see how to change the color or a row depending on the value of the content. To do that, create a simple View: <Window x:Class=”DataTrigger_Test.MainWindow” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″ xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″ mc:Ignorable=”d” Title=”MainWindow” Height=”350″ Width=”525″> <Grid> <DataGrid Margin=”10″ ItemsSource=”{Binding Users}” AutoGenerateColumns=”False” ColumnWidth=”*” HorizontalAlignment=”Stretch” VerticalAlignment=”Stretch” HorizontalContentAlignment=”Stretch” EnableRowVirtualization=”false” EnableColumnVirtualization=”false” CanUserAddRows=”False” CanUserReorderColumns=”False” CanUserResizeColumns=”True”> <DataGrid.CellStyle> <Style […]