How to rename Asp .Net Core 2.2 Identity Tables to not have AspNet prefix in EF Core

Not sure if the code below should be considered a hack, but the easiest way of removing the AspNet prefix is to iterate through the models. 1 2 3 4 5 6 7 8 9 10 11 12 protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); foreach (var entityType in modelBuilder.Model.GetEntityTypes()) { var table = entityType.Relational().TableName; if (table.StartsWith("AspNet")) { entityType.Relational().TableName = table.Substring(6); } }; } Found the initial code in a 2014 asp net issue and since copy paste didn’t cut it, did a quick update of the method / property names....

16 December, 2018 · 1 min · 109 words · Alexandru Bucur

The confusing way of sending emails in .NET Core and other goodies

Since I finally had some time to play more with C# I’ve encountered my next challenge when wanting to implement user registration with a confirmation email. Even though the official documentation is clear on how to handle the one time code generation I didn’t want to use Sendgrid but plain old SMTP authentication. Further more I don’t agree with having the mail body as a string in my registration task....

08 December, 2018 · 2 min · 290 words · Alexandru Bucur

ps aux output in cronjobs

Hello there, Going trough an ad-hoc cronjob for checking an existing process I’ve hit a weird case that the command itself was working well when ran from the terminal, but failed miserabely when the cronjob ran it. The command was something along the lines of: 1 ps aux | grep 'php artisan a_specific_command --with-some-long-parameters-that were generated' | grep -v grep The thing that I’ve completely forgotten is that by default ps’s output is limited by the number of $COLUMNS....

22 September, 2018 · 1 min · 161 words · Alexandru Bucur

Static / Fixed filenames for generated vue-cli builds

As you may know, the release of vue-cli 3 is getting close (currently at RC3 status). I really like the streamlined way of starting projects and having a good baseline for development (especially when trying to setup a good starting point in house, that has documentation and it’s actively developed). However the default setup isn’t friendly with legacy projects because vue-cli implicitly adds a hash to the generated filenames. That’s great if you’re starting a new project/SPA because it’s like a built in cache buster but doesn’t help if you’re trying to integrate it with your favourite c#/php/python/ruby etc application....

04 July, 2018 · 2 min · 277 words · Alexandru Bucur

Quick and easy way of counting UTF-8 characters in Javascript

Reading the following tutorial regarding a VueJS component that displays the character count for a textarea got me thinking. You see, the problem is that when Javascript was first created it didn’t had proper UTF-8 support. Javascript’s internal encoding is UCS-2 or UTF-16 depending the articles you find on the internet. (actually there’s an awesome article from 2012 that explains this in detail ) . What does that mean you say ?...

18 June, 2018 · 2 min · 225 words · Alexandru Bucur

Quick hack for using google translate (or other services) in Nuxt/Vue.js

Hey guys, here’s a quick way of making google translate play nice using setInterval. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 export default { mounted: function() { this.$nextTick(() => { this.googleTranslateInit(); }); }, methods: { googleTranslateInit: function() { let checkIfGoogleLoaded = setInterval(() => { if (google.translate.TranslateElement !...

26 May, 2018 · 1 min · 145 words · Alexandru Bucur

Mysql Alter Table Select all Tables

In case you wanted for example to change all your MyISAM tables into InnoDB , and you didn’t want to go over the tables one by one, you can do the following queries. First check that you’re doing it on the proper database. 1 2 3 4 USE information_schema; SELECT TABLE_SCHEMA, TABLE_NAME FROM TABLES WHERE TABLE_SCHEMA = "your_db_name"; If it returns what you need you can then run: 1 2 3 SELECT CONCAT("ALTER TABLE `", TABLE_SCHEMA,"`....

07 March, 2012 · 1 min · 90 words · Alexandru Bucur