Create a web worker
ng generate web-worker webWorker
and move the fibonacci function into the file:
// webWorker-demo/src/app/webWorker.ts
function fibonacci(num) {
if (num == 1 || num == 2) {
class CustomAppBar extends PreferredSize { | |
final Widget child; | |
final double height; | |
CustomAppBar({@required this.child, this.height = kToolbarHeight}); | |
@override | |
Size get preferredSize => Size.fromHeight(height); | |
@override |
const List<String> SECURITY_QUESTIONS = [ | |
"What city were you born in?", | |
"What is your favorite food?", | |
"Where did you go to high school?", | |
"What was the first company that you worked for?", | |
"What was the name of your first pet?", | |
"What is the name of the road you grew up on?", | |
"What is your mother’s maiden name?", | |
"What Is your favorite book?", | |
"Where is your favorite place to vacation?", |
// Sample 1 | |
db.sequelize.transaction(t => { | |
var promises = []; | |
for (let i = 0; i < usersData.length; i++) { | |
promises[i] = UserRepository.createUser(usersData[i], {transaction: t}); | |
} | |
return Promise.all(promises).then(users => { | |
var userRolePromises = []; | |
for (var i = 0; i < users.length; i++) { | |
userRolePromises.push(UserRole.create({ |
const t = await db.sequelize.transaction(); | |
const promises = []; | |
for (let i = 0; i < usersData.length; i++) { | |
promises[i] = UserRepository.createUser(usersData[i], {transaction: t}); | |
} | |
Promise.all(promises).then(users => { | |
const userRolePromises = []; | |
for (let i = 0; i < users.length; i++) { | |
userRolePromises.push(RoleRepository.findRoleById(rows[users[i].email]).then(role => { | |
users[i].addRole(role); |
//One to One | |
bookDetail.hasOne(category); | |
category.belongsTo(bookDetail); | |
//One to Many | |
borrowBook.belongsTo(user,{foreignKey: 'user_id',}); | |
user.hasMany(borrowBook,{foreignKey: 'user_id',}); | |
//Many to Many | |
bookDetail.belongsToMany(author,{through: "book_author",foreignKey:'book_detail_id'}); |
sudo fuser -n tcp -k {port_number} |
// in cmd | |
netstat -aon | find "PORT_NUM" | |
// In bash: | |
netstat -na | grep "8080" | |
// In PowerShell: | |
netstat -na | Select-String "8080" | |
Sample Output: |
//check dev id | |
sudo fdisk -l | |
sample output: | |
Disk /dev/sdc: 14.3 GiB, 15376000000 bytes, 30031250 sectors | |
Units: sectors of 1 * 512 = 512 bytes | |
Sector size (logical/physical): 512 bytes / 512 bytes | |
I/O size (minimum/optimal): 512 bytes / 512 bytes | |
//Unmount the usb |
// Build docker file with a given tag | |
docker build -t {tag-name} {docker-location} | |
example -> docker build -t node-app-test . | |
//run docker in interactive mode | |
docker run -it -p {exposed-machine-port}:{application-port} {tag-name} | |
example -> docker build -t 9000:3000 node-app-text | |
// run container in the background/detach mode | |
docker run -d -p {exposed-machine-port}:{application-port} {tag-name} |