I was helping one old university project and as part of user experience and SEO tweaks we decided to move away from Facebook app comments to Disqus comments. The main reason was problems with comments/replies not appearing on the website, and on top of this we wanted to boost SEO having comments that could be indexed by search engines.
Continue reading Migrate away from Facebook app to Disqus comments
Sometimes you need to find database or tables sizes to find out what is taking the most disk space in a Microsoft SQL database server. Following two queries can be very handy in such case. Result looks following.
Continue reading SQL database and tables sizes
Sometimes you need to clean and shrink SQL database, since once database grows even if all records get deleted, the database file would still take the space as before clean up. To achieve this we can manually delete records and call SHRINKFILE command. However, it’s important to delete records in small batches in transaction not to clog up the database server.
Continue reading Clean and shrink SQL database
RefreshViews is simple stored procedure to refresh all database views in a Microsoft SQL database server. This is especially useful when working with legacy systems that have select * from some_view like queries in views, and needs updating after adding/removing columns.
Continue reading SQL RefreshViews
SQL quick row count script gets row counts for all tables in a database in Microsoft SQL database servers. Result looks following.
Continue reading SQL Quick Row Count
I’ve decided to write this blog post when I came across an issue with Swashbuckle trying to validate JSON file in Swagger and was failing since Swagger’s online validator was trying to fetch JSON file from an development server which is not accessible from external networks.
Continue reading Swashbuckle and Swagger for .NET Core 1.0 validator issue
Different developers have different coding styles, however when you work as a team you want to make sure everyone can quickly pick up any part of code and could get their head around in no time. For this reason, it’s great when code has unified style. This can be done manually (not recommended :)) or by using code analyzers in Visual Studio. Default set of rules check for the most common issues, however do not keep the coding style itself unified. Therefore, such tools like StyleCop Analyzers become really handy in such cases. Continue reading .NET Core projects with StyleCop Analyzers
If you used a SQL login and needed to restore a database (dev/test), you should notice that your SQL login doesn’t work for the database anymore. The reason for this is that SQL login and database user mapping was lost. Even you can see the user name in database user’s mapping, however in internal SQL memory the restored database’s user has different reference than the SQL login.
Continue reading Fix SQL database user mapping
Sometimes you need to find a specific string or value in a database that you are not familiar with. You may not know where to start since a completely new database for you, or there are just way too many tables. In such cases there is a very handy stored procedure that searches for a string through all the tables.
Continue reading SearchAllTables SQL Stored Procedure
The best practice to run SQL queries is to run them in transaction and wrap with SQL’s Try … Catch statement, so we could rollback the transaction, and throw an exception. Below is the code snippet that would do it all.
Continue reading Try … Catch in SQL