Skip to main content

Posts

Showing posts from December, 2018

Opening huge file, comparison Editor: Vim, Emacs, Sublime-Text ...

Sometime we mistake open a huge file because we forgot the size of dump database or open wrong file. It take huge time and computer hang on. But Emacs seem no problem. I have tried many editor and Emacs seem open all not only size but whatever file extension like pdf or  zip... I am too lazy to re-test these editor and provide evident.

Docker with Geohot - From the Transistor: Xilinx on MAC

There are some cool idea from geohot in how he deal with Docker, for example, create a localhost HTTP file server for local fetch/download on the fly.

Note Angular 6+ (p3)

ngx-select-dropdown required validation Default ngx-dropdown input required not work. <ngx-select-dropdown [config] = " exerciseDropdownConfig " [options] = " exercises " [(value)] = " exercise_id " ></ngx-select-dropdown> https://github.com/optimistex/ngx-select-ex/issues/44 [(value)]="exercise_id" : exercise_id is ngModel or formControlName in reactive form ? It seem   exercise_id : [ '' , [Validators. required ]] ,   not work, exercise value selected now is an ojbect ie. {['id': 1, 'name': 'Exercise 1']}; So validation need some work around. $ sign in typescript indicate it is Observable https://stackoverflow.com/questions/37671700/angular2-style-guide-property-with-dollar-sign Create object based on interface https://stackoverflow.com/questions/13142635/how-can-i-create-an-object-based-on-an-interface-file-definition-in-typescript Interface vs Model, when to use ? different ? nterfa...

Note some architecture, technical design and decision

Read-receipt (remembering TX*:-) Skype notice that over 20 users in a room may have some different in read receipt. I believe this is a limit to assume that read-receipt working reliably. And in paid version I think Skype offer much larger number. In technical aspect, this is clever way to both notice user problem with big room (20 people and lager) and hide/reduce technical requirement on Developer side. https://dzone.com/articles/software-rebuilding-make-it-or-break-it

Note some Laravel, NGINX, NodeJS deploy

Avoid/reduce log output on Laravel Console https://stackoverflow.com/questions/49346700/laravel-disable-artisan-console-output-when-running-tests Gcloud SSH issue Jun 20 06:37:18 instance-3 sshd[12753]: Connection closed by 113.190.235.xxx port 7600 [preauth] Jun 20 06:37:19 instance-3 sshguard[1393]: Blocking 113.190.235.188:4 for >630secs: 40 danger in 4 attacks over 184 seconds (all: 40d in 1 abuses over 184s). sudo service sshguard restart USER=root ; COMMAND=/usr/sbin/service sshguard restart Jun 20 06:45:11 instance-3 sudo: pam_unix(sudo:session): session opened for user root by vandung53cc(uid=0) Jun 20 06:45:11 instance-3 sshguard[1393]: Got exit signal, flushing blocked addresses and exiting... Jun 20 06:45:11 instance-3 sudo: pam_unix(sudo:session): session closed for user root Jun 20 06:45:11 instance-3 sshguard[12902]: Started with danger threshold=40 ; minimum block=420 seconds Jun 20 06:45:15 instance-3 sshd[12909]: Connection closed by 113.190.235.188 por...

Note Docker 27-11 lumen microservices Bamboo AWS ECR

mysql: build: ./mysql volumes: - ./mysql/startup:/docker-entrypoint-initdb.d volumes_from: - volumes_data ports: - "3309:3306" environment: MYSQL_ROOT_PASSWORD: 1234 However to run php artisan from workspace container I need .env to specify port 3306: DB_HOST=mysql DB_DATABASE=local_a DB_USERNAME=root DB_PASSWORD=1234 DB_PORT=3306 I guess this is because I am connecting container to container, however maybe this will help someone. Docker https://github.com/FabrizioCafolla/microservice-lumen/wiki https://www.poweredlocal.com.au/ php redis osx => may be manual build/install https://stackoverflow.com/questions/50456780/run-mysql-on-port-3307-using-docker-compose https://github.com/guillaumebriday/laravel-blog/blob/master/docker-compose.yml https://medium.com/@shakyShane/laravel-docker-part-1-setup-for-development-e3daaefaf3c Authen header bearer http://self-issued.info/docs/draft-ietf-oauth-v2-bearer.html#authz-header Ubuntu VPS work without header Auth...

