How to Find the Size of LocalStorage

Sometimes, an error occurred (Failed to execute ‘setItem’ on ‘Storage’: Setting the value of ‘xxxxx’ exceeded the quota Vue) when adding data to local storage due to storage being full, but not sure which one uses more and how much it is, Found below code which is very helpful. one line version var _lsTotal=0,_xLen,_x;for(_x in localStorage){ if(!localStorage.hasOwnProperty(_x)){continue;} _xLen= ((localStorage[_x].length + _x.length)* 2);_lsTotal+=_xLen; console.log(_x.substr(0,50)+" = "+ (_xLen/1024).toFixed(2)+" KB")};console.log("Total = " + (_lsTotal / 1024).

Add Disk Storage to VirtualBox on Centos7

Add the Virtual Dirve Open Oracle VM VirtualBox Manager, select the virtual box which we want to add the storage, click Settings Click Storage, Select Drive (Controller: SCSI or Controller: IDE etc.) and click Adds hard disk Follow the instructions to enter all the details, such as disk file location, size etc. Partition the New Drive and file system # the new driver assigned to /dev/sdb ls /dev/sd* /dev/sda /dev/sda1 /dev/sda2 /dev/sdb # partition with fdisk fdisk /dev/sdb # change: DOS Compatibility flag is not set (command 'c') and Changing display/entry units to sectors (command 'u') # enter n (new partion) , p(primary partition), 1 (partition number) ls /dev/sd* /dev/sda /dev/sda1 /dev/sda2 /dev/sdb /dev/sdb1 # create a file system /sbin/mkfs.

SQL to check Bitbucket user permission

Bitbucket permission can be assigned at project level or repository level for a group and user. The SQL (MSSQL Server) below can be used to check all projects & repositories permission for a given user, include the access assigned to an individual user or a group. with repo_access as ( select distinct p.id as "Project ID", p.name as "Project Name", r.name as "Repo Name", cu.id as "User ID (Individual)", cu.user_name as "Username (Individual)", Concat(cu.

Retrieve and Export BitBucket server users

Sometimes, we wish to check if a BitBucket user has actually used his account or not. There is a post Query for inactive or idle users which has explained few different ways. I will try the API method. In this exercise, I try to achieve few things below with Python Send request to BitBucket server and get the list of users Convert the Unix timestamp to readable date time Export the user data to a csv file This is the sample code to get the information and export to csv file.

Install Docker on Ubuntu 18.04

Docker is very popular tool which creates container in the application development, same software, configuration will be packaged and used for testing and production. In this exercise, we will install docker in a Ubuntu server Check Ubuntu version lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.3 LTS Release: 18.04 Codename: bionic Update package sudo apt-get update Remove old version if exists sudo apt-get remove docker docker-engine docker.

Api test automation with mocha and chai

Mocha is a JavaScript test framework running on Node.js and in the browser, which can be used for unit testing, and api and ui automated testing, here we will use it along with chai to do some api automated testing in nodejs with typescript. Packages We will install packages below with yarn add or npm install @types/chai-http @types/mocha @types/node chai chai-http mocha mochawesome ts-mocha ts-node typescript typings Writing tests Mocha BDD interface will be used to create the test case.

Reading and writing serial port data with PowerShell

List com ports To see a list of available com ports, PS C:\> [System.IO.Ports.SerialPort]::getportnames()<br /> COM1<br /> COM2<br /> COM3 Read or write data To read or write data with given details, such as port, Baudrate etc. $port= new-Object System.IO.Ports.SerialPort COM3,9600,None,8,one $port.open() $port.WriteLine("some string data") $port.ReadLine() $port.Close() Write unix time I have a clock which accepts unix time for syncing the time, so I use script below to sync the time if the clock being off for few minutes after some time.

Download UFT script from ALM

Usually we use ALM to manage our test cases, test script and resource files, which works very well, but when we consider to host the script in git, we have to download them to local and commit to git. In this exercise, I try to download UFT scripts and resource files in UFT with using ALM OTA , the OTA api reference can be found here, and here is the code.

Firebase login in docker toolbox

The exercise is trying to resolve the Firebase login callback issue in docker; my system setup is VirtualBox with Docker toolbox. Let’s start with the login command: # firebase login Visit this URL on this device to log in: https://accounts.google.com/o/oauth2/auth?client_id=5635aa84335869-fgrhgmd47baqnekij5i8b5pr03ho849e6.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplatformprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=547585715&redirect_uri=http%3A%2F%2Flocalhost%3A9005 Waiting for authentication… Then I copy the long URL, and paste it to a browser window in host machine, allow the FirebaseCLI access, the authentication is working fine, but failed at callback.

Add make to Git Bash on Windows

Recently I need to use make command which is not packaged with Git Windows by default, and come across this git hub page, which mentioned how to add few commands to Git Bash on windows, this is quite handy and solved my problem. make Go to ezwinports. Download make-4.1-2-without-guile-w32-bin.zip (get the version without guile). Extract zip. Copy the contents to your Git\mingw64\ merging the folders, but do NOT overwrite/replace any existing files.