Unclassified interesting Tech Material - page 3
Achilles' heel of JS ecosystem, bad documentation:
Solution:
Found out by Piyusha Barhate.
The utility is cool..
https://www.atlassian.com/software/statuspage
- but expensive, may be a good idea to undercut them in pricing
https://github.com/alexmingoia/express-elasticsearch-logger#api-reference
- especially helpful for identifying bottlenecks.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html
But, AWS - SNS is pathetic in terms of logging and debugging issues !!
P A T H E T I C !
https://miro.com/
Really think this is going to boost productivity ?!?!?
Seems to be not structured at all..
I don't know if I will be able to imagine a "productive" workflow in the "miro" form factor at all.
TODO: review all these:
https://medium.com/better-programming/amazing-developer-tools-that-you-might-not-be-using-1ec7f57d17d5
https://github.com/rabbitmq/rabbitmq-delayed-message-exchange#supported-rabbitmq-versions
It seems that rabbitmq is maintaining repos very well:
- compatibility chart
https://www.rabbitmq.com/which-erlang.html
- installation instructions:
https://www.rabbitmq.com/install-debian.html#apt-bintray-erlang
I prefer the bin tray version of the installation
apt - get available versions; install specific versions
apt-cache madison package - install specific version:
apt-get install package=version
Whatsapp restore chat history, when number is same:
- https://faq.whatsapp.com/android/chats/how-to-restore-your-chat-history/?lang=en
My guess is:
Opening a set of windows.. terminals and tabs with correct folders open + other windows with proper settings and may be even positions:
still under research:
https://askubuntu.com/questions/930131/17-04-how-to-set-default-window-screen-position
https://stackoverflow.com/questions/1188959/open-a-new-tab-in-gnome-terminal-using-command-line
jq '.' # always provide a filter
https://stedolan.github.io/jq/tutorial/
- a lightweight and flexible command-line JSON processor
Other options:
https://ostechnix.com/how-to-parse-and-pretty-print-json-with-linux-commandline-tools/
-
jq or jshon, JSON parser for shell, both of them are quite useful.
-
Shell scripts like JSON.sh or jsonv.sh to parse JSON in bash, zsh or dash shell.
-
JSON.awk, JSON parser awk script.
-
Python modules like json.tool.
-
underscore-cli, Node.js and javascript based.
ArangoDB - How much space is your data going to take:
https://www.arangodb.com/2012/07/collection-disk-usage-arangodb/
Getting collection stats on a live database:
https://www.arangodb.com/docs/stable/http/collection-getting.html#return-statistics-for-a-collection
15.
https://keras.io/why_keras/
Seems like they have their adoption strategy figured out:
https://keras.io/why_keras/#keras-makes-it-easy-to-turn-models-into-products
React Native Calculator apps for learning:
https://www.cyblance.com/mobile-application/how-to-develop-a-calculator-app-using-in-react-native/
- good looking shaded buttons / almost looks like a dialer..
https://github.com/ReactNativeSchool/react-native-calculator
- nice rounded buttons
- may be the zero can be centred
- generally like to use calendar apps as my first tutorials
- works for a plethora of languages
Vega:
https://github.com/vega/vega
"declarative format for creating, saving, and sharing interactive visualization designs. With Vega you can describe data visualizations in a JSON format, and generate interactive views using either HTML5 Canvas or SVG"
- only js based dependencies
This theme reminds me of the KTM colour theme :)
https://marketplace.visualstudio.com/items?itemName=connor4312.codesong
Cypress - the premise is promising

Cypress demo by its founder:
https://www.youtube.com/watch?v=5XQOK0v_YRE
That is a cool cat !
- well composing urls is nasty business
Remote desktop clients for linux:
never tried any but for record's sake:
Pre-signed urls for S3 objects -
- Helpful when your client side software is simplistic (cannot handle streaming)
Debain based distros with smaller RAM and hard-disk footprint:
https://medium.com/swlh/top-11-mobile-app-analytics-platforms-pricing-included-cdc553578fd
https://thedutchlab.com/blog/using-axios-interceptors-for-refreshing-your-api-token
nicely done
React Native goto library for firebase notifications:
https://rnfirebase.io/messaging/usage
iOS -
https://rnfirebase.io/messaging/usage/ios-setup
Multi Model Databases
"openCypher is the most widely adopted, fully-specified, and open query language for property graph databases."
https://robertovitillo.com/default-timeouts/?s=09
Quoting:
Modern applications don’t crash; they hang. One of the main reasons for it is the assumption that the network is reliable. It isn’t.
"
- would like to add that, other services that are being called may be unreliable
The way out:
"never use “infinity” as a default timeout."
As a rule of thumb, always set timeouts when making network calls. And if you build libraries, always set reasonable default timeouts and make them configurable for your clients.
"
Nice package,
- minimal dependencies
- display pdf files in react app just like natively supported images
Index usage in databases:
Question:
https://stackoverflow.com/questions/15521084/is-index-dependent-on-selected-columns
https://ptsv2.com/s/whatisthis.html
Nice way to assess:
https://medium.com/@sepineda/full-stack-javascript-interview-questions-c132ec2c46a3
https://dev.to/nitish173/how-to-generate-a-debug-apk-in-react-native-1gdg
How compose a multipart request :)
You can create multipart/form-data
manually with XMLHttpRequest like this example.
function multiPost(method, url, formHash){ var boundary = "nVenJ7H4puv" var body = "" for(var key in formHash){ body += "--" + boundary + "\r\nContent-Disposition: form-data; name=" + formHash[key].name + "\r\nContent-type: " + formHash[key].type + "\r\n\r\n" + formHash[key].value + "\r\n" } body += "--" + boundary + "--\r\n" var xml = new XMLHttpRequest(); xml.open(method, url) xml.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + boundary) xml.setRequestHeader("Content-Length", body.length) xml.send(body) }
Translate terminal print and color to HTML
https://github.com/theZiz/aha
https://stackoverflow.com/questions/12643615/how-do-i-prettily-print-out-a-git-diff-output
Chrome sessions manual processing:
If you have the great suspender, you will hardly lose your sessions..
- Linux:
/home/<username>/.config/google-chrome/default
https://www.howtogeek.com/255653/how-to-find-your-chrome-profile-folder-on-windows-mac-and-linux/
OR
adb shell input keyevent 82
- then click inspects - a limited menu for inspecting similar to js should show up
- if you have the below running:
https://www.npmjs.com/package/react-devtools
ng server and ng serve both work ??!?!?!?!
My be specific to that particular project.
https://forbeslindesay.github.io/express-route-tester/
Used by express under the hood.
Express static route accedes to the next route if it did not fine a match.
This had me chasing my tail for a few minutes.
Convert curl to fetch:
https://kigiri.github.io/fetch/
This Android formData (multipart form data) and making a request have become a tiring hassle:
https://forums.expo.io/t/react-native-fetch-remote-http-request-throws-network-request-failed-on-android-device/34886
Files come from CameraRoll
has a different kind of URI, which should looks like assets-library://
on IOS and content://
on Android, these files are just like asset files.
- These files are
readonly
, you CAN NOT change them. - You CAN
copy
andread
these files. - You CAN pass these kind of URI to body of
fetch
request directly (usewrap
).
DID NOT WORK.
Encoded uri:
mtp://%5Busb%3A001,006%5D/Internal%20shared%20storage/
mtp://[usb:001,006]/Internal shared storage/
you actually can go to that folder with cd
. Though mount
or df
commands can't list it, but it's available under a gvfsd-fuse mounted folder, in my case it's /run/user/1000/gvfs
, find out that with
mount | grep 'gvfsd-fuse'
The mounted MTP device's filesystems are available under that folder with some crappy name.
cd
and Tab key for easier navigation.
Some systems don't have gvfsd-fuse
running by default. Make sure that you have it installed (on Debian and derivatives, it's in the gvfs-fuse
package).
Tried it. Worked for my Redmi Note 4.
Type casting HTML Element to a specific type of node:
https://stackoverflow.com/a/12687137
var script = <HTMLScriptElement>document.getElementsByName("script")[0];
https://stackoverflow.com/questions/17146889/click-event-not-firing-in-chrome-on-ios
this solution seems to work.
It is absurd..
https://blog.expo.io/sketch-a-playground-for-react-native-16b2401f44a2
https://github.com/necolas/react-native-web
Stopping gradle daemon process to free RAM:
~/.gradle/wrapper/dists/gradle-6.5-all/2oz4ud9k3tuxjg84bbf55q0tn/gradle-6.5/bin/gradle --stop
ps -aux | grep gradle
From the command get the path :D
React Native Setup:
Follow the react native cli quickstart
1. Install Java - OpenJDK - latest compatible version prefer LTS
2. Install Android Studio - complete with Android SDK, Android SDK Platform, and a Virtual Device
But will also need the expo setup to run things in the browser quickly :)
Follow expo cli section on: https://reactnative.dev/docs/environment-setup
https://docs.expo.io/guides/running-in-the-browser/
Install Java:
sudo apt-get install openjdk-11-jdk (LTS)
Test installation with:
watchman -v OR watchman version
I had forgotten this :P
so got this error:
https://blog.chirathr.com/android/ubuntu/2018/08/13/fix-avd-error-ubuntu-18-04/
Blob urls are cool:
https://www.html5rocks.com/en/tutorials/workers/basics/#toc-inlineworkers-bloburis
- quoting
"
The magic comes with the call to window.URL.createObjectURL()
.
This method creates a simple URL string which can be used to reference data stored in a
DOM File
or Blob
object. For example:
blob:http://localhost/c745ef73-ece9-46da-8f66-ebes574789b1
Blob URLs are unique and last for the lifetime of your application (e.g. until the document
is unloaded). If you're creating many Blob URLs, it's a good idea to release references that are
no longer needed. You can explicitly release a Blob URLs by passing it to window.URL.revokeObjectURL()
:
window.URL.revokeObjectURL(blobURL);
In Chrome, there's a nice page to view all of the created blob URLs: chrome://blob-internals/
.
https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
- browser support is almost universal.
does not work in iOS chrome :P rather odd
reports the same issue:
https://stackoverflow.com/questions/54398438/downloading-pdf-as-blob-not-working-on-chrome-ios
May be this:
this is in support: https://stackoverflow.com/a/53763420
but says everything else stops working :D
Aaaaaand, finally:
https://www.geeksforgeeks.org/how-to-trigger-a-file-download-when-clicking-an-html-button-or-javascript/
- solution with lower level APIs
- hopefully should be supported everywhere
Also, worth a look
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
Trigger a file download in a browser:
- html + inline js
https://stackoverflow.com/questions/11620698/how-to-trigger-a-file-download-when-clicking-an-html-button-or-javascript
$ journalctl --vacuum-time=10d ... Vacuuming done, freed 2.3G of archived journals on disk.
OR
$ journalctl --vacuum-size=2G ... Vacuuming done, freed 720.0M of archived journals on disk.
-- check if you ran our of file descriptors
When cloning a disk, what are the most important folders ?
https://averagelinuxuser.com/linux-root-folders-explained/
78.
Combining RxJs sequences:
nice diagrams and animations
https://indepth.dev/learn-to-combine-rxjs-sequences-with-super-intuitive-interactive-diagrams/
cascading calls promise vs Observables:
https://softchris.github.io/books/rxjs/cascading-calls/
79.
Need to sync clocks (Not GMRT level :D)
https://chrony.tuxfamily.org/doc/3.5/chronyd.html
But, well, close.
80.
Refresh token with HTTP interceptor:
https://itnext.io/angular-tutorial-implement-refresh-token-with-httpinterceptor-bfa27b966f57
Very clean an well commented piece of code:
https://gist.github.com/abereghici/054cefbdcd8ccd3ff03dcc4e5155242b#file-token-interceptor-service-ts
81.
ArangoDB uses only 1 index per query ?
https://www.arangodb.com/docs/stable/indexing-index-utilization.html
Is it too much to expect an index to be used for every FOR loop enumeration ?
OR am I expecting too much ?
The concept of bulk head in a service based architecture:
https://skife.org/architecture/fault-tolerance/2009/12/31/bulkheads.html
83.
Don't know if remote debugging for iOS chrome is available now:
https://stackoverflow.com/a/12607124
Easy with Safari it seems:
https://stackoverflow.com/a/22047495
Haven't tried this yet:
https://stackoverflow.com/a/38180826
Seems promising
85.
They should be awarded:
This is officially by Mozilla:
https://addons.mozilla.org/en-US/firefox/addon/facebook-container/
This is not: (but it should be)
86.
SwitchMap very nicely explained:
https://www.youtube.com/watch?v=6lKoLwGlglE
Observables chained:
makes for a very interesting design pattern
Retrying a failed request with angular observable APIs:
looks pretty neat.
https://angular.io/guide/http#retrying-a-failed-request
getSomething() { return this.http.get<SomeType>(this.someUrl) .pipe( retry(3), // retry a failed request up to 3 times catchError(this.handleError) // then handle the error ); }
88.
JSON resume
They have a lot of themes already !
https://jsonresume.org/themes/
https://npmsearch.com/?q=jsonresume-theme
Hmmn.. been wanting to make something like this for a very long time.
Can be easily exported to PDF.
####### Sunday 28 May 2023 08:26:35 AM IST #######
JPEG vs PNG vs GIF
very nicely explained and compared
https://stackoverflow.com/a/7752936
91.
A handy git shortcut:
https://git-scm.com/docs/git-diff#Documentation/git-diff.txt--R
This can get it done with less typing.
Weird issue:
Happens for the generator returned by this particular function: https://www.npmjs.com/package/levenshtein-search#fuzzysearch
93.
Angular build:- Javascript Heap out of memory error
Happens when:
- usually one module has too many components, makes the build process exceed 2GB
node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --prod
https://stackoverflow.com/a/53439291
- how to do it in package.json
"NODE_OPTIONS=--max_old_space_size=2048 ng build --prod --configuration=production --output-hashing=none && ng run ops-portal-web:server:production"
Incognito mode for the terminal:
1.
Kill the history file location env variable:
unset HISTFILE
https://askubuntu.com/a/6252872.
Slightly cleaner way according to me:
Stops the hisory mechanism from triggeringshopt -uo history # disables
shopt -so history # enables
https://askubuntu.com/a/625288
3. handy temporary fix:
$Space$
echo "Some secret text"
Bash ignores commands starting with space
https://askubuntu.com/a/625284 Note: This only works if the
HISTCONTROL
variable is set to ignorespace
or ignoreboth
.
95.
Adding formatted code snippets to blogger:
http://hilite.me/
- remember to copy the preview with the "Preview" text.. you can get things as below!!
94.
How to handle keyboard event in ionic
(generally content gets hidden by keyboard if you are not careful)
Add event listener:
window.addEventListener('native.keyboardshow', this.keyboardShowHandler); window.addEventListener('native.keyboardhide', this.keyboardHideHandler); keyboardHideHandler() { console.log('gone'); let removeStyles = <HTMLElement>document.querySelector("ion-app"); removeStyles.removeAttribute("style"); }
--x-x-x-x-
Implement the event listener:
keyboardShowHandler(e) { let kH = e.keyboardHeight; console.log("keyboard height", e.keyboardHeight); console.log("calculating " + kH + "-" + this.offsetY + "=" + (kH - this.offsetY)); let bodyMove = <HTMLElement>document.querySelector("ion-app"), bodyMoveStyle = bodyMove.style; bodyMoveStyle.bottom = (kH) + "px"; }
Thanks to:
-- Anurag Jade
95.
Wow ! How elaborate must the development process be:
https://www.tested.com/art/movies/449542-finding-nemo-3d-interview/
So many assets put together to generate film.
But also makes for a good entry barrier..
96.
Don't know whether to file it in humour or in the sad section:
https://www.youtube.com/watch?v=PI5wz2pwXIg
- stupid npm packages
- stupid using them
97.
Looks like a promising table render plugin.
https://gridjs.io/
98.
Bug in the JSON schema conditionals:
https://json-schema.org/understanding-json-schema/reference/conditionals.html
Bug:
https://www.jsonschemavalidator.net/s/8aOY0cCB
Schema:
{ "type": "object", "properties": { "prelimAilment": { "type": "object", "properties": { "confusedAboutStatus": { "type": "boolean" }, "cancerType": { "type": "string", "minLength": 1 }, "userCancerType": { "type": "string", "minLength": 1 } }, "dependencies": {}, "required": [], "minProperties": 1, "if": { "properties": { "cancerType": { "const": "Others" } } }, "then": { "required": [ "userCancerType" ] } } }, "dependencies": {} }
Data:
{ "prelimAilment": { "confusedAboutStatus": true } }
Expected to pass.
But:

Solution:
Schema:
{ "type": "object", "properties": { "prelimAilment": { "type": "object", "properties": { "confusedAboutStatus": { "type": "boolean" }, "cancerType": { "type": "string", "minLength": 1 }, "userCancerType": { "type": "string", "minLength": 1 } }, "required": [], "minProperties": 1, "if": { "properties": { "cancerType": { "const": "Others" } }, "required": [ "cancerType" ] }, "then": { "required": [ "userCancerType" ] } } } }
Vinakaya S.V.
99.
Angular 2+ detect click outside a div:

100.
VueJS dynamic components:
https://vuejs.org/v2/guide/components.html#Dynamic-Components
https://vuejs.org/v2/guide/components-dynamic-async.html
Example usage:
https://codesandbox.io/s/github/vuejs/vuejs.org/tree/master/src/v2/examples/vue-20-dynamic-components-with-binding?file=/index.html:0-16
https://codesandbox.io/s/github/vuejs/vuejs.org/tree/master/src/v2/examples/vue-20-dynamic-components
A big shout-out to VueJS for the incredible implementation of dynamic components !!
You can even pass a component to a component as an input argument.
Can be done in AngularJS to but VueJS is elegant about it.
Angular will have too much boiler plate too in the implementation.
Continued from:
https://swlearninglog.blogspot.com/2019/02/unclassified-interesting-tech-material.html
Comments
Post a Comment