By Stephen Quan in AppStudio 31 Jul 2019
I posted “Hello World” in BASIC (Iterators and Generators in AppStudio) on GeoNet AppStudio Blog Posts.
By Stephen Quan in Unix 18 Jul 2019
I posted on https://askubuntu.com/a/1159138/327700 instructions for mounting Windows shares on Ubuntu 18.04:
# /etc/fstab
\\contoso\share /mnt/share cifs vers=1.0,credentials=/root/.smb
# /root/.smb
username=billgates
password=secret
domain=microsoft
By Stephen Quan in AppStudio 17 Jul 2019
I posted “for of” loops and destructuring in AppStudio on GeoNet AppStudio Blog Posts.
By Stephen Quan in JavaScript 01 Jul 2019
I posted on https://stackoverflow.com/a/56829821/881441 a code snippet for breaking ‘infinite’ running Javascript functions:
function execWithTimeout(gen, timeout = 100) {
const limit = Date.now() + timeout
for (let output of gen()) {
console.log(output)
if (Date.now() > limit) throw(new Error("Timeout reached"))
}
}
function *runInfinite() {
let i = 0
while (1) {
yield i++
}
}
execWithTimeout(runInfinite)
By Stephen Quan in AppStudio 27 Jun 2019
I posted AppStudio_InputValidator.qml on GitHub Gist which demonstrates an InputValidator on a TextField.
By Stephen Quan in Unix 21 Jun 2019
I updated tar and split with examples that help upload large content to your enterprise cloud base document management systems (e.g. Box, OneDrive and Google Drive).
By Stephen Quan in AppStudio 19 Jun 2019
I posted Sorting QML ListModels on GeoNet AppStudio Blog Posts.
function listModelSort(listModel, compareFunction) {
let indexes = [ ...Array(listModel.count).keys() ]
indexes.sort( (a, b) => compareFunction( listModel.get(a), listModel.get(b) ) )
let sorted = 0
while ( sorted < indexes.length && sorted === indexes[sorted] ) sorted++
if ( sorted === indexes.length ) return
for ( let i = sorted; i < indexes.length; i++ ) {
listModel.move( indexes[i], listModel.count - 1, 1 )
listModel.insert( indexes[i], { } )
}
listModel.remove( sorted, indexes.length - sorted )
}
By Stephen Quan in AppStudio 05 Jun 2019
I posted Promises in AppStudio on GeoNet AppStudio Blog Posts.