Skip to content

Instantly share code, notes, and snippets.

View dirkstrauss's full-sized avatar

Dirk Strauss dirkstrauss

View GitHub Profile
CS0001 - This is an experimental feature to calculate the age using a GUID.
This is to demonstrate the use of the Experimental attribute in C# 12 for the Syncfusion book .NET 8 and C# 12 Succinctly.
@dirkstrauss
dirkstrauss / books.http
Created April 23, 2023 11:42
Faster API development with the addition of .http/.rest files in ASP.NET Core Projects
@bookId = 1029
@isbn = 1234
GET https://localhost:44371/api/book
###
GET https://localhost:44371/api/book/{{bookId}}
###
@dirkstrauss
dirkstrauss / AlterSchema.sql
Created September 4, 2018 19:40
Change the existing stored procedures with my domain\username prefix to dbo.procedurename
ALTER SCHEMA dbo TRANSFER [COMPANYDOMAIN\MYUSERNAME].ThisIsAStoredProcedure;
/*
If you didn't explicitly set it, then objects created by you will be created under the default schema for your user.
In SSMS, look in the database -> Security -> Users -> -> Properties -> General -> Default schema
*/

Keybase proof

I hereby claim:

  • I am dirkstrauss on github.
  • I am dirkstrauss (https://keybase.io/dirkstrauss) on keybase.
  • I have a public key ASC-8vh3koDtas9QO7PGg_KoF0i5YyFfzGImGIzDKauR6wo

To claim this, I am signing this object:

@dirkstrauss
dirkstrauss / SQL_Table_Variable.sql
Created November 19, 2017 19:02
Table Variables In T-SQL
-- https://odetocode.com/articles/365.aspx
DECLARE @ProductTotals TABLE
(
ProductID int,
Revenue money
)
INSERT INTO @ProductTotals (ProductID, Revenue)
SELECT ProductID, SUM(UnitPrice * Quantity)
import datetime
today = datetime.date.today()
print(today)
@dirkstrauss
dirkstrauss / resume.md
Last active September 14, 2017 05:43
This is my online resume

Resume

I have been writing software for more than 13 years and have always tried to stay ahead of the pack by keeping up with the latest in technology. Apart from a passion for technology, I am passionate about imparting whatever it is that I learn. I have authored two books on C# and have written numerous blog posts and contributed to various guest articles on other sites such as BitRebels.

I started my career at a small privately owned company, developing ASP.NET Web Applications using VB.NET and C#. Later I moved to a national company where I did SYSPRO integration and customization using C# as my main language.

After 8 years doing SYSPRO integration, I decided that it was time to move on. I am currently employed by a company in Cape Town, South Africa where I can live out my creativity developing responsive web applications.

// Add the following using statements
using static elysium.crypt.crypto;
using static elysium.crypt.validator;
using static elysium.crypt.ExtensionMethods;
// In your code you can do the following:
// User registers with password. Encrypt and save.
string strSecret = "password";
string encrPassword = EncryptData(strSecret);
@dirkstrauss
dirkstrauss / setAutoCloseOff.sql
Created August 4, 2017 06:15
MSSQL Server - Switch AUTO_CLOSE and AUTO_SHRINK off
/*
When expanding the databases list in SSMS, the list takes a few minutes to expand sometimes.
This is a strong indicator that you have AUTO_CLOSE and AUTO_SHRINK set to on.
You can manually switch this off for all the databases in their properties, but if you have
several databases this task becomes tedious.
*/
-- Use this SQL to see which databases have AUTO_CLOSE and AUTO_SHRINK turned on
SELECT name, is_auto_close_on, is_auto_shrink_on
FROM master.sys.databases AS dtb
@dirkstrauss
dirkstrauss / Site.Master
Created August 3, 2017 21:48
ASP.NET Bootstrap Dropdown List - Display Selected Item
<%--The JavaScript on the Master Page to get the selected item--%>
<script type="text/javascript">
$('#studentMenu li').click(function () {
$('#dlStudentSelect').html($(this).text() + '<span class="caret"></span>')
})
</script>
</form>