Hello Devz, I had to write this post about how to do an Enum binding to a ComboBox, because everytime I need it, I’m surprised there is no “out-of-the-box” solution provided in WPF or Xamarin.Forms. <Window x:Class=”EnumBinding.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″ xmlns:local=”clr-namespace:EnumBinding” xmlns:sys=”clr-namespace:System;assembly=mscorlib” mc:Ignorable=”d” Title=”MainWindow” Height=”350″ Width=”525″> <Window.Resources> <ObjectDataProvider x:Key=”dataFromEnum” MethodName=”GetValues” ObjectType=”{x:Type sys:Enum}”> <ObjectDataProvider.MethodParameters> <x:Type TypeName=”local:StatusEnum”/> </ObjectDataProvider.MethodParameters> […]
C# – Aspose.Cells – Create Excel files without Excel
Hello Devz, It is common to have to export data to an Excel file. But sometimes the code have to run on a server where Excel is not or can’t be installed. And anyway, to be honest the Excel Interop is a real piece of crap to use… So Aspose did a good work by […]
C# – SI prefixes for metric units – because size matters
Sometimes you will have to play with numbers, BIG numbers… Or teeny-tiny ones! To avoid having too many zeros you can use the SI prefixes (like metric units: mm, cm, m, km, …). Here are the results of our code: 123,460000 -> 123,460 w (1000) 123,460000 -> 123,460 w (1024) 1.234,560000 -> 1,235 kw (1000) 1.234,560000 […]
Google Dialogflow – create your own AI in a few clicks
Hello Devz, Having a Google Home at home and a Google Assistant in my pocket, I wanted to go further and create my own Actions. Pretty easy with Google DialogFlow! DialogFlow is a free web interface that allows you to create a, wait for it… dialog flow! Let’s say I want to add an expense […]
WPF – PasswordBox Helper
Because security matters, you will need at one point to use a PasswordBox in your WPF application (you know, the textBox hiding the password with stars). But Microsoft didn’t make this control bindable for security reasons (in memory access). So if you’re using MVVM, it will be a bit tricky. Different solutions exist, but really […]
MS SQL – Performance optimisation on the indexed primary key
Hello Devz, Today I had an issue with the performance of a SQL stored procedure. This procedure was supposed to delete a few millions rows in a table. But it was quite slow… So after optimizing the query, I looked at the database itself. Having an indexed primary key is important but the level of […]
C# – Web Scraping – a simple HTML Agility Pack example
Hello Devz, Sometimes it can be useful to copy a part of the content from a website. That’s where web scraping is useful and HTML Agility Pack is one of the best tools to do it. In this tutorial, I will show you a simple HTML Agility Pack example. Decide what content you need Say […]
WPF – Inverted BooleanToVisibilityConverter
Hello Devz, WPF is providing a really useful converter called BooleanToVisibilityConverter. But the thing with this converter is that it’s really limited. Let’s say we want to use the same boolean to show one control and collapse another one, we just can’t… Here is new version of this converter that can accept a parameter to […]
Verify vulnerabilities on your WordPress site with WPScan
WPScan is a good tool to discover vulnerabilities on your WordPress website. To install it: sudo apt-get install git sudo apt-get install libcurl4-openssl-dev libxml2 libxml2-dev libxslt1-dev ruby-dev build-essential cd ~ git clone https://github.com/wpscanteam/wpscan.git cd wpscan sudo gem install bundler && bundle install –without test Execute the scan on www.example.com: ruby wpscan.rb –url www.example.com
Verify common vulnerabilities on your router with RouterSploit
We will never say it enough, security and privacy are important. But what if your router has an old firmware and is vulnerable to some common exploits? One easy way to test it: RouterSploit. If you are familiar with the well know MetaSploit, it is more or less the same. It’s some kind of a […]