Rebuild index performance: int vs bigint

Uncategorized
Some time ago I was working with a company that had a lot of data in multiple tables, using bigint as the primary key. At the time, it looked like a good idea to rebuild these indexes each day. Nowadays, I am not so partial to rebuilding indexes anymore: you can gain a lot just by updating statistics instead of doing a full rebuild. However, what I found was that when we were doing a rebuild of our tables using a bigint primary (clustered) key it would take a long time. Now, the people who came before me decided that using bigint was a good idea because there was going to be a lot of data in these tables, however, max int is 2,147,483,647. Two billion one hundred and forty…
Read More

EF Core: IEnumerable to separated list of string

C#, SQL Server
The problem In my database I have a column where I store comma separated strings representing a combination of options/features I need to use on the website. It would be nice to be able to access the comma separated items as an IEnumerable so I can use it to - for instance - populate a dropdown list. Some thoughts Of course, I could use entity framework core to get the string value from the database, and then split that string into a list, and use that in my page model. However then I don't know how many times I would need to do that in the future, when I might be building more and more functionality based on this same column. Also, I cannot think of a situation where my…
Read More

Using Dependency Injection and IOptions in Azure Functions

Azure, Backend Development, C#, Development
So, I created this Azure Function and because I have a lot of parameters that I would like to be able to use in dependency injection I did not want to go with the familiar way like this: var firstName = Environment.GetEnvironmentVariable("FirstName"); Instead I want to use the Options pattern as I would do when creating a "normal" appsettings file. However, Azure Function configurations only feature key-value pairs for configuration and do not support JSON configuration files. Luckily there is a way around this using a little peculiar syntax. Writing the code First, we create our options class: public class ParentOptions { public string FirstName { get; set; } public string LastName { get; set; } public ChildOptions ChildOptions { get; set; } } public class ChildOptions { public string…
Read More

Benchmarking .NET Performance

Uncategorized
Nerds do it better When we, nerds, are looking for the best solution to a programming problem we sometimes get distracted. We are asked to find a way to get from A to B and while we are finding our way we find out that there are often (always) multiple solutions to a problem. A lesser person would say: "Hey, if it brings me from A to B then it's alright!". Right? Well not us nerds. At least not always. For instance right now I am working on a pet project of mine where I want to receive data from a GPS unit that is sending positional and other data from my car to a receiver service I am currently programming. This service should receive the raw bytes from my…
Read More

Learning Web Development (5)

Niet gecategoriseerd
So now I dove a bit into the Gekko docs and it seems fairly simple to create a strategy. This is the thing that outputs the trading advice to Gekko. The tutorials I used are: https://www.youtube.com/watch?v=6-74ZhrG0BE&t=1456s and https://gekko.wizb.it/docs/strategies/creating_a_strategy.html My strategy looks like this (just outputting some trivial things like in the youtube demo): The JavaScript function from the strategy.. The output Gekko can make use of strategies using all kinds of algorithms, but I don't want that. I want to decide each day if I want to buy or sell on a specific input. For this I wrote a Web Api endpoint in C#. For my first test, like I showed you in the previous post, this just takes in an integer parameter and outputs a dummy object. I've changed…
Read More

Learning Web Development (3)

Niet gecategoriseerd
Creating Entities Before I do anything else, I need to create the entity that gets saved to the database. I called this entity "Condition", but I think the word "Rule" is more appropriate since I need to store not only a condition but also the value that is used by the condition, and maybe some other data as well. Separate Functionality into Projects I like to organize different parts of software I write into different projects in Visual Studio: this way each project is responsible for its own set of tasks and I can reference these projects from new projects. For instance, I can create a website, a console application or a Windows Service and allow these to use the same existing set of core classes, datalayer, et cetera. Using…
Read More

Reinstall your development laptop, fast

Niet gecategoriseerd
Today was one of those days again. You know, one of these days when Visual Studio keeps freezing up on you and you decide to finally do something about it. After a few hours disabling extensions to no effect, and comparing with my other laptop where VS is working without issue I decided to do a fresh reinstall of my laptop. Windows, all programs, everything. Cleaning Windows Everything I need is on my secondary disk so I did a windows refresh: just type "reset" in Start and follow the breadcrumbs: Reset this PC Alternatively, you can download the Windows iso manually from your msdn benefits page. Next, we wait.. Waiting... Scripted installation After reinstalling my laptop a few times it became time to do it differently. I now use a…
Read More

Learning Web Development (2)

Niet gecategoriseerd
Requirements Of course, when starting a new project it could be a good idea to put some requirements down to assure your efforts are going to be more or less in the direction of where you would like to end up after your journey. Books have been written about this, as well as ISO standards. I will keep things very basic so you, the reader will not get bored and go looking for funny cat videos on youtube. Functional Requirements Most of the functional requirements have already been named in the previous post. I think these are fairly complete and will just copy them here: A websiteFor entering valuesAnd maybe later creating some reporting dashboardsA databaseFor storing the entered valuesAnd maybe later some resultsAnd maybe later doing something with authentication…
Read More

Learning Web Development (1)

Niet gecategoriseerd
Introduction After having worked as a database professional for years I decided it is time to look ahead and think what I would like to be doing in the future. Of course I still love databases but I have always been a little jealous of my programmer friends who are able to create beautifully designed and functional websites from scratch. So, it is time for me to start learning on this new track: and to make sure what I am learning also stays around in my head I am creating this next series of blog posts in which I will document my learnings. Of course, I will be needing some homework exercises. Or.. Cryptocurrency The past years I have been watching the Bitcoin/Altcoin market on and off, and I own…
Read More

Customizing SAP PowerDesigner Object Templates

Niet gecategoriseerd
  Last week I ran into an issue when creating a stored procedure in a SAP PowerDesigner Physical Data Model. After creating the stored procedure and viewing it in the preview window I noticed something was looking odd: the create procedure statement was showing a pair of empty brackets after the procedure name. Empty brackets in a create proc statement? After running the create statement in SSMS, SQL Server confirmed my suspicion by throwing a syntax error: SQL Says No Next, I investigated the stored procedure body in the editor and found that apparently, PowerDesigner's default SQL Server template for stored procedures features a pair of brackets around the stored procedure parameters. Procedure parameters parameter, enclosed by brackets.. Of course, I tried manually deleting them but this was no use…
Read More