How to Internationalizing your Flutter apps ?

First Reading:
Steps:1. add flutter_localizations dependencies into pubspec.yamldependencies: flutter: sdk: flutter flutter_localizations: sdk: flutter 2. add localizationsDelegates and supportedLocales into MaterialAppApplocalizations.delegate is your app-specific localization delegate. will be introduced in next step.
Widgetbuild(BuildContext context) { returnMaterialApp( localizationsDelegates: [ AppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: [ constLocale.fromSubtags(languageCode: 'zh'), // generic Chinese 'zh' constLocale.fromSubtags( languageCode: 'zh', scriptCode: 'Hans'), // generic simplified Chinese 'zh_Hans' constLocale.fromSubtags( languageCode: 'zh', scriptCode: 'Hant'), // g…

How to measure the maximum throughput (TPS - Transactions per Second) that a single website instance(host) can handle via curl tool ?

Image, a python script using curl to measure the time per transaction requested to your websitecurl --connect-timeout 10 --max-time 10 -o /dev/null -s -w "%{http_code},%{size_download},%{time_appconnect},%{time_connect},%{time_namelookup},%{time_pretransfer},%{time_starttransfer},%{time_total}" -k

#-*- coding: UTF-8 -*-

import commands
import getopt
import os
import re
import sys
import thread
import threading
import time

def help(code):
    print ' -A "useragent" -C "cookies" -H "header" -P "period" -T "tps" -U "url" -O "outputdir"'
    print 'examples:'
    print ' -U -T 20 -P PT5M'
    print ' -U -T 20 -P PT1H'

def check_args(a, c, h, p, t, u, o):
    if u == '':
        print 'no URL specified!'
    if t == '':
        print 'no TPS specified!'…

Python : How to run a function "foo" per second and last a few minutes or hours

ScenarioI tried to run a function "foo" every second. I have to do this for a few minutes (say 5).The function foo () sends 100 HTTP requests (including JSON objects) to the server and prints the JSON response.In short, I have to issue 100 HTTP requests per second for 5 minutes.Using threading.Timer #!/usr/bin/python import time import thread import threading def foo(): print time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())), threading.active_count() #5 minutes = 5 * 60 = 300 seconds for x in range(0, 300): t = threading.Timer(x + 1, foo) t.start() Expected outputfunction foo was executed per second and last about 5 minutes2020-05-14 00:54:49 301 2020-05-14 00:54:50 300 2020-05-14 00:54:51 299 2020-05-14 00:54:52 298 2020-05-14 00:54:53 297 2020-05-14 00:54:54 296 2020-05-14 00:54:55 295 ....... 2020-05-14 00:59:44 6 2020-05-14 00:59:45 5 2020-05-14 00:59:46 4 2020-05-14 00:59:47 3 2020-05-14 00:59:48 2

How to kill a bunch of processes which executed with almost same command ?

ScenarioSometimes we need to manually terminate the process. If not killing too many processes, it is easy to find the pid and kill it. But what if there are a bunch of processes that need to be terminated? Today I encountered such a problem, started a lot of python process, but the result can not stop.gkill Solutionadd below function to your bash profile, then source the profilefunction gkill() { ps -ef | grep ${1} | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 } Then you can kill all processes that matched your serach pattern via gkill command.gkill <search content> Extended knowledgeThe commands related to the termination process are:ps: report a snapshot of the current processkill: send a signal to a processkillall: kill process by namepkill: View or issue process signals based on name and other attributesskill: send a signal or report the process statusxkill: destroy a client program according to X resourcesxargs --no-run-if-empty, very usef…

Recommend GC log analyzer tool : GCPlot & GCeasy

GCPlotInstallDocker Installation
You can run GCPlot in a Docker container.In order to run GCPlot as-is without additional configuration, run next command:docker run -d -p 8080:80 gcplot/gcplotAfter that eventually the platform will be accessible from your host machine at address.
Upload GC logJVM arguments-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCCause -XX:+PrintHeapAtGC -XX:+PrintAdaptiveSizePolicy -XX:+UnlockDiagnosticVMOptions -XX:+G1SummarizeRSetStats -XX:G1SummarizeRSetStatsPeriod=1 -Xloggc:/var/output/logs/garbagecollector.log -XX:+UseG1GC Analysis GroupsUniversal GC Log Analyzer
It is more powerful than GCPlot, but you have to upload you GC logs to their backend and pay to see the analysis report.GCPlot is free and open sourceFork from github

English Language : 20 ways to give advice

MODALSYou have to ...You'd better ...You should ...You ought to ...You could ...CONDITIONALSIf I were you, I'd ...If I were in your shoes, I'd ...If you want my advise, I think ...If you really want to know, I'd ...If I were in your position, I'd ...FORMAL VERBSI suggest (that) you ...I recommend (that) you ...I urge you ...I would advise you to ...CASUALYou're gonna wanna ...You might wanna considerYou should probably considerYou should maybe think about ...Have you thought about ... ?What you yought do is ... ?

English Language : Adverbs of Intensity

OMG SO INTENSEcompletelytotallythoroughlyabsolutelyperfectlyextremelyUtterlyKind of intensefairlyrathersomewhatmoderatelyconsiderablynearlykind ofsort ofnoticeablepretty intenseawfullyprettyreallysoverymostlyquiteehh...a littlea bitslightlyCommon combinationsperfectlysort of blanda little hungryabsolutely certainpretty surequite goodnearly exaustedmostly finishednoticeably different