2020年6月23日 星期二

Web crawling By Puppeteer @ Node.js - Part 2/2, How to make it work on Android?


Outlines

1. Install ubuntu on Android by AndroNix
2. Install node.js and puppeteer
3. start web crawling
4. advanced adjustments to display chinese characters


2020年6月22日 星期一

Web crawling By Puppeteer @ Node.js - Part 1/2

# Introduction


  • Puppeteer is a node.js library that achieves web crawling by an automated chromium browser (chrome open source project)
  • Unlike other methods needing to send pure http requests and parse responses yourself, even needing to handle cookies manually, your syntax is simply: 
  • Launch browser -> emulate real user operations on the web page -> get any data that is reachable by a real user

Web crawling by puppeteer is very simple.

This is part 1/2, in part 2/2 I'll demonstrate how to make it work on Android

# Getting Started

Start by installing:

  • npm install puppeteer

2019年10月17日 星期四

Javascript combinations enumeration (not fast)

comb=function(a,n){
  var ids=new Array(n).fill(0).map((i,ind)=>ind);
  var res=[];
  //console.log(indexes);
  var evs="";
  for(i in ids)
    evs+=`for(ids[${i}]=((ids[${i}-1]==null)?(-1):ids[${i}-1])+1;ids[${i}]<=a.length-n+${i};ids[${i}]++){\n`;
  evs+=`res.push(a.filter(    (ii,ind)=>(ids.indexOf(ind)!=-1)    ));\n`;
  evs+="}\n".repeat(n);
  console.log(evs);
  eval(evs);
  return (res);
}





2019年9月23日 星期一

Simple dialog / list dialog in javascript using jquery & bootstrap




First, include jquery and bootstrap

2019年9月3日 星期二

WebUSB/Arduino on Windows 8 - How to make it work

Recently I'm playing with arduino and hoped to utilize the WebUSB API to enable cross-platform control over my arduino board. Here's some directions on how to get it work:

Outlines

  • Get a board that is compatible: I used Arduino Leonardo
  • Download ArduinoDroid for Android
  • Download WebUSB library
  • Upload your sketch to the board
  • Install Zadig on your windows to replace the original Driver and let it work