Skip to main content

Posts

SVG images from AWS Cloudfront downloading while opening in browser

 Why SVG  images from AWS Cloudfront downloading instead of opening opening?  In S3 Bucket, by default SVG Image Content-type header is "application/octet-stream", so you need to change it to "image/svg+xml".  Screen shot to change the content-type of SVG image at s3 bucket using the cloudberry Software.

SQL Server - Query for Possible bad Indexes

 --Possible bad Indexes (writes > reads) SELECT  OBJECT_NAME(s.object_id) AS 'Table Name',sca.name  , i.name AS 'Index Name', 'DROP INDEX ' + i.name + ' ON ' + sca.name + '.' + OBJECT_NAME(s.object_id)  ,         i.index_id, user_updates AS 'Total Writes',         user_seeks + user_scans + user_lookups AS 'Total Reads',         user_updates - ( user_seeks + user_scans + user_lookups ) AS 'Difference' FROM    sys.dm_db_index_usage_stats AS s WITH ( NOLOCK )         INNER JOIN sys.indexes AS i WITH ( NOLOCK ) ON s.object_id = i.object_id                                                        AND i.index_id = s.index_id INNER JOIN sys.tables AS t ON s.object_id = t.object_id INNER JOIN sys.schemas As sca on t.schema_id = sca.schema_...

SQL Server - Drop indexes and stats

  Query to get the 'drop query for Stats' SELECT distinct 'DROP STATISTICS ' + sca.name + '.' + t.name + '.' + s.name FROM sys.stats AS s INNER JOIN sys.stats_columns AS sc ON s.object_id = sc.object_id AND s.stats_id = sc.stats_id INNER JOIN sys.columns AS c ON sc.object_id = c.object_id AND c.column_id = sc.column_id INNER JOIN sys.tables AS t ON s.object_id = t.object_id INNER JOIN sys.schemas As sca on t.schema_id = sca.schema_id where s.name like '_dta_stat_%' Query to get the 'drop query for Index' SELECT distinct 'DROP INDEX ' + s.name + ' ON ' + sca.name + '.' + t.name FROM sys.stats AS s INNER JOIN sys.stats_columns AS sc ON s.object_id = sc.object_id AND s.stats_id = sc.stats_id INNER JOIN sys.columns AS c ON sc.object_id = c.object_id AND c.column_id = sc.column_id INNER JOIN sys.tables AS t ON s.object_id = t.object_id INNER JOIN sys.schemas As sca on...

SQL Server - Deleting the contents from log file

  You can shrink the log with the following Statements: USE [MyDatabase] GO ALTER DATABASE [MyDatabase] SET RECOVERY SIMPLE WITH NO_WAIT DBCC SHRINKFILE([MyDatabase_log], 1 ) ALTER DATABASE [MyDatabase] SET RECOVERY FULL WITH NO_WAIT GO This snippet can be found on various sites in the net, but be aware that it's not a good practice to kill the log like this because of recovery. After doing this, you can only recover your database to the last full or full+incremental backup.

Remove 'Powered by Shopify' from your store

From your Shopify admin, go to Online Store > Themes.   Find the theme that you want to edit, and then click Actions > Edit languages .  In the Filter translations box, type "powered" .  In the Powered by Shopify box , use the space bar on your keyboard to type a single space. You can repeat these steps for the Powered by Shopify HTML box, which appears on your store's " Opening soon " page if your store is password-protected.  Click Save .

Adding Cache-Control headers to Static Files in ASP.NET Core

 Implement Caching to Static files in the asp.net core When you create a new ASP.NET Core project from the default template, you will find the StaticFileMiddleware is added early in the middleware pipeline, with a call to AddStaticFiles() in Startup.Configure(): Please replace the app.UseStaticFiles() from the below code: public void Configure ( IApplicationBuilder app ) { // logging and exception handler removed for clarity app . UseStaticFiles ( ) ; app . UseMvc ( routes = > { routes . MapRoute ( name : "default" , template : "{controller=Home}/{action=Index}/{id?}" ) ; } ) ; } to using Microsoft . Net . Http . Headers ; app . UseStaticFiles ( new StaticFileOptions { OnPrepareResponse = ctx = > { const int durationInSeconds = 60 * 60 * 24 * 14 ; ctx . Context . Response . Headers [ HeaderNames . CacheControl ] = "public,max-age=...

SEO for different countries

  There are 3 options for SEO in different Countries: 1.        Country Code Top Level Domains (ccTLDs) : a.        A ccTLD (Country Code Top-level Domain) is a two-letter domain extension used primarily to identify an association of some kind to a specific country or territory. The first thing to do is you have to purchase a domain name whose extension should be your country domain such as .com which is global . http://co.uk  for UNITED KINGDOM , . http://co.in  for India , .ae for gulf etc. . Then you have to use Google webmaster geotargeting feature This tool allows you to set which country your website is targeted to. b.        Automatically associated with the country they cover (.de to Germany) c.        Starting SEO from scratch with no domain history and we need to start submitting website on Local search engine and directories...

503 This mail server requires authentication when attempting to send to a non-local e-mail address.

 Server error: '503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server.' and Error: Your message did not reach some or all of the intended recipients.       Subject: test       Sent: 10-03-2021 15:15 The following recipient(s) cannot be reached:  'example@domain.com' on 10-03-2021 15:15 This error occurs mostly in Windows system. The users can send emails to local domain systems but can’t send emails to external addresses. Why they do server sends this message:  503 This mail server requires authentication when attempting to send to a non-local e-mail address.  To resolve this error one should check the settings of the mail client or should contact the administrator for verification of address or domain are defined for the server or not. Cause SMTP server n...

SQL SERVER - How to capitalize the first letter of a record in SQL

  Cast your ntext to nvarchar(max) and do the upper and left operations. Sample below. SELECT UPPER ( LEFT ( cast (Comments as nvarchar(max)), 1 )) + LOWER ( SUBSTRING ( cast (Comments as nvarchar(max)), 2 , LEN( cast (Comments as nvarchar(max))))) FROM dbo.Template_Survey; Following should work for update. Update dbo.Template_Survey SET Comments = UPPER ( LEFT ( cast (Comments as nvarchar(max)), 1 )) + LOWER ( SUBSTRING ( cast (Comments as nvarchar(max)), 2 , LEN( cast (Comments as nvarchar(max)))));