December 07, 2020

C# get windows user app data folder path

 Hi folks,

Today I will explain to get the folder path of the windows user specific app data for storing any program (app) based information in C# (.NET Framework, .NET CORE, .NET 5)


Source

using System;

using System.IO;

namespace NETFrameworkConsoleApp1

{

    class Program

    {

        static void Main(string[] args)

        {

            string dir = Path.Combine(

                Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),

                "FolderName"

            );

            Console.WriteLine("User Appdata Path: \n " + dir);

            Console.ReadLine();

        }

    }

}


Hope this helps you to customize your requirement.

References

https://docs.microsoft.com/en-us/dotnet/api/system.environment?view=net-5.0

Please share your comments and feedback to psrdotcom@gmail.com


C++ get windows user app data folder path

 Hi folks,

Today we will see how we can get the folder path of the windows user specific app data for storing any program (app) based information.


Source

#include <iostream>

#include <tchar.h>

#include <shlwapi.h>

#pragma comment(lib,"shlwapi.lib")

#include "shlobj.h"

using namespace std;

int main()

{  

    TCHAR szPath[MAX_PATH];

    // Get path for each computer, non-user specific and non-roaming data.

    if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szPath)))

    {

        // Append product-specific path

        PathAppend(szPath, _T("\\App Folder Path\\"));

        wcout << "User AppData Roaming Folder Path: \n" << szPath << endl << endl;

    }

    

    // Get path for each computer, non-user specific and non-roaming data.

    if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, 0, szPath)))

    {

        wcout << "System Program Files Folder Path: \n" << szPath << endl << endl;

    }

    cout << "==end==";

}


Hope this helps you to customize your requirement.

References

https://docs.microsoft.com/en-us/windows/win32/shell/csidl

Please share your comments and feedback to psrdotcom@gmail.com


November 10, 2020

Run or deploy Go (Golang) project code in IIS as web server

 Hi folks,

Today we are going to see, how we can run or deploy the Go (Golang) project in IIS.

Development

  1. Create your Golang project with web APIs
  2. Build the Go project
  3. Go build
  4. Result will be an .exe file
  5. Create a web.config file
  6. Update the following content

<?xml version="1.0" encoding="utf-8"?>

<configuration>

    <system.webServer>

        <handlers>

            <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />

        </handlers>

        <aspNetCore processPath=".\<<GoProject>>.exe" />

    </system.webServer>

</configuration>

Deployment 

  1. Place the <<GoProject.exe>> and web.config in IIS server accessible folder.
  2. Open IIS
  3. Create a new website
  4. Enter the web app details with port different from the project internal port
  5. Create or choose pool with .NET CLR version as "No managed code"
  6. The configured website looks like below
  7. After starting the website, user should be able to access the APIs
Hope, this information helps you to deploy the GOlang project in IIS.

 Request you send your feedback and comments to psrdotcom@gmail.com


October 31, 2020

Generate or Create ECDSA - Elliptic Curve Digital Signature Algorithm Keys using OpenSSL in Windows

 Hi folks,

Today we will see how we can create ECDSA (Elliptic Curve Digital Signature Algorithm) Keys


Pre-requisites

OpenSSL

Add openssl bin directory to the environment PATH variable 


Generate Keys

Open Powershell and execute the following commands

1. Get the ECC curves list

openssl ecparam -list_curves
2. Generate a private key using your chosen curve
openssl ecparam -name prime256v1 -genkey -noout -out private-key.pem
3. Generate public key from the private key
openssl ec -in private-key.pem -pubout -out public-key.pem

4. Create a self-signed certificate with 1 year validity
openssl req -new -x509 -config "<opensslDirPath>/share/openssl.cnf" -key private-key.pem -out cert.pem -days 360

5. Convert pem to pfx
get-content private-key.pem, cert.pem | out-file cert-with-private-key
openssl pkcs12 -export -inkey private-key.pem -in cert-with-private-key -out cert.pfx

 Note: Enter the password when prompted (Optional)

Now, you can install the PFX file and check the certificate properties and make use of it.

Send your valuable feedback and comments to psrdotcom@gmail.com


October 07, 2020

Microsoft Azure DevOps Boards move or copy tasks between projects

 Hi all,


Today we will go through the different ways to organize the work items in Microsoft Azure DevOps Boards.

Pre-requisites

User should have appropriate permissions in both the projects.


Moving the work items between projects

  • Select the required items from Boards -> Work items
  • Select the more options icon (...) from any one of the selected work item
  • Choose "Open selected items in Queries" options
  • Queries page navigation will happen
  • Select all the items from query results (Ctrl+A)
  • Select the more options icon (...) from any one of the selected work item
  • Choose "Move to team project" options
  • Queries Page

  • Move work item dialog opens up

  • Choose appropriate options and click Ok.
  • All the items would be listed in moved project queries window.
  • Click on "Save items" option.


Copy work items between projects

Export work items

  • Select the required work items
  • Select the more options icon (...) from any one of the selected work item
  • Choose "Open selected items in Queries" options
  • Queries page navigation will happen
  • Select all the items from query results (Ctrl+A)
  • Export the work items to CSV file



Import the work items

  • Navigate to the required project boards section where the work items has to be created
  • Click on "Import work items" option
  • Import work item

  • Queries page navigation will happen
  • Import work items

  • Choose the exported CSV file and click on "Import" button
  • The work items would be listed in queries section
  • Click on "Save items"
  • Navigate to "Work items" section to view the added work items.


Request you send your comments and feedback below or send mail : psrdotcom@gmail.com


October 06, 2020

Download Chrome Extension for offline Installation

 Hi folks,

I tried to use my extension for offline usage for a VM based PC browser which doesn't have internet to download the extension.

So, I have come up with this approach where you can download the chrome extension (.crx) file.

Find the extension ID

Sample browser extension URL in chrome web store is below

https://chrome.google.com/webstore/detail/previous-next-page/fmichikmgflpgibapdhepmodjdjemmda

Last word is the extension ID (fmichikmgflpgibapdhepmodjdjemmda)

Download the extension file

Browser: Use Mozilla Firefox or other browser but not chrome

Syntax

https://clients2.google.com/service/update2/crx?response=redirect&prodversion=<<browser_version>>&acceptformat=crx2,crx3&x=id%3D<<extensionID>>%26uc

Example

https://clients2.google.com/service/update2/crx?response=redirect&prodversion=85.0.4183.121&acceptformat=crx2,crx3&x=id%3Dfmichikmgflpgibapdhepmodjdjemmda%26uc

Install the extension

  1. Copy the .crx file to your offline computer
  2. Open Chrome browser
  3. Navigate to chrome://extensions
  4. Enable developer mode
  5. Drag and drop the .crx file

Hope you will be able to use the offline extensions in chrome.


Request you send your comments and feedback in blog or mail : psrdotcom@gmail.com


Convert JSON file to CSV with Python

 Hi folks,

Today I will explain the code to implement the Json2CSV conversion.

Make sure you have valid JSON file with an array of objects.

Sample:

"Users":[

{"id": 1, "Name": "Suresh Raju", "Age": 35},

{"id":2, "Name": "PSR", "Age": 34}

]

I have chosen Python language to convert because of inbuilt library support for json and csv and command line execution with Notepad++ as editor.

Source Code Snippet: GitHub Gist

Please send your valuable feedback and comments to psrdotcom@gmail.com


Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com