Simple prevent write commands in SQL Server

On multiple occasions, I found myself trying to check if a query for data read is safe to execute or not. This is typically useful when the query is saved outside of your code, and you cannot restrict the access level of the user executing it. The following regex, while not exhausting by any means, will detect most query patterns typically used to change data. Note that inserts, updates, deletes, and merges are permitted on temporary tables (e....

May 25, 2021 · 1 min · LPains

Date input placeholder hack

The input type date is a very nice control introduced in HTML5. The problem is that it is very limited at this point and features such as placeholder may not available. Regardless, you may use it successfully if you are willing to make some css adjustments. In this post I will show how to add a placeholder to a date editor using minimal javascript and css. For the demo below I’m using vanilla css and vuejs just because it is so easy to use....

February 5, 2021 · 1 min · LPains
Dashboard

Enforce read only access in SQL Server queries

This is not something common, I guess. Imagine with me, will you? You have an app dedicated for reporting. The sole reason you built this app is to allow non-developers, but data savvy people, to create operational reports for LOB applications. How do you ensure that your users will not use this solution to modify data on the fly? Imagine how fun would it be to explain why your reporting solution allow them to modify data to your boss....

July 7, 2020 · 2 min · LPains
Timezones

Xamarin Forms converting from one timezone to another

There is a pattern here, I think. I don’t like to work with dates and you probably know that by now. Anyway, don’t like them, got to work with them. In this episode of Pains against dates, I wanted to write about something very specific that I had the pleasure to troubleshoot last week. I have this very important and somewhat old app where all dates are saved using server local time....

March 16, 2020 · 1 min · LPains
Working with time

Overriding standard date formatting of axios for post/put/patch

Let’s start by pointing out the obvious. It is painful to work with dates. No matter the technology, it is just harder than it should be. Anyway… I stumbled across one of those annoying date related issues with axios. Just to be fair, the problem is not necessarily an axios problem, I just got to it when using axios. By default, axios will use JSON.stringify to convert an object to a json....

February 13, 2020 · 1 min · LPains