Skip to main content

Posts

Notes on regex sed, bash DOM html, meta tag

Using bash tool sed, awk, grep, vim ... to edit multiple file. Case study DOM tag <html DOCTYPE, meta, charset... https://unix.stackexchange.com/questions/26284/how-can-i-use-sed-to-replace-a-multi-line-string Sed cheatsheet https://gist.github.com/asenchi/2291903 HTML meta tags (recommend way ?) https://www.quackit.com/html_5/tags/html_meta_tag.cfm Example <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml " xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html" charset="EUC-JP" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta name="description" content="content here" ...

Notes PSQL, Apache X-Forwarded-Proto ...

 PSQL search column by name; select t.table_schema,        t.table_name from information_schema.tables t inner join information_schema.columns c on c.table_name = t.table_name                                 and c.table_schema = t.table_schema where c.column_name = 'last_name'       and t.table_schema not in ('information_schema', 'pg_catalog')       and t.table_type = 'BASE TABLE' order by t.table_schema; oh detail ab flow request HTTP to HTTPS only To understand X-Forwarded-Proto you have to understand the normal flow of communication when a client makes an HTTP request to a HTTPS-only resource. https://community.pivotal.io/s/article/Purpose-of-the-X-Forwarded-Proto-HTTP-Header   https://stackoverflow.com/questions/2987433/how...

Notes Windows 10 Virtualbox config, PHP Storm Japanese, custom PHP, Apache build, Postgresql

 cmd => Ctrl + Shift + Enter mklink "C:\Users\HauNT\Videos\host3" "C:\Windows\System32\drivers\etc\hosts" https://www.quora.com/How-to-create-a-router-in-php https://serverfault.com/questions/225155/virtualbox-how-to-set-up-networking-so-both-host-and-guest-can-access-internet 1 NAT + 1 host only config https://unix.stackexchange.com/questions/115464/how-to-properly-set-up-2-network-interfaces-in-centos-running-in-virtualbox DEVICE=eth0 TYPE=Ethernet #BOOTPROTO=dhcp BOOTPROTO=none #IPADDR=10.9.11.246 #PREFIX=24 #GATEWAY=10.9.11.1 #IPV4_FAILURE_FATAL=yes #HWADDR=08:00:27:CC:AC:AC ONBOOT=yes NAME="System eth0" [root@localhost www]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 # Advanced Micro Devices, Inc. [AMD] 79c970 [PCnet32 LANCE] DEVICE=eth1 IPADDR=192.168.56.28 <= no eff => auto like DHCP #GATEWAY=192.168.56.1 #BOOTPROTO=dhcp BOOTPROTO=static <= no eff ONBOOT=yes HWADDR=08:00:27:b4:20:10 [root@localhost www]# ...

Slow Ubuntu boot time caused by service - this case php7.2-fpm

1min 2.221s phpsessionclean.service          59.989s apt-daily.service          18.665s ModemManager.service          17.564s php7.2-fpm.service https://superuser.com/questions/1323790/phpsessionclean-service-causes-long-boot-time-in-debian-sid sudo systemctl disable php7.2-fpm.service https://unix.stackexchange.com/questions/315502/how-to-disable-apt-daily-service-on-ubuntu-cloud-vm-image https://itsfoss.com/how-to-fix-system-program-problem-detected-ubuntu/ sudo journalctl --boot oh apport report is required in order to make system boot success (done).

JS vs PHP closure, some exp in large and nightmare code base

https://medium.com/javascript-scene/master-the-javascript-interview-what-is-a-promise-27fc71e77261 https://stackoverflow.com/questions/7417430/javascript-closures-vs-php-closures-whats-the-difference experience on refactoring/working with  nightmare code base https://softwareengineering.stackexchange.com/questions/221615/why-do-dynamic-languages-make-it-more-difficult-to-maintain-large-codebases Caveat: I have not watched the presentation. I have been on the design committees for JavaScript (a very dynamic language), C# (a mostly static language) and Visual Basic (which is both static and dynamic), so I have a number of thoughts on this subject; too many to easily fit into an answer here. Let me begin by saying that it is hard to maintain a large codebase, period. Big code is hard to write no matter what tools you have at your disposal. Your question does not imply that maintaining a large codebase in a statically-typed language is "easy"; rather the question p...

Rand mm 11 nightmare to maintain, DI Java example

Video speaking is much more better than text, it duration, stop, image, voice ... is lost when move to text. So create an app/tool for simulate or rebuild the speak may be cool. Tone seem hard to be reproduce, AI can help but can it hear like real one? https://www.quora.com/Is-Node-js-code-a-nightmare-to-maintain Some interesting case on context 'this' https://codeburst.io/all-about-this-and-new-keywords-in-javascript-38039f71780c https://documenter.getpostman.com/view/1066979/signely/RW1UN2uD?version=latest#8f0d3bd8-33c4-485d-a81d-7f1073475ed9 clone save some microservice poS socket.io vs RabbitMQ, Kafka ... try. Oh constant vs define is much more than I think https://www.linkedin.com/pulse/php-difference-between-define-constant-ankit-vishwakarma/ https://www.quora.com/Amazons-Aurora-has-a-new-storage-engine-What-technology-is-that-storage-engine https://www.journaldev.com/2394/java-dependency-injection-design-pattern-example-tutorial https://stackoverflo...

Chrome youtube iframe magnific popup autoplay

https://github.com/dimsemenov/Magnific-Popup/issues/725 Yah MP have patterns Late to the party, in case someone needs to use the actual embed URL for Magnific, here is my process: Write a function that gets the input URL, checks it's format and then ensures that the /embed/ url is returned. In Magnific markup always use the processed URL which is in the embed format. Add the following patterns to magnific, to essentially use the input URL as the url without processing it further: // Video popup, Backend enforces embed URL before it gets here.     $('.js-popup-video').magnificPopup({         type: 'iframe',         iframe: {             patterns: {                 youtube: {                     index: 'youtube.com/',                     id: function (url) ...