Showing posts with label How To. Show all posts
Showing posts with label How To. Show all posts

Friday, May 03, 2024

8 Best Free Disk Space Analyzer Tools to Streamline Your Hard Drive Management

Managing disk space efficiently is crucial for the optimal performance of any computer. Free disk space analyser tools are essential for identifying and removing unnecessary files, thereby freeing up valuable disk space. This blog presents a comprehensive overview of the top eight free disk space analyser tools that can aid in streamlining and optimizing hard drive management.

1. TreeSize Free : TreeSize Free supports the removal of files within the program, scans individual folders and entire hard drives, and offers a portable option. It operates exclusively on Windows. This is my personal favourite.

2. Disk Savvy : Disk Savvy offers a user-friendly interface with extensive features, including the ability to categorize files in several ways, perform simultaneous scans of multiple locations, and export results to a report file. It supports various Windows operating systems.

3. Windows Directory Statistics (WinDirStat) : WinDirStat provides unique visualization methods to analyse disk space and configure custom clean up commands. It can scan entire drives or specific folders and works exclusively on Windows.

4. Disktective : Disktective is a portable tool that allows scanning of large files in specific folders or entire drives. It provides two ways to view disk space usage and is suitable for Windows users.

5. JDiskReport : JDiskReport displays disk space usage in five perspectives and is suitable for users on Windows, macOS, and Linux operating systems.

6. RidNacs : RidNacs features a minimal and simple interface with a portable option. It scans large files in specific folders or entire drives and is exclusive to Windows.

7. SpaceSniffer : SpaceSniffer provides results that can be filtered in multiple ways, backed up, and opened without rescanning. It is only compatible with the Windows operating system.

8. Folder Size : Folder Size integrates with File Explorer, allowing users to sort folders by size. It is extremely user-friendly but is designed only for older versions of Windows.


Selecting the right disk space analyser tool depends on specific requirements and the operating system used. The featured tools provide a range of functionalities, from user-friendly interfaces to visual representations of disk space usage. By leveraging these free applications, users can efficiently manage their hard drive space, leading to enhanced system performance and productivity. 

Thursday, July 27, 2023

Moving Google Chrome Profiles to a New Computer

Are you tired of juggling between Incognito tabs or re-entering credentials and MFA codes every time you manage different client's Office 365 environments in Chrome? Discover the power of Chrome profiles, or "People," which allows you to efficiently manage multiple client environments simultaneously and retain your authentication sessions even after closing the browser window.

In this guide, we'll walk you through the step-by-step process of migrating Chrome profiles, ensuring a seamless transition to a new computer without losing any crucial data. 

Step 1: Backing Up Chrome Profiles To start the migration process, we first need to back up the Chrome profiles on the computer where they are currently stored. Follow these steps:

  1. Navigate to this path on your computer: C:\Users\%username%\AppData\Local\Google\Chrome\
  2. Locate and copy the "User Data" folder, which contains all the necessary profile data.

Additionally, we need to export a specific registry key that holds essential information related to the profiles:

  1. Press "Win + R" to open the Run dialog box, then type "regedit" and hit Enter.
  2. In the Registry Editor, go to [HKEY_CURRENT_USER\Software\Google\Chrome\PreferenceMACs].
  3. Right-click on "PreferenceMACs" and select "Export."
  4. Save the exported registry key to the same portable media where you stored the "User Data" folder.

Step 2: Moving Chrome Profiles to a New Computer Now that you have your Chrome profile data backed up on portable media, let's proceed with the migration on your new computer:

  1. Ensure that all Chrome browser windows are closed, and no instances of "chrome.exe" are running in the background.
  2. Copy the "User Data" folder from the portable media to this path on your new computer: C:\Users\%username%\AppData\Local\Google\Chrome\
  3. Double-click the exported registry key that you saved to the portable media during Step 1. This will merge the key into your new computer's registry.

Step 3: Embrace the Seamless Experience Congratulations! You've successfully migrated your Chrome profiles to the new computer. Now, open Chrome, and you'll find all your profiles conveniently present and ready to use. No more hassle of logging in multiple times or losing authentication sessions when switching between clients' Office 365 environments.

Final Thoughts: Chrome profiles, or "People," offer a powerful solution for managing different client environments efficiently. By following these simple steps, you can seamlessly migrate your Chrome profiles to a new computer without losing any crucial data. Embrace the convenience and organization that Chrome profiles bring to your workflow and say goodbye to unnecessary logins and wasted time. Enhance your productivity and enjoy a smooth browsing experience with Chrome profiles today!   

Happy browsing!

Tuesday, July 18, 2023

How to downgrade the installed version of 'pip' on windows?

If you want to upgrade or downgrade to different version of pip, you can do it in multiple ways.

To go back to particular version, use below command

python -m pip install pip==23.1.2

If you want to upgrade or downgrade using single command, use below command with specific version

python -m pip install --upgrade pip==23.1.2

If you want to upgrade to latest version, use below command

python -m pip install --upgrade pip

Hope this helps!!

Thursday, July 13, 2023

How to read JSON list from JavaScript

To read a list of JSON objects in JavaScript, you can use the JSON.parse() function to parse the JSON string into a JavaScript object or an array.

Here's an example:

var jsonString = '[{"name":"Maximus","age":30},{"name":"Peter Parker","age":25},{"name":"Bob Krammer","age":40}]';

// Parse the JSON string into an array of objects
var jsonArray = JSON.parse(jsonString);

// Iterate over the array and access the properties of each object
for (var i = 0; i < jsonArray.length; i++) {
  var obj = jsonArray[i];
  console.log("Name: " + + ", Age: " + obj.age);

In the above example, the jsonString variable holds a JSON string representing an array of objects. The JSON.parse() function is used to parse the JSON string into the jsonArray variable, which becomes an array of objects.

You can then iterate over this array and access the properties of each object as shown in the for loop.

Note that the JSON string should be well-formed, with double quotes around property names and string values.

Hope this helps!

Tuesday, June 13, 2023

What is a SQL Injection Attack?

SQL injection is a type of web application security vulnerability and attack that occurs when an attacker is able to manipulate an application's SQL (Structured Query Language) statements. It takes advantage of poor input validation or improper construction of SQL queries, allowing the attacker to insert malicious SQL code into the application's database query.

SQL Injection attacks are also called SQLi. SQL stands for 'structured query language' and SQL injection is sometimes abbreviated to SQLi

Impact of SQL injection on your applications

  • Steal credentials—attackers can obtain credentials via SQLi and then impersonate users and use their privileges.
  • Access databases—attackers can gain access to the sensitive data in database servers.
  • Alter data—attackers can alter or add new data to the accessed database. 
  • Delete data—attackers can delete database records or drop entire tables. 
  • Lateral movement—attackers can access database servers with operating system privileges, and use these permissions to access other sensitive systems.
  • Types of SQL Injection Attacks

    There are several types of SQL injection:

  • Union-based SQL Injection – Union-based SQL Injection represents the most popular type of SQL injection and uses the UNION statement. The UNION statement represents the combination of two select statements to retrieve data from the database.
  • Error-Based SQL Injection – this method can only be run against MS-SQL Servers. In this attack, the malicious user causes an application to show an error. Usually, you ask the database a question and it returns an error message which also contains the data they asked for.
  • Blind SQL Injection – in this attack, no error messages are received from the database; We extract the data by submitting queries to the database. Blind SQL injections can be divided into boolean-based SQL Injection and time-based SQL Injection.
  • SQLi attacks can also be classified by the method they use to inject data:

  • SQL injection based on user input – web applications accept inputs through forms, which pass a user’s input to the database for processing. If the web application accepts these inputs without sanitizing them, an attacker can inject malicious SQL statements.
  • SQL injection based on cookies – another approach to SQL injection is modifying cookies to “poison” database queries. Web applications often load cookies and use their data as part of database operations. A malicious user, or malware deployed on a user’s device, could modify cookies, to inject SQL in an unexpected way.
  • SQL injection based on HTTP headers – server variables such HTTP headers can also be used for SQL injection. If a web application accepts inputs from HTTP headers, fake headers containing arbitrary SQL can inject code into the database.
  • Second-order SQL injection – these are possibly the most complex SQL injection attacks, because they may lie dormant for a long period of time. A second-order SQL injection attack delivers poisoned data, which might be considered benign in one context, but is malicious in another context. Even if developers sanitize all application inputs, they could still be vulnerable to this type of attack.
  • Here are few defense mechanisms to avoid these attacks 

    1. Prepared statements:  These are easy to learn and use, and eliminate problem  of SQL Injection. They force you to define SQL code, and pass each parameter to the query later, making a strong distinction between code and data

    2. Stored Procedures: Stored procedures are similar to prepared statements, only the SQL code for the stored procedure is defined and stored in the database, rather than in the user’s code. In most cases, stored procedures can be as secure as prepared statements, so you can decide which one fits better with your development processes.

    There are two cases in which stored procedures are not secure:

  • The stored procedure includes dynamic SQL generation – this is typically not done in stored procedures, but it can be done, so you must avoid it when creating stored procedures. Otherwise, ensure you validate all inputs.
  • Database owner privileges – in some database setups, the administrator grants database owner permissions to enable stored procedures to run. This means that if an attacker breaches the server, they have full rights to the database. Avoid this by creating a custom role that allows storage procedures only the level of access they need.
  • 3. Allow-list Input Validation: This is another strong measure that can defend against SQL injection. The idea of allow-list validation is that user inputs are validated against a closed list of known legal values.

    4. Escaping All User-Supplied Input: Escaping means to add an escape character that instructs the code to ignore certain control characters, evaluating them as text and not as code.

    Saturday, November 19, 2022

    How to Delete “BIN and OBJ” folders via Batch file

    We had issues deleting bin and obj folders when we check in code or share code with in teams.

    Here is simple batch file that we can use to delete Bin and Obj folders.

    1. Create an empty file and name it DeleteBinObjFolders.bat

    2. Copy-paste the below code into the DeleteBinObjFolders.bat

    @echo off
    @echo Deleting all BIN and OBJ folders...
    for /d /r . %%d in (bin obj) do @if exist "%%d" rd /s/q "%%d"
    @echo BIN and OBJ folders successfully deleted.
    pause > nul

    3. copy this file to your solution (*.sln) location.

    4. Go to your project folder via command prompt and run this file DeleteBinObjFolders.bat file which is in the same folder with your solution (*.sln) file.

    Hope this helps!

    Sunday, June 13, 2021

    Git: How to set Git User Name and User email Globally & repository specific

    Usually when we install Git, we typically configure your global username and email address after installing Git. However, you can do so now if you missed that step or want to make changes. After you set your global configuration, repository-specific configuration is optional.

    Git configuration works the same across Windows, macOS, and Linux.

    To set your global username/email configuration:

    Open the command line.

    -- set user name
    $ git config --global "First Name Last Name"
    -- set user email
    $ git config --global ""

    To set repository-specific username/email configuration:

    From the command line, change into the repository directory.

    --Set your username
    $ git config "FIRST_NAME LAST_NAME"
    --Set your email address
    $ git config ""
    --Verify your configuration by displaying your configuration file
    $ cat .git/config

    Hope this helps!

    How to get list of column names from Table Variable @table

    A table variable is a variable data type which can be used to store temporary data. It's defined using the DECLARE keyword and the table's structure is defined in the declaration as shown below:

    declare @ns_source table
      col1_id int, 
      col2_name varchar(50),
      col3_desc varchar(50)

    Unlike temporary tables, table variables are not affected by a rollback. As regular variables, they keep the data which was modified during the transaction even if the transaction is rolled back.

    Coming to get columns from table varaiable, here is how we can get using below query.

    declare @ns_source table
      col1_id int, 
      col2_name varchar(50),
      col3_desc varchar(50)
    select DP.N.value('local-name(.)', 'sysname') as ColumnName
      select NS.*
      from (select 1) as D(N)
        outer apply (
                    select top(0) *
                    from @ns_source
                    ) as NS
      for xml path(''), elements xsinil, type
      ) as LV(X)
    cross apply LV.X.nodes('*') as DP(N)

    Result looks like below

    Saturday, May 29, 2021

    How to Get Columns details from SQL Tables

    Here is how you can get column names from specified table

    WHERETABLE_NAME = 'MobilityOrders'

    Here is how you can get column count from specified table

    WHERE TABLE_NAME = 'MobilityOrders'

    Here is how you can get column count from temp table

     SELECT COUNT(*) as Cnt FROM tempdb.sys.columns
     WHERE object_id = object_id('tempdb..#temp2')

    Hope this helps 😀

    Friday, May 21, 2021

    How to: Looping through reader count dynamically C#

    Here is how this can be done once you have the data call via Read methods
    using (var reader = await sqlDbContext.ExecuteReaderAsync(command))
        while (await sqlDbContext.ReadAsync(reader))
            // when count greaterthan 1
            if (reader.FieldCount > 1)
                if (!string.IsNullOrEmpty(reader["ItemD"].ToString()))
                    mobilityChangeOrdersItem.ItemID= reader["ItemID"] == null ? 0 : Convert.ToInt32(reader["ItemID"].ToString());
                if (!string.IsNullOrEmpty(reader["ID"].ToString()))
                    mobilityChangeOrdersItem.ID = reader["ID"] == null ? 0 : Convert.ToInt32(reader["ID"].ToString());
        //Looping through complete list of return variables to find out requrired column
        string errorMessge = " SQL Message: -- *Start* ItemD -- :: " + mobilityChangeOrdersItem.ItemD;
        while (await reader.NextResultAsync())
            var fieldvalues = Enumerable.Range(0, reader.FieldCount).Select(i => reader.GetName(i)).ToArray();
            while (await reader.ReadAsync())
                if (fieldvalues.Contains("ErrorMessage"))
                    errorMessge += Environment.NewLine + " ErrorMessage : " + reader["ErrorMessage"].ToString();
                if (fieldvalues.Contains("ErrorProcedure"))
                    errorMessge += Environment.NewLine + " ErrorProcedure : " + reader["ErrorProcedure"].ToString();
            errorMessge += Environment.NewLine + " SQL Message: -- *End*";
            mobilityChangeOrdersItem.StatusMessage = errorMessge;

    Hope this helps 😀

    Monday, April 19, 2021

    How to get only numbers from string sql

    I have column where I need to get only numbers form the string.

    Here is how we can do,

    SUBSTRING(columnName, PATINDEX('%[0-9]%', columnName), LEN(columnName))

    Here's the example with PATINDEX

    use databasego
    -- inventory Group, Employee , cost center
    select [Cost Center], [Inventory Group], Employee, 
    SUBSTRING(Employee, PATINDEX('%[0-9]%', Employee), LEN(Employee)) AS EmployeeID
    from  tmp_BulkOrder_SP_4_16_21

    Hope this helps 😀

    Sunday, March 21, 2021

    How to remove special characters from a string using a function with RegEx

    Here is how you can get remove special characters from a string in SQL

    -- SELECT dbo.[RemoveCharSpecialSymbolValue] ('naga3fg@#sai') 
    CREATE FUNCTION [dbo].[RemoveCharSpecialSymbolValue](@str VARCHAR(500))  
    DECLARE @startingIndex int  
    SET @startingIndex=0  
    WHILE 1=1  
    	SET @startingIndex= patindex('%[^0-9a-zA-Z]%',@str)  
    	IF @startingIndex <> 0  
    			SET @str = replace(@str,substring(@str,@startingIndex,1),'')  
    	ELSE BREAK;  
    RETURN @str  

    Hope this helps 😀

    Saturday, March 20, 2021

    How to remove alpha numeric characters from a string using function with RegEx

    Here is how you can get alpha numeric characters from a string in SQL

    -- SELECT dbo.[RemoveCharSpecialSymbolIntValue] ('naga3@#sai') 
    CREATE FUNCTION [dbo].[RemoveCharSpecialSymbolIntValue](@str VARCHAR(500))  
    DECLARE @startingIndex int  
    SET @startingIndex=0  
    	WHILE 1=1  
    		SET @startingIndex= patindex('%[^0-9.]%',@str)  
    		IF @startingIndex <> 0  
    			SET @str = replace(@str,substring(@str,@startingIndex,1),'')  
    		ELSE BREAK;  
    	RETURN @str  

    Hope this helps 😀

    Sunday, February 07, 2021

    How to remove ASCII Characters from a string using function

    Here is how you can remove ASCII characters from a string in SQL

    CREATE FUNCTION [dbo].RemoveASCIICharactersInRange(@InputString VARCHAR(MAX))
        IF @InputString IS NOT NULL
          DECLARE @Counter INT, @TestString NVARCHAR(40)
          SET @TestString = '%[' + NCHAR(0) + NCHAR(1) + NCHAR(2) + NCHAR(3) 
          + NCHAR(4) + NCHAR(5) + NCHAR(6) + NCHAR(7) + NCHAR(8) + NCHAR(11) 
          + NCHAR(12) + NCHAR(14) + NCHAR(15) + NCHAR(16) + NCHAR(17) 
          + NCHAR(18) + NCHAR(19) + NCHAR(20) + NCHAR(21) + NCHAR(22) 
          + NCHAR(23) + NCHAR(24) + NCHAR(25) + NCHAR(26) + NCHAR(27) 
          + NCHAR(28) + NCHAR(29) + NCHAR(30) + NCHAR(31) 
          + NCHAR(127)+ NCHAR(160)+ ']%'
          SELECT @Counter = PATINDEX (@TestString, @InputString COLLATE Latin1_General_BIN)
          WHILE @Counter <> 0
            SELECT @InputString = STUFF(@InputString, @Counter, 1, '')
            SELECT @Counter = PATINDEX (@TestString, @InputString COLLATE Latin1_General_BIN)

    Hope this helps 😀

    Wednesday, December 28, 2016

    How to: Show the Developer Tab on the Ribbon

    To access the Developer tab on the ribbon of an Office application, you must configure it to show that tab because it doesn't appear by default.

    1. Right click anywhere on the ribbon, and then click Customize the Ribbon.  customize-ribbon

    2. Under Customize the Ribbon, on the right side of the dialog box

    3. Check the Developer check box.  turn-on-developer-tab

    4. Click OK.

    5. You can find the Developer tab next to the View tab.  developer-tab

    Hope this helps!!

    Thursday, December 15, 2016

    How to change Excel column names form A,B,C to 1,2,3 or vice versa

    This happens when excel column labels are numeric rather than alphabetic. For example, instead of seeing A, B, and C at the top of your worksheet columns, you see 1, 2, 3, and so on.


    The A1 Reference Style

    By default, Excel uses the A1 reference style, which refers to columns as letters (A through IV, for a total of 256 columns), and refers to rows as numbers (1 through 65,536). These letters and numbers are called row and column headings.

    The R1C1 Reference Style

    Excel can also use the R1C1 reference style, in which both the rows and the columns on the worksheet are numbered. The R1C1 reference style is useful if you want to compute row and column positions in macros. In the R1C1 style, Excel indicates the location of a cell with an "R" followed by a row number and a "C" followed by a column number.

    To toggle between A1 and R1C1 Reference styles 

    1. Start Microsoft Excel.
    2. On the Tools menu, click Options.
    3. Click the General tab.
    4. Under Settings, click to clear the R1C1 reference style check box (upper-left corner), and then click OK.

    If you select the R1C1 reference style check box, Excel changes the reference style of both row and column headings, and cell references from the A1 style to the R1C1 style.


    Thursday, December 08, 2016

    How to Copy Files in Command Prompt using xCopy

    The Windows Command Prompt can be very powerful once you understand some of the commands. You can get a lot more control with the Command Prompt than you would by copying and pasting in Windows Explorer. Knowing how to make the most out of the copy commands is essential if you're remotely operating a Windows server. It's also great if you want to be more efficient with your own system.

    There are different ways to copy files using the Windows Command Prompt. All the commands can copy files from one place to another, but there are several cases where you may want to choose one command over the others.

    • XCOPY - The xcopy command allows you to copy files and directory trees. This makes it much more suitable for copying folders. xcopy also has many modifiers which gives advanced users more control over the copying process. xcopy has been deprecated in favor of robocopy, but still works.

    Example: C:\>xcopy c:\webshare\AppData\runtime\bin\admin\*.* c:\_backup\backup_20161208\admin /e /i

    XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
                               [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
                               [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B] [/J]

      source       Specifies the file(s) to copy.
      destination  Specifies the location and/or name of new files.
      /A           Copies only files with the archive attribute set,
                   doesn't change the attribute.
      /M           Copies only files with the archive attribute set,
                   turns off the archive attribute.
      /D:m-d-y     Copies files changed on or after the specified date.
                   If no date is given, copies only those files whose
                   source time is newer than the destination time.
                   Specifies a list of files containing strings.  Each string
                   should be in a separate line in the files.  When any of the
                   strings match any part of the absolute path of the file to be
                   copied, that file will be excluded from being copied.  For
                   example, specifying a string like \obj\ or .obj will exclude
                   all files underneath the directory obj or all files with the
                   .obj extension respectively.
      /P           Prompts you before creating each destination file.
      /S           Copies directories and subdirectories except empty ones.
      /E           Copies directories and subdirectories, including empty ones.
                   Same as /S /E. May be used to modify /T.
      /V           Verifies the size of each new file.
      /W           Prompts you to press a key before copying.
      /C           Continues copying even if errors occur.
      /I           If destination does not exist and copying more than one file,
                   assumes that destination must be a directory.
      /Q           Does not display file names while copying.
      /F           Displays full source and destination file names while copying.
      /L           Displays files that would be copied.
      /G           Allows the copying of encrypted files to destination that does
                   not support encryption.
      /H           Copies hidden and system files also.
      /R           Overwrites read-only files.
      /T           Creates directory structure, but does not copy files. Does not
                   include empty directories or subdirectories. /T /E includes
                   empty directories and subdirectories.
      /U           Copies only files that already exist in destination.
      /K           Copies attributes. Normal Xcopy will reset read-only attributes.
      /N           Copies using the generated short names.
      /O           Copies file ownership and ACL information.
      /X           Copies file audit settings (implies /O).
      /Y           Suppresses prompting to confirm you want to overwrite an
                   existing destination file.
      /-Y          Causes prompting to confirm you want to overwrite an
                   existing destination file.
      /Z           Copies networked files in restartable mode.
      /B           Copies the Symbolic Link itself versus the target of the link.
      /J           Copies using unbuffered I/O. Recommended for very large files.

    The switch /Y may be preset in the COPYCMD environment variable.
    This may be overridden with /-Y on the command line.

    Wednesday, November 09, 2016

    How to: Uninstall vs2013 or vs2015 completely

    When you uninstall from control panel there will be some packages do get left behind. Some are packages that do not participate in package ref-counting – often those that we do not build. Some package may be left behind because uninstalling packages in Visual Studio. If a package fails, uninstall will move on to uninstall the next package. Some are just too essential for other products to uninstall like the .NET Framework and Visual C runtimes: of the vast number of installers that chain them, too few ref-count them to rely on that feature.

    Whatever the cause, having components left behind will consume disk space and may cause troubles upgrading to Visual Studio RTM.

    This is how we can completely removing Visual Studio components left behind after an uninstall.

    Forcibly uninstall using original installer

    You do not need to have a bundle installed to forcibly uninstall packages by default. If you have the original installer – say, a previous download – you can run it directly like so:

    vs_enterprise.exe /uninstall /force

    Tuesday, October 25, 2016

    How to add/concatenate string in Excel

    The CONCATENATE function in Excel is designed to join different pieces of text together or combine values from several cells into one cell.

    The syntax of Excel CONCATENATE is as follows:
    CONCATENATE(text1, [text2], …)

    Concatenating the values of several cells
    The simplest CONCATENATE formula to combine the values of cells A1 and B1 is as follows:

    Concatenating a text string/formulas and cell value
    There is no reason for the Excel CONCATENATE function to be limited to only joining cells' values. You can also use it to concatenate various text strings and formulas to make the result more meaningful.
    For example:
    =CONCATENATE("Last Updated: ",TEXT(TODAY(), "mm/dd/yyyy"))

    Wednesday, September 14, 2016

    How to extract back up file?

    To manually extract files

    1. Open the Command Prompt window by clicking the Start button.
       In the search box, type Command Prompt, and then, in the list of results, click Command Prompt.
    2. Type the following command:
    C:\Users\Nagasai\Downloads>copy "Send_file_test.bak" “Send_file_test.mdb”

    Hope this helps!!!