How exp important in SE: productivity, exp, creativity

1. How to ask the right questions so that you solve the right problem 2. How to work with complex, homegrown systems in someone else's code base 3. How to connect the right data to a system made of several moving parts 4. How to estimate accurately, especially when it comes to dependencies on other people 5. How to learn new technologies and apply them correctly 6. How to be disciplined and create code that you can maintain years down the road Random moments :)

S3 auto build Angular sample script

$ cat ./web-app/buildspec.yml version: 0.1 environment_variables:     plaintext:         S3_BUCKET: "staging.yoursite.com" phases:     install:         commands:             - echo Installing source NPM dependencies...             - npm install             - npm install -g @angular/cli     build:         commands:             - echo Build started on `date`             - ng build     post_build:          commands:             - aws s3 cp dist s3://${S3_BUCKET} --recursive             - echo Build completed on `date` artifacts:     files:         - '**/*'     base-directory: 'dist*'

Note React 2

Debugging https://medium.com/@baphemot/intro-to-debugging-reactjs-applications-67cf7a50b3dd Sync/update input from URL params https://stackoverflow.com/questions/36596996/how-to-sync-redux-state-and-url-query-params https://stackoverflow.com/questions/35352638/how-to-get-parameter-value-from-query-string/48256676#48256676 https://developmentarc.gitbooks.io/react-indepth/content/life_cycle/birth/post_mount_with_component_did_mount.html https://tylermcginnis.com/react-router-url-parameters/ Structure project https://medium.freecodecamp.org/how-to-structure-your-project-and-manage-static-resources-in-react-native-6f4cfc947d92 Deploy app, pm2 (again!) https://hackernoon.com/start-to-finish-deploying-a-react-app-on-digitalocean-bcfae9e6d01b This also say something y we should use proxy (ie. NGINX) to reduce Web server (PM2, Apache) task. React server side rendering It seem React have something that need run on server side, so it not alway hosted on S3 as Angular build ...

Note Angular 6+ (p2)

isUndefinedOrNull() angular.isUndefinedOrNull = function(val) {     return angular.isUndefined(val) || val === null } https://blog.angularindepth.com/everything-you-need-to-know-about-the-expressionchangedafterithasbeencheckederror-error-e3fd9ce7dbb4 https://stackoverflow.com/questions/16017699/how-can-i-check-which-version-of-angular-im-using https://github.com/eduardoboucas/include-media https://github.com/eduardoboucas/include-media https://angular.io/guide/reactive-forms https://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object Ext.Object.isEmpty({}); // true // not RxJS Common ng6+ err https://stackoverflow.com/questions/45467881/expressionchangedafterithasbeencheckederror-expression-has-changed-after-it-was https://stackoverflow.com/questions/44614108/when-does-angular-trigger-ngaftercontentchecked many hook here :) remember WP hookr ? FormControlName vs NgModel https://stackoverflow.com/questions/43669773/angul...

Notes CSS part 2

https://github.com/FrontendMasters/front-end-handbook-2018/blob/master/learning/html-css.md Use calc() right https://codepen.io/nicolasjengler/post/don-t-misuse-the-calc-css-function What is flexbox ? https://flexbox.io/ Table to Div from Hell to Hell https://www.smashingmagazine.com/2009/04/from-table-hell-to-div-hell/ Do some research on how to write HTML, CSS faster, more productive and less maintenance cost. https://www.quora.com/How-can-I-code-CSS-faster Agreed that wrong, improper HTML (often from customer, Frontend team) that lead to extra work to reinforcement,working around, tricky or hacky way of coding. And although agreed that most of CSS by the time is not needed but rarely we remove this because of aware that something removed may be used somewhere else. Especial with handover project. React require we write/rewrite everything, so it may be very effective in this case to tackle problems. Calc rounding number https://stackoverflow.com/questions/25938915...