2020年12月23日 星期三

dotnet core redirect

 1. Good

ref: https://www.dotnettricks.com/learn/mvc/return-view-vs-return-redirecttoaction-vs-return-redirect-vs-return-redirecttoroute

ASP.NET MVC - View() vs RedirectToAction() vs Redirect() Methods



The Redirect() Method

This method is used to redirect to specified URL instead of rendering HTML. In this case, the browser receives the redirect notification and make a new request for the specified URL. This also acts like Response.Redirect() in Asp.Net WebForm. In this case, you have to specify the full URL to redirect.


Moreover, Redirect also cause the browser to receive a 302 redirect within your application, but you have to construct the URLs yourself.


public ActionResult Index()

{

 return View();

}


[HttpPost]

public ActionResult Index(string Name)

{

 ViewBag.Message = "Hi, Dot Net Tricks";

 //Like Response.Redirect() in Asp.Net WebForm

 return Redirect("Home/MyIndex");

}


public ActionResult MyIndex()

{

 ViewBag.Msg = ViewBag.Message; // Assigned value : Null

 return View("MyIndex");

############################################################################

############################################################################

2. How to redirect a request in ASP.NET Core MVC


Redirect("/Author/Index");
RedirectPermanent("/Author/Index");
RedirectPermanentPreserveMethod("/Author/Index");
RedirectPreserveMethod("/Author/Index");

2020年12月1日 星期二

iptables

 http://163.20.160.24/~pc/modules/tadnews/index.php?nsn=58


https://stevenitlife.blogspot.com/2020/01/k8s-cluster.html


https://mileslin.github.io/2019/05/%E7%9E%AD%E8%A7%A3-Docker-%E7%9A%84%E9%A0%90%E8%A8%AD%E7%B6%B2%E8%B7%AF%E8%A8%AD%E7%BD%AE/


http://linux.vbird.org/linux_server/0250simple_firewall.php


https://blog.jangmt.com/2015/09/centos7-firewalld-iptables.html


https://www.itread01.com/content/1541339230.html


https://blog.gtwang.org/linux/centos-7-firewalld-command-setup-tutorial/


https://www.hwchiu.com/iptables-1.html


https://www.digitalocean.com/community/tutorials/how-to-list-and-delete-iptables-firewall-rules


2020年11月30日 星期一

cenos7 virubual box Add storage

 https://sam.liho.tw/2020/07/06/virtualbox-%E6%94%B9%E8%AE%8A-centos-7-%E7%A1%AC%E7%A2%9F%E5%A4%A7%E5%B0%8F-%E8%AE%8A%E5%A4%A7%E7%82%BA%E4%BE%8B/

2020年11月27日 星期五

mariadb command

 1. Show table schema

show create table TABLENAME;

describe TABLENAME;


2.  show db parameter

show status like '%max%';


3. show all table and databases;

show  tables;
show databases;


4. Show Indexs;

show indexes from TABLENAME;

ref 1


4.2 Index For Hash and B-Tree
https://dev.mysql.com/doc/refman/8.0/en/index-btree-hash.html
https://stackoverflow.com/questions/7306316/b-tree-vs-hash-table


4.3 Index type
https://mariadb.com/kb/en/getting-started-with-indexes/

5. Analysze sequence 

show table status where name = 'tablename';

explain select * from tablename where condition;

ref 1


6.  deadlock

https://blog.gslin.org/archives/2014/10/29/5226/mysql-innodb-%E9%81%87%E5%88%B0-deadlock-%E6%99%82%E7%9A%84%E5%88%A4%E8%AE%80/

https://t.codebug.vip/questions-776021.htm


7. maraidb foreigin key

select concat(fks.constraint_schema, '.', fks.table_name) as foreign_table, '->' as rel, concat(fks.unique_constraint_schema, '.', fks.referenced_table_name) as primary_table, fks.constraint_name, group_concat(kcu.column_name order by position_in_unique_constraint separator ', ') as fk_columns from information_schema.referential_constraints fks join information_schema.key_column_usage kcu on fks.constraint_schema = kcu.table_schema and fks.table_name = kcu.table_name and fks.constraint_name = kcu.constraint_name -- where fks.constraint_schema = 'database name' group by fks.constraint_schema, fks.table_name, fks.unique_constraint_schema, fks.referenced_table_name, fks.constraint_name order by fks.constraint_schema, fks.table_name;

https://dataedo.com/kb/query/mariadb/list-foreign-keys


8. Look the priviledge

SHOW GRANTS;

https://dba.stackexchange.com/questions/63404/how-to-grant-super-privilege-to-the-user


9. Bin Log

https://kknews.cc/zh-tw/code/8vx9vbn.html

https://www.tw511.com/18/139/4051.html

http://benjr.tw/102425


10. Foregin key problem

https://www.cnblogs.com/shishibuwan/p/10863347.html




2020年11月26日 星期四

video learning

 

[Media] 影音傳輸-基礎知識

https://pjchender.github.io/2019/06/24/media-%E5%BD%B1%E9%9F%B3%E5%82%B3%E8%BC%B8-%E5%9F%BA%E7%A4%8E%E7%9F%A5%E8%AD%98/

avinfo字段说明

https://wcs.chinanetcenter.com/document/API/Appendix/avinfo-description



2020年11月25日 星期三

FFmpeg install on centos 7 and learning

 


https://www.tecmint.com/install-ffmpeg-in-linux/



https://lnpcd.blogspot.com/2012/09/ffmpeg.html


https://opensource.com/article/17/6/ffmpeg-convert-media-file-formats

2020年11月16日 星期一

case sensitivity in MySQL and MariaDB queries

 

#

https://mariadb.com/kb/en/insert-ignore/

#

https://mariadb.com/kb/en/supported-character-sets-and-collations/


#

https://uiop7890.pixnet.net/blog/post/22885702-%5B%E5%8E%9F%E5%89%B5%5D-utf8_unicode_ci-%E5%92%8C-utf8_bin-%E7%9A%84%E5%B7%AE%E7%95%B0

#

https://mariadb.com/kb/en/setting-character-sets-and-collations/

# office

https://mariadb.com/kb/en/setting-character-sets-and-collations/


# mb4

https://khiav223577.github.io/blog/2019/06/30/MySQL-%E7%B7%A8%E7%A2%BC%E6%8C%91%E9%81%B8%E8%88%87%E5%B7%AE%E7%95%B0%E6%AF%94%E8%BC%83/ 

#

https://exp.uniuni.space/she-ding-mariadb-bian-ma.html

#

https://federico-razzoli.com/case-sensitivity-in-mysql-and-mariadb-queries

2020年10月27日 星期二

wsdl

 http://sun.cis.scu.edu.tw/~nms9115/articles/delphi/WebServices/WebServices1.htm


https://snippetinfo.net/mobile/media/1827


https://crunchify.com/create-sample-wsdl-in-eclipse-and-generate-client/


https://www.guru99.com/wsdl-web-services-description-language.html


https://www.eclipse.org/webtools/community/education/web/t320/Implementing_a_Simple_Web_Service.pdf


https://medium.com/@ayushi21095/working-with-soap-based-web-service-using-python-8f532195bc6c



# good example

https://blog.csdn.net/jackphang/article/details/8788178

Docker network simple

 1. network can use

. route 

.ifconfig

-ip link, ip route



2. docker network

https://developers.redhat.com/blog/2018/10/22/introduction-to-linux-interfaces-for-virtual-networking/

https://www.thegeekdiary.com/how-to-disable-docker-process-and-docker0-interface-on-centos-rhel/


https://stackoverflow.com/questions/43240377/docker-on-centos-with-bridge-to-lan-network


# network virtaul

https://blog.csdn.net/Ghost_leader/article/details/71075551?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-7.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-7.channel_param


https://blog.csdn.net/zhangyexinaisurui/article/details/81837135


3.  docker network

https://ithelp.ithome.com.tw/articles/10206725

https://www.thegeekdiary.com/how-to-create-a-networking-bridge-under-centos-rhel/

https://godleon.github.io/blog/Docker/docker-network-bridge/

https://medium.com/@xiaopeng163/docker-bridge-networking-deep-dive-3e2e0549e8a0

https://k2r2bai.com/2016/01/05/container/docker-network/

2020年9月13日 星期日

Go Tutorial

 1. Simple

https://michaelchen.tech/golang-programming/write-first-program/

https://ithelp.ithome.com.tw/articles/10157141


https://michaelchen.tech/golang-programming/struct/

GO Tips

 1,  go comment have /* */ 


2.  go function input must declare type 

good:  func myFun(addr string) { ... }

bad:  func myFun(addr ) { ... }



3.  go functin return error type is error

good: func myFun(addr string) (string, error)  {

        if err != nil {

                return "", err

        }

        return "success", nil

}

4. go string connact can use plus



5.  Go cmd parameter use os package

func main() {
    if len(os.Args) != 3 {
        fmt.Println("Usage:", os.Args[0], "PATTERN", "FILE")
        return
    }
    pattern := os.Args[1]
    file := os.Args[2]
    // ...
}

2020年9月11日 星期五

go tcp connect

 https://www.linode.com/docs/development/go/developing-udp-and-tcp-clients-and-servers-in-go/

2020年9月9日 星期三

Mariadb settings

 https://www.azureunali.com/dbmysql-sql-mode%E7%9A%84%E8%A8%AD%E5%AE%9A/


https://rtfm.co.ua/en/aws-rds-sqlstate22001-data-too-long-for-column-using-mariadb-10-2/

2020年9月7日 星期一

PHP setting warnging message

 https://stackoverflow.com/questions/24506642/can-i-get-phps-pdo-to-return-mysql-warnings-instead-of-only-error-messages


2020年9月6日 星期日

Mariasql comment-doucment

 such as /*!5200 set XXX */



ref

https://stackoverflow.com/questions/1916392/how-can-i-get-rid-of-these-comments-in-a-mysql-dump

https://www.techonthenet.com/mariadb/comments.php


http://job.achi.idv.tw/2013/05/02/mysql-annotation-syntax/

mysql partition

 

1. https://cola.workxplay.net/mysql-partitioning-for-performance-optimization/


2. https://mariadb.com/kb/en/partitioning-limitations/

3. https://kkc.github.io/2017/07/07/mysql-partitioning/

2020年8月4日 星期二

PHP clousre and access modify object


: use 
and 
: &$ 

###
https://ourcodeworld.com/articles/read/712/how-to-change-the-value-of-a-variable-outside-of-the-scope-within-a-closure-function-in-php


https://ithelp.ithome.com.tw/articles/10132747

2020年8月3日 星期一

PHP change table name to lowcase




$subject = "From ab_cD efg";
$callback = function($match)
{
    //var_dump($match);
    //echo $match[1];
    return "FROM " . strtolower($match[1]) . " ";
    //return preg_replace($match[1], strtolower($match[1]) ,$match[0]);
};
echo preg_replace_callback('/from\s+([\w]+)\s*/i', $callback, $subject, 1);

 echo "\n";
echo preg_replace_callback('/from\s+([\w]+)\s*/i', $callback, "From ab_cD", 1);
 echo "\n";
echo preg_replace_callback('/from\s+([\w]+)\s*/i', $callback, "Fsssc ab_cD", 1);


ref
http://tools.jb51.net/regex/create_reg
// 将文本中的年份增加一年.
$text = "April fools day is 04/01/2002n";
$text.= "Last christmas was 12/24/2001n";
// 回调函数
function next_year($matches)
{
  // 通常: $matches[0]是完成的匹配
  // $matches[1]是第一个捕获子组的匹配
  // 以此类推
  return $matches[1].($matches[2]+1);
}
echo preg_replace_callback(
            "|(d{2}/d{2}/)(d{4})|",
            "next_year",
            $text);

2020年6月10日 星期三

Docker Cmd and redis

https://www.tecmint.com/run-docker-container-in-background-detached-mode/


https://github.com/sickp/docker-alpine-redis/blob/master/versions/4.0.4/Dockerfile

https://medium.com/@xyz030206/dockerfile-%E4%B8%AD%E7%9A%84-entrypoint-9653c3b2d2f8

2020年5月26日 星期二

dotnet core log

1. Using lograte http://n.sfs.tw/content/index/12926
2.  https://www.nuget.org/packages/NLog.Config/
3. https://dotblogs.com.tw/ricochen/2018/04/06/024020
4 https://blog.yowko.com/asp-net-core-default-log-nlog-serilog/
5. https://medium.com/@WilliamWhetstone/net-core-project-%E5%BE%9E%E9%9B%B6%E9%96%8B%E5%A7%8B-nlog-b8effb9561f9
6. https://blog.johnwu.cc/article/ironman-day19-asp-net-core-nlog-log4net.html

2020年5月24日 星期日

Nginx survey

1.  cache and buffer


2. nginux proxy

cache_2
cache_3
cache_4
cahce_5
https://blog.techbridge.cc/2017/06/17/cache-introduction/


https://smalltowntechblog.wordpress.com/2014/10/25/nginx-location-regex%E7%AD%86%E8%A8%98/

2020年5月20日 星期三

2020年4月27日 星期一

webpack


webpack learning
1. https://ithelp.ithome.com.tw/articles/10184762
2. https://neighborhood999.github.io/webpack-tutorial-gitbook/Part1/StartCoding.html
3. learning good: https://www.sitepoint.com/beginners-guide-webpack-module-bundling/
4. good choice: https://github.com/geelen/webpack-from-first-principles
5. wepack office en https://webpack.js.org/loaders/file-loader/#publicpath
6. wepack office ch  https://webpack.docschina.org/loaders/file-loader/
7. webpack public path https://juejin.im/post/5af11ab4f265da0ba5677ccc
8. fileloader used https://awdr74100.github.io/2020-03-09-webpack-urlloader-fileloader/

vue:
1. https://ithelp.ithome.com.tw/articles/10202470
2 https://devs.tw/post/60
3 https://cli.vuejs.org/guide/webpack.html
4 https://vue-loader-v14.vuejs.org/zh-cn/start/spec.html
5. https://vue-loader.vuejs.org/migrating.html#a-plugin-is-now-required
6. https://vue-loader.vuejs.org/guide/#manual-setup
7 https://ithelp.ithome.com.tw/articles/10213923
8. vue webpack: https://vuejs.org/v2/guide/installation.html
9. vue content: https://www.mmxiaowu.com/article/58482558d4352863efb55475
10. good vue install: https://www.lagou.com/lgeduarticle/19307.html
11.  good vue install2: https://segmentfault.com/a/1190000012789253


spa
1. https://code.tutsplus.com/tutorials/single-page-todo-application-with-backbonejs--cms-21417
2. https://www.sitepoint.com/single-page-app-without-framework/


babel:
1. https://www.ruanyifeng.com/blog/2019/02/npx.html
2. https://www.cybergrx.com/resources/blog/how-to-create-a-barebones-production-ready-npm-package-with-babel-7/
3. office: https://babeljs.io/docs/en/configuration
4. good chinesse: https://michaelchen.tech/javascript-programming/babel/
5. good with webpack: https://medium.com/i-am-mike/webpack%E6%95%99%E5%AD%B8-%E5%9B%9B-javascript-%E8%88%87-babel-1d7acd911e63
6. office runtime: https://babeljs.io/docs/en/babel-runtime
7.

css normal:
https://ithelp.ithome.com.tw/articles/10196528

2020年4月22日 星期三

doent core write files

1. https://www.c-sharpcorner.com/article/sending-files-from-web-api/

2. https://blog.johnwu.cc/article/ironman-day23-asp-net-core-upload-download-files.html

3.https://stackoverflow.com/questions/39994695/asp-net-core-api-controller-response-body-writeasync-base64-string-not-working

2020年4月19日 星期日

leaning js

https://ithelp.ithome.com.tw/users/20105814/ironman/2049?page=2


_Layout learning
https://vuestic.epicmax.co/admin/forms/form-elements

https://madewithvuejs.com/blog/the-best-vue-js-admin-dashboards


https://vuetifyjs.com/en/getting-started/quick-start/

2020年3月25日 星期三

dotnet core localization


https://damienbod.com/2017/11/01/shared-localization-in-asp-net-core-mvc/

# good
https://dotblogs.com.tw/shadow/2018/09/03/172157


https://www.jeffogata.com/asp-net-core-localization-culture/


# more culture class
https://dotnetcoretutorials.com/2017/06/22/request-culture-asp-net-core/

#  culture in mdsn
https://docs.microsoft.com/zh-tw/dotnet/api/system.globalization.cultureinfo?view=netframework-4.8

# cluture in glboal site
http://site.icu-project.org/

# source code
https://github.com/dotnet/aspnetcore/tree/master/src/Mvc/Mvc.Localization/src

# chinsse usinge
zh-hans or  zh-hant
http://newgoodlooking.pixnet.net/blog/post/126776133

# good  dotnet cultre
https://www.jeffogata.com/asp-net-core-localization-culture/

if zh-TW fail will search zh

# chisnse list
https://vector.cool/html5%E7%9A%84lang%E9%80%9F%E6%9F%A5-%E6%B3%A8%E6%84%8F%EF%BC%9A%E7%B9%81%E9%AB%94%E4%B8%AD%E6%96%87%E4%B8%8D%E6%98%AFzh-tw%E5%96%94/


# simple map
http://www.lingoes.net/en/translator/langcode.htm


# cookie setting
https://www.cnblogs.com/guzhenyin/p/9154447.html

npm using first


1. Go start 1

2020年3月18日 星期三

Node js Install


1. https://linuxize.com/post/how-to-install-node-js-on-centos-7/

2020年3月17日 星期二

jquery datetimepicker

https://xdsoft.net/jqplugins/datetimepicker/

https://github.com/xdan/datetimepicker

https://www.jqueryscript.net/demo/Clean-jQuery-Date-Time-Picker-Plugin-datetimepicker/

2020年3月10日 星期二

Vue site

1. learning

https://ithelp.ithome.com.tw/articles/10198843
https://medium.com/@rorast.power.game/vue-js%E7%B3%BB%E5%88%97%E4%BA%8C-%E4%BD%BF%E7%94%A8-vue-cli-3-79968e9fed7d


2. reference
toyko cov19 : https://github.com/tokyo-metropolitan-gov/covid19

https://www.metro.tokyo.lg.jp/index.html

2020年3月4日 星期三

ElasticSearch Learning reference

1.  Analyze

https://learnku.com/articles/35136
strip html
Office



2.  Study 

小信豬
 EBOOk


3. IDTF

計中     素人   


4. Work token

5.  analyze
https://tomme.me/elasticsearch-ik-analyzer-optimize/


https://mednoter.com/all-about-analyzer-part-one.html


fielddata

https://medium.com/@st0012/elasticsearch-analysis-b0418b3158d8

https://medium.com/@st0012/elasticsearch-analysis-b0418b3158d8


2020年3月3日 星期二

Elastic search - Date range with time_zone

1.
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html

paper: https://www.ijraset.com/fileserve.php?FID=11409
https://www.academia.edu/40608761/Elasticsearch_The_Definitive_Guide_Elasticsearch_The_Definitive_Guide



GET /_search
{
  "query": {
    "range": {
      "timestamp": {
        "time_zone": "+01:00",        
        "gte": "2020-01-01T00:00:00", 
        "lte": "now"                  
      }
    }
  }
}

2020年2月20日 星期四

Write the top to file and sed



top -b -n 30 -d 1 > top_out


# -b is batch mode
#-n is the 30 runs
# -d is 1 second to write

# out the fille
sed -n 100p top_out

or 

sed -n "100,$ p" test_out



# Ref
http://linux.vbird.org/linux_basic/0440processcontrol/0440processcontrol-fc4.php

2020年2月17日 星期一

apache log format

From http://adam-dragon.blogspot.com/2011/05/apache-log.html

Apache Custom Log Formats (如果翻譯的不對,請糾正。)

Format String Description
%% 百分比符號
%a 遠端 IP 位址
%A 本機 IP 位址
%B 回應一個 request 的大小 (bytes),含 HTTP headers
%b 以 CLF 格式回應一個 request 的大小 (bytes),含 HTTP headers
%{Foobar}C 傳送到伺服器的 Foobar cookie 的內容
%D request 傳送到伺服器的時間 (microseconds)
%{FOOBAR}e 伺服器環境變數 FOOBAR 的內容
%f 檔名
%h 遠端主機名稱
%H request 的通訊協定
%{Foobar}i The contents of Foobar: header line(s) in the request sent to the server.
Changes made by other modules (e.g. mod_headers) affect this.
%k 在一個 connection requests handled 中 keepalive 的數量
%l 遠端的 logname (This will return a dash unless mod_ident is present and Identity Check is set On).
%m The request method.
%{Foobar}n The contents of note Foobar from another module.
%{Foobar}o The contents of Foobar: header line(s) in the reply.
%p 伺服器回應一個 request 的 canonical port number
%{format}p The canonical port of the server serving the request or the server's actual port or the client's actual port.
Valid formats are canonical, local, or remote.
%P 回應 request 時的 PID
%{format}P The process ID or thread id of the child that serviced the request. Valid formats are pid, tid, and hextid. hextid requires APR 1.2.0 or higher.
%q The query string (prepended with a ? if a query string exists, otherwise an empty string).
%r First line of request.
%s 狀態. 若是由內部轉址來的 request,則將顯示原始 request 的狀態
%t 伺服器收到 request 的時間 (standard english format)
%{format}t 同上,但以自訂的格式來顯示時間
%T 伺服器回應 request 的時間 (in seconds)
%u 遠端的使用者 (from auth)
%U The URL path requested (not including any query string)
%v 伺服器回應 request 時的 canonical ServerName
%V The server name according to the UseCanonicalName setting.
%X Connection status when response is completed :
 X:connection aborted before the response completed.
 +:connection may be kept alive after the response is sent.
 -:connection will be closed after the response is sent.
This directive was %c in late versions of Apache 1.3, but this conflicted with the historical ssl %{var}c syntax.
%I Bytes received, including request and headers, cannot be zero. You need to enable mod_logio to use this.
%O Bytes sent, including headers, cannot be zero. You need to enable mod_logio to use this.

2020年2月4日 星期二

container - promethus

1. good
https://blog.techbridge.cc/2019/08/26/how-to-use-prometheus-grafana-in-flask-app/

2.  docker
https://github.com/prometheus/prometheus

3.  good example
https://k2r2bai.com/2018/06/10/cncf/prometheus/
https://ithelp.ithome.com.tw/tags/articles/prometheus
https://www.inwinstack.com/2018/11/14/prometheus-introduction-2/

4. log
https://www.robustperception.io/reloading-prometheus-configuration

document:
https://prometheus.io/docs/prometheus/latest/storage/
https://prometheus.io/docs/prometheus/latest/getting_started/

https://prometheus.io/docs/prometheus/latest/querying/basics/

https://wiki.lnd.bz/display/LFTC/Prometheus

https://yunlzheng.gitbook.io/prometheus-book/part-ii-prometheus-jin-jie/exporter/commonly-eporter-usage/use-prometheus-monitor-container

5. reload
http://codefun007.xyz/view/article_detail.htm?id=350

yaml invalidte


https://codebeautify.org/yaml-validator

https://ithelp.ithome.com.tw/articles/10193509

http://www.yamllint.com/

2020年1月14日 星期二

glibc compiler

http://www.linuxfromscratch.org/lfs/view/development/chapter05/glibc.html

https://sys.readthedocs.io/en/latest/doc/03_glibc.html

https://buildmedia.readthedocs.org/media/pdf/sys/latest/sys.pdf

https://www.itread01.com/content/1543348204.html

books
https://buildmedia.readthedocs.org/media/pdf/sys/latest/sys.pdf


https://stackoverflow.com/questions/847179/multiple-glibc-libraries-on-a-single-host

2020年1月13日 星期一

openssl & nginx install

1.  http://jianiau.blogspot.com/2015/07/openssl-config-req.html

2. https://blog.miniasp.com/post/2019/02/25/Creating-Self-signed-Certificate-using-OpenSSL


3. https://blog.cssuen.tw/create-a-self-signed-certificate-using-openssl-240c7b0579d3

4. https://blog.niclin.tw/2019/08/16/creating-self-signed-certificate-using-openssl/