This is a preview version of Cyotek's blog and may be missing functionality and/or unstable. Please visit https://www.cyotek.com/blog for the current version of the blog.
If you encounter any problems using this preview site, please contact us with the details.

Archived posts for All of 2017

Reading and writing 18-bit RGB VGA Palette (pal) files with C#

c# rgb color palette 18-bit 24-bit westwood dos 6-bit 8-bit 1 Comments Downloads

18-bit RGB palettes are an old format used by VGA displays of yesteryear (although interestingly Wikipedia states they are still used by many LCD monitors). These palettes use 6-bits for each of the red, green and blue channels and usually allowed a maximum of 256 colours from the 262,144 unique colours available.

Files using this format are usually quite recognisable, having the extension pal and a size of 768 bytes.

Read More

Redirecting to HTTPS when using IIS behind a load balancer

asp.net iis https redirect 0 Comments

Cyotek has a number of different websites powering various bits of our software and services. Some are Windows based using IIS, and some are Linux based using Apache. Internal servers are are directly accessed but external servers are behind load balancers. Almost all are using HTTPS now and have redirects in place to force the use of HTTPS over HTTP.

There are plenty of articles on the internet dealing how to use .htaccess files to perform redirects using Apache, and various articles on different methods of redirecting IIS or ASP.NET applications. However, there seems to be a slight gap when it comes to load balancers or reverse proxies. Depending on how the load balancer / reverse proxy (referred to as just load balancer for the rest of the article) operates, the secure connection may terminate at the load balancer, and so the web server ...

Read More

Installing the URL Rewrite module into Internet Information Services

iis rewrite web platform installer 0 Comments

For quite some time now Internet Information Services (IIS) has had an URL Rewriter component that you can optionally install. As one of my upcoming shorter posts mentions the use of it, I thought I'd better provide installation instructions separately rather than cluttering up that post.

Some versions of Internet Information Services Manager (IIS Manager) have a Start Page, as demonstrated in the below screenshot. All instructions on this post assume that on opening IIS Manager the user has selected the root server node in the tree if it wasn't already selected.

Read More

Upload data to blob storage with Azure Functions

c# azure blob 2 Comments

Some time ago I used a third party product which accepted data from client applications via a HTTP WCF service and saved this data as files on the local disk. A Windows service would then periodically poll for new files and load the data into a SQL Server database. This worked, as long as both the HTTP server and the loader service were on the same computer/network. As this wasn't suitable for my needs, the software vendor provided me with the source code for the WCF service and I modified this to store the...

Read More

Arranging items radially around a central point using C#

c# math diagram trigonometry 0 Comments Downloads

Recently I was looking for a way of display hierarchical information in a more compact form than the previous horizontal/vertical trees I was using. One of the concepts I looked into during this was the idea of arranging children radially around a central node.

This post discusses the sample project I created to explore the first part of this concept.

Read More

Painting animated images using C#

c# image animate 0 Comments Downloads

While reviewing The C# Top 100 it occurred to me that in my own code base I have many bits of code which may make useful blog posts, and that shouldn't take as long to write as the ones I usually create. Plus, I've a fair amount of source code for extending built in controls in various ways, creating new controls from scratch and other useful library code - I need to explore ways of decoupling some of that and releasing it for a...

Read More

Book Review: The C# Helper Top 100

c# review book 0 Comments

Almost 20 years ago after finishing a training scheme I was hired for my first permanent role. After getting paid for the first time I immediately rushed off to the bookshop to buy myself a programming book. The selection of books in my chosen language of the time (Visual Basic (not .NET!)) wasn't large, but in the end I bought Rod Stephens Custom Controls Library, which still graces my technical bookshelves even now. Since then I've bought many computing books, but I couldn't tell you the ...

Read More

Getting a window rectangle without the drop shadow

c# api win32 0 Comments

In my last article, I describe how to use the Win32 API to capture screenshots of the desktop. There was one frustrating problem with this however - when capturing an image based on the value of the Bounds property of a Form unexpected values were returned for the left position, width and height of the window, causing my screenshots to be too big.

I thought that was odd but as I wanted to be able to capture unmanaged windows in future then using Form.Bounds wasn't going to be possible anyway and I would have to use GetWindowRect. I'm sure that deep down in the Windows Forms code base it uses the same API so I was expecting to get the same "wrong" results, and I wasn't disappointed.

Read More

Capturing screenshots using C# and p/invoke

c# api win32 screenshot 2 Comments Downloads

I was recently updating some documentation and wanted to programmatically capture some screenshots of the application in different states. This article describes how you can easily capture screenshots in your own applications.

This article makes use of a number of Win32 API methods. Although you may not have much call to use them directly in day to day .NET (not to mention Microsoft wanting everyone to use universal "apps" these days), they are still extraordinarily useful and powerful.

Read More

Writing custom Markdig extensions

c# markdig markdown 0 Comments Downloads

Markdig, according to its description, "is a fast, powerful, CommonMark compliant, extensible Markdown processor for .NET". While most of our older projects use MarkdownDeep (including an increasingly creaky cyotek.com), current projects use Markdig and thus...

Read More