23 February 2021

Visual Studio Code lightweight code editor and runs on any platform. It is so much easy to work with it.

Often we need to open folder in Visual Studio Code in order to run project,

So its easy if there is an option to open any folder directly in Visual Studio Code from  windows explorer 

We can do it by changing  "Right Click Context Menu" registry 

Step 1 : Create a file with ".reg" extension

Step 2 : Apply following code...

Note : Change "Code.exe" file path as per your folder directory structure


Windows Registry Editor Version 5.00

; Open files [HKEY_CLASSES_ROOT\*\shell\Open with VS Code] @="Edit with VS Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"

[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""

; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\vscode]
@="Open in VS Code"
"Icon"="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\",0"

[HKEY_CLASSES_ROOT\Directory\shell\vscode\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""

; This will make it appear when you right click INSIDE a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode]
@="Open in VS Code"
"Icon"="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\",0"

[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%V\"" 



Save the file and close it

Step 3: Open that file by double click / hit enter.

It will ask for permission, after that it will apply a new context to right click in windows explorer


25 January 2019



DECLARE @OnlineRegTokenPerDay INT

SET @OnlineRegTokenPerDay=10

declare @dteStart date
declare @dteEnd date
declare @dtStart smalldatetime
declare @dtEnd smalldatetime
Select @dteStart = GETDATE()+2
Select @dteEnd = GETDATE()+20


CREATE TABLE #working_hours (FullDates SMALLDATETIME);

while @dteStart <= @dteEnd
BEGIN
print @dteStart

   IF    datename(WEEKDAY, @dteStart) <> 'Saturday'
 AND DATENAME(WEEKDAY, @dteStart) <> 'Sunday'
 AND @dteStart not in ('2019-01-14','2019-01-26')--any special date of holiday
 BEGIN
SET @dtStart=@dteStart
insert into #working_hours values (@dtStart)
  END
   Select @dteStart = DATEADD(day,1,@dteStart)
END

Select * From #working_hours

10 September 2018


Windows 10 uses the new Photos app as your default image viewer, but many people still prefer the old Windows Photo Viewer. You can get Photo Viewer back in Windows 10

 It can be activate by Enable Photo Viewer in the Registry

Activate-Windows-Photo-Viewer-on-Windows-10


Run the “Activate Windows Photo Viewer on Windows 10” hack to create the keys and values in the Registry and activate Photo Viewer.

To associate an image file with Photo Viewer, right-click any type of image file—for example, a .png, .jpg, .gif, or .bmp file—and select Open With > Choose Another App.

In the “How do you want to open this file?” window, select Windows Photo Viewer. If you don’t see it at first, scroll to the bottom of what’s listed and click the “More apps” option—it’ll show up. Select the “Always use this app to open .___ files” option, and then click “OK.”

31 May 2018

Problem
When you select to install .NET Framework in the Windows Features list in the Control Panel, it does not complete. After asking if you’d like to use Windows Update, it then gives you an error code 0x800F081F

Solution
  • Insert Windows 10 installation CD or mount the ISO
  • Open an administrator command prompt
  • Type the following command (substitute correct drive letter)
    Dism /online /enable-feature /featurename:NetFx3 /All /Source:X:\sources\sxs /LimitAccess
Note : Change drive name to "X:" in the path.

You need "microsoft-windows-netfx3-ondemand-package.cab" from windows 10 .IOS file in order to run this command

07 September 2017

Found another cool animated loading effect in hexagon shape.


Lets try it.





    
    
    
 
    Content platform
    
 





 

29 May 2017

I had a requirement to get second and forth Saturday in a month.

Here is a SQL Server query which allow to get it done.



select *
    from (
    select datein2n4,
               datename( weekday, datein2n4 ) as wkdy,
               row_number( ) over ( partition by datepart( month, datein2n4 ), datename( weekday, datein2n4 ) order by datein2n4 ) as rn_dy_mth
        from (
            select dateadd( day, rn, cast( '2017-05-29 00:00:00' as date ) ) as datein2n4
            from (
                select row_number() over( order by object_id ) - 1 as rn
                from sys.columns
                ) as rn
            ) as dy
        ) as dy_mth
    where rn_dy_mth in ( 2, 4 )
      and wkdy = 'Saturday'
    order by datein2n4

26 May 2017

Creating Database using Amazon RDS is very eary.

See detailed documentation about creating a Microsoft SQL Server DB Instance and Connecting to a DB Instance

After that you can connect SQL Server from SQL Server Management Studio.

Amazon automatically configured Inbound permission to the IP from which it is created from.
While connecting from other PC or Hosting server you will receive bellow error:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 53)


Also connection Asp.net website you need to apply Connection String by:




Solution : 
 You need to apply  INBOUND rules for permission to that IP

In Security Group option


You can use WhatIsMyIp.com to get Source IP address.
Amazon has its own Check IP website : http://checkip.amazonaws.com/


Thanks

25 May 2017

Amazon Web Service EC2 configuration is very very easy!
Its totally free service.

EC2 stands for Amazon Elastic Compute Cloud.

URL : https://console.aws.amazon.com/ec2

Help : https://aws.amazon.com/documentation/ec2/

Select EC2 :

Resource Summary Page: 
Click on "Launch Instance"

Choose an Amazon Machine Image (AMI), Operating System Selection:
An AMI is a template that contains the software configuration (operating system, application server, and applications) required to launch your instance. You can select an AMI provided by AWS, our user community, or the AWS Marketplace; or you can select one of your own AMIs.

Choose an Instance Type :
Amazon EC2 provides a wide selection of instance types optimized to fit different use cases. Instances are virtual servers that can run applications. They have varying combinations of CPU, memory, storage, and networking capacity, and give you the flexibility to choose the appropriate mix of resources for your applications. Learn more about instance types and how they can meet your computing needs.






Configure Instance Details :
Configure the instance to suit your requirements. You can launch multiple instances from the same AMI, request Spot instances to take advantage of the lower pricing, assign an access management role to the instance

You can create multiple instance for same configuration in this step.


Add Storage : 
Your instance will be launched with the following storage device settings. You can attach additional EBS volumes and instance store volumes to your instance, or edit the settings of the root volume. You can also attach additional EBS volumes after launching an instance, but not instance store volumes. Learn more about storage options in Amazon EC2.


Add Tags :
A tag consists of a case-sensitive key-value pair. For example, you could define a tag with key = Name and value = Webserver.
A copy of a tag can be applied to volumes, instances or both.
Tags will be applied to all instances and volumes. Learn more about tagging your Amazon EC2 resources.
 

Configure Security Group :
A security group is a set of firewall rules that control the traffic for your instance. On this page, you can add rules to allow specific traffic to reach your instance. For example, if you want to set up a web server and allow Internet traffic to reach your instance, add rules that allow unrestricted access to the HTTP and HTTPS ports. You can create a new security group or select from an existing one below. Learn more about Amazon EC2 security groups.


Review Instance Launch :
Review your instance launch details. You can go back to edit changes for each section. Click Launch to assign a key pair to your instance and complete the launch process.

Get Public Key and Private Key File
 
Launch Status:
Server instance installation is now ready to launch.

Summary of existing EC2 instance :

Get Windows Password : 





 
 In order to retrieve windows administration password, you need to upload "Key Pair" file which was download earlier. "instance-name.pem" file.


 See the password on screen :

Now server instance is ready to access
Use IPv4 Public IP, Username and password with Remote Desktop Connection.

Thanks

Trying to send email from Godaddy Hosting!

Its show below error:
Request for the permission of type 'System.Net.Mail.SmtpPermission,
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Solution :

MailMessage mail = new MailMessage();
mail.From = new MailAddress("email address", "FriendlyName");
mail.To.Add("send to email address");
mail.Subject = "Subject for email";
mail.Body = "Some Message";
mail.IsBodyHtml = true;

SmtpClient smtp = new SmtpClient("smtp.mydomain.com");

smtp.Host = "relay-hosting.secureserver.net";
smtp.Port = 25;
smtp.EnableSsl = false;


smtp.Credentials = new NetworkCredential("email_address", "password");
smtp.Send(mail);

30 April 2015

Models:
These are the classes that represent the domain you are interested in. These domain
objects often encapsulate data stored in a database as well as code that manipulates the data
and enforces domain-specific  c business logic. With ASP.NET MVC, this is most likely a Data
Access Layer of some kind, using a tool like Entity Framework or NHibernate combined
with custom code containing domain-specific logic.

View:
This is a template to dynamically generate HTML.

Controller:
This is a special class that manages the relationship between the View and the
Model. It responds to user input, talks to the Model, and decides which view to render.