Posts by Year

2020

wrong value: $(window).height()

less than 1 minute read

$(window).height() gets the same value with $(document).height() , because I forgot to add <!DOCTYPE html> Source

Java: StringBuilder

1 minute read

StringBuilder: A mutable sequence of characters ```java StringBuilder sb = new StringBuilder();

HashMap vs TreeMap

less than 1 minute read

HasbMap based on hashtable. HashMap dont have natural order, but Tree Map has. such as: treeMap.keySet() is incresed set of number // treeMap.descending...

GIT CL

less than 1 minute read

Create repositories ``` $ git init Turn an existing directory into a git repository

xml2js

less than 1 minute read

Parse XML TO Object xml2js

http-proxy-middleware

less than 1 minute read

http-proxy-middleware For node.js, redirect request to other port like “localhost: 3001”

Localhost Fetch API: meet CORS

less than 1 minute read

if we meet No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. If an opaque response...

Leetcode: 1266

1 minute read

1266. Minimum Time Visiting All Points On a plane there are n points with integer coordinates points[i] = [xi, yi]. Your task is to find the minimum time in...

Java: Reverse String

less than 1 minute read

There are many ways to reverse string, I list two solutions that are not that normal:

Leetcode: 1290

less than 1 minute read

1290. Convert Binary Number in a Linked List to Integer

Leetcode: 1221

less than 1 minute read

1221. Split a String in Balanced Strings

Never use Godaddy!!!

less than 1 minute read

I had canceled my domain service about one year, and it charge me again at today. I canceled service last year and did the refund, how does it renew again???...

Leetcode: 1295

less than 1 minute read

1295. Find Numbers with Even Number of Digits Given an array nums of integers, return how many of them contain an even number of digits.

Leetcode: 1281

less than 1 minute read

1281. Subtract the Product and Sum of Digits of an Integer

Leetcode: 1365

1 minute read

1365. How Many Numbers Are Smaller Than the Current Number

Leetcode: 1342

1 minute read

1342. Number of Steps to Reduce a Number to Zero

Java: binary(Bitwise) operator

less than 1 minute read

The Bitwise Operators Java defines several bitwise operators, which can be applied to the integer types, long, int, short, char, and byte.

Jest: beginner tutorial

3 minute read

Start up Create a folder named: Jest-test Open Terminal and commond: npm init -y Install Jest: npm i -D jest (D for dependency) Open package.json, m...

Appium: find elements and click

1 minute read

```python This is a script showcasing what are the different ways to find number 9-button on the calculator app on Android. These same principles can be used...

Android: uiautomatorviewer

less than 1 minute read

Inside /Users/feng/Library/Android/sdk/tools/bin Local that folder, then write command ./uiautomatorviewer to run uiautomatorviewer Notice: uiautomato...

ADB: check the emulator

less than 1 minute read

Activity: Input in terminal: adb shell dumpsys activity | grep -i run Version: adb shell getprop ro.build.version.release

Set JAVA_HOME on Mac

less than 1 minute read

Input $ export JAVA_HOME=$(/usr/libexec/java_home) in terminal set Bin directory of JAVA_HOME : export PATH=${JAVA_HOME}/bin:$PATH

Set ‘ANDROID_HOME’ on Mac

less than 1 minute read

Default$ export ANDROID_HOME=/Applications/ADT/sdk My mac: $export ANDROID_HOME=/Users/feng/Library/Android/sdk Add this to the PATH environment vari...

Python: connect Android phone

less than 1 minute read

Install JDK, Link Input javac in terminal to test if installation successful Install Android SDK Link Install ADB Open Android Studio, find Tools&...

Python: Amazon price tracking

less than 1 minute read

1.pip install request bs4 Using BeautifulSoup get website script, then caught specific element text content by ID. Using smtplib send email How to get...

Load Testing Service

less than 1 minute read

Recording a perfect website load testing service: Flood Flood can generate load test with unlimited concurrent users in free plan with few limitation. Consi...

Install carthage on Mac OSX

less than 1 minute read

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null brew install carthage

axios: status error handling

less than 1 minute read

My backend check user register information, if user submit wrong data, backend will send back response status 404 and error message.

Python: install Pip on Mac

less than 1 minute read

1st step: curl https://bootstrap.pypa.io/get-pip.py > get-pip.py 2nd step: sudo python get-pip.py

React.js: using Hook in Class components

less than 1 minute read

I want to add React Router to my existing Class component, becasue I need to use nesting function, and there is a Hook useRouteMatch() I must use in class co...

React.js: add a new function for Datepicker

1 minute read

I am using Datepicker in my website The Datepicker doesn’t have function to exclude special times for each day, so I add some code to help it recognize date;...

Back to top ↑

2019

Load Testing Service

less than 1 minute read

Recording a well uisng load testing service: Flood The good thing about Flood is you can generate load test with unlimited concurrent users in free plan with...

React: DatePicker

less than 1 minute read

I found a useful DatePicker component for React.js:

JS: Object.assign()

1 minute read

source Using Object.assign() to copy and merge objects: Object.assign(target, source); find one or more source object to target object, and return target ...

JS: Date

less than 1 minute read

```js // Using Date() function var d = Date(); // Converting the number value to string a = d.toString() // Printing the current date document.w...

MongoDB: update error

less than 1 minute read

I try to update MongoDB collection by _id, but it is an ObjectID, I can’t use number _id which I got before to update it, finally, I find the answer: Quora

LeetCode:922. Sort Array By Parity II

less than 1 minute read

Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even. Sort the array so that whenever A[i] i...

LeetCode: 1122. Relative Sort Array

less than 1 minute read

Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1. Sort the elements of arr1 such that the r...

DOM Scripting: Reading Note 2

2 minute read

Chapter 3 The DOM D: Document O: Object User-defined objects; Native objects: like Array, Math and Date; Host objects: provided by the borwser; Ho...

LeetCode:695. Max Area of Island

2 minute read

Given a non-empty 2D array grid of 0’s and 1’s, an island is a group of 1’s (representing land) connected 4-directionally (horizontal or vertical.) You may a...

DOM Scripting: Reading Note 1

4 minute read

This is the note of book: « DOM Scripting Web Design with JavaScript and the Document Object Model Second Edition »”

LeetCode: 969. Pancake Sorting

1 minute read

Given an array A, we can perform a pancake flip: We choose some positive integer k <= A.length, then reverse the order of the first k elements of A. We w...

JS: Map

less than 1 minute read

Resource

SEO

less than 1 minute read

Learning Website: https://yoast.com

Redux

1 minute read

Three Principles: Single source of truth: * Easy to create universal apps; * A single state tree make it easier to debug or inspect;...

AWS: PM2

less than 1 minute read

I use PM2 to let my Node.js running forever

AWS: Nginx

less than 1 minute read

Here is some command I use to install Nginx on AWS

JS: 3 tips

less than 1 minute read

Follow the Dev Ed, learn 3 new stuffs

AWS: connect EC2

less than 1 minute read

Run Git Bash as administrator Connect EC2 ` $ ssh ec2-user@public-ip-address -i ec2keypair.pem` Remove old directory $ rm -rf xx Clone new reposit...

JS: react-coverflow

less than 1 minute read

Today, I add react-coverflow in my website, this Multi-item carousel is very beautiful and easily to use;

JS: Password recover

less than 1 minute read

When user choose password recovery, back end server will send a email to customer email box. This email contain a password recovery form, customer can input ...

JS: confirmation email

1 minute read

When user create a new account, the system will send a email with a comfirmation link. I add token in comfirmation link as params, when user click this link,...

axios: error callback handling

less than 1 minute read

My backend check user register input, If input data is wrong, it will send back status 404 error with “error detail” message;

Js: Popup form

1 minute read

Popup form with animation, recording it for furture development.

Jekyll: different pages js file conflict

less than 1 minute read

I add a new word cloud on categroies page by using wordcloud2, but it shows errors in my tags apge, because I set all js files as document.load , it running ...

Websites: Netlify

less than 1 minute read

I post a demo website on Netlify today, Netlify is a free hosting for beginners who want to host a small website front end. Let me explain why it is suitable...

Chrome DevTools: computed

less than 1 minute read

Today, I spent large amount of time to check one mistake, I can not find any clues in “Styles” part of Chrome DevTools. Finally, I find it in “Computed”, le...

LeetCode: 905. Sort Array By Parity

less than 1 minute read

Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.

LeetCode: Move Zeroes

1 minute read

Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.

LeetCode: 832. Flipping an Image

less than 1 minute read

Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image.

Scratch: virtual programming

less than 1 minute read

In Scratch, all programming logical lanaguage are blocks. User can drag blocks and pull them inside the frame. Scratch also have “If…else”, but it use “for...

Back to top ↑