Thursday, December 21, 2023

Peter Piper tongue twister

 Peter Piper picked a peck of pickled peppers.

A peck of pickled peppers Peter Piper picked.

If Peter Piper picked a peck of pickled peppers,

Where's the peck of pickled peppers Peter Piper picked?


Peter Piper picked a peck of pickled peppers.

If Peter Piper picked a peck of pickled peppers,

How many pickled peppers that Peter Piper picked?


Sunday, December 17, 2023

北京4050人员退休新政策

 北京4050人员退休新政策是什么

《北京市城镇登记失业人员灵活就业社会保险补贴办法》

第一条为了鼓励我市城镇登记失业人员灵活就业,根据《北京市人民政府贯彻落实国务院关于进一步加强就业再就业工作文件的通知》(京政发[2006]4号)精神,制定本办法。

第二条本办法适用于具有本市城镇户口,从事灵活就业,并办理了就业登记的城镇登记失业人员。

华律网

第三条城镇登记失业人员符合下列条件的,可以申请灵活就业社会保险补贴:

(一)女满40周岁,男满45周岁以上(以下简称“4045”失业人员)及中、重度残疾人;


(二)在社区从事家政服务与社区居民形成服务关系,或在区县、街道(乡镇)、社区统一安排下从事自行车修理、再生资源回收、便民理发、果蔬零售等社区服务性工作,以及没有固定工作单位,岗位不固定、工作时间不固定能够取得合法收入的其他灵活就业工作;

(三)已实现灵活就业满30日,并在户口所在区县劳动保障部门办理了个人就业登记。

第四条灵活就业社会保险补贴期限:

(一)符合第三条规定的“4045”失业人员及中度残疾人可以享受累计最长3年的社会保险补贴;

(二)距法定退休年龄不足5年的城镇登记失业人员及重度残疾人,可以享受累计最长5年的社会保险补贴。

第五条灵活就业社会保险补贴标准:

(一)基本养老保险以本市上年末职工月最低工资标准为缴费基数,按照28%的比例,补贴20%,个人缴纳8%;

(二)失业保险以本市上年末职工月最低工资标准为缴费基数,按照2%的比例,补贴1.5%,个人缴纳0.5%;

(三)基本医疗保险以本市上年职工月平均工资标准的70%为缴费基数,按照7%的比例,补贴6%,个人缴纳1%。

申请程序

1、申请人缴纳当年度养老、医疗保险三日后,凭本人

身份证、托管合同书和缴费票据原件,在市档案托管中心灵活就业人员社保补贴受理窗口初审,领取《申请表》和灵活就业证明。《申请表》只需填写一至七栏,贴照片。缴费票号、缴费金额和补贴金额部分不填。

2、灵活就业证明由申办人在其户口所在地社区劳动保障工作站登记盖章。

3、申请人持《申请表》、《灵活就业证明》及本人身份证、户口本等相关材料(一式三份)到街道(乡镇)劳动保障事务所申请复核,经审核无误后签字盖章(劳动保障事务所留存一份)。

4、申请人持《申请表》、《灵活就业证明》等相关材料到市档案托管中心受理窗口办理申报手续。

5、由市档案托管中心查阅档案,核对出生年月等情况无误后,汇总上报劳动保障部门。劳动保障部门审核后报财政部门拨付资金。

6、按照发放时间通知,申办人凭身份证和《受理卡》到指定银行领取社保补贴。

根据以上内容的相关的回答可以得出,在北京4050人员退休的政策必须是在满足年龄条件以及失业的情况,如果并没有稳定的工作,并且年龄也满足条件是有可能申请到4050的,如果您还有相关法律咨询可以致电华律网在线律师解答。



What is CORS

 What is CORS, what is preflight, how do you resolve it in Spring Boot?

WebMvcConfigurer CorsRegistry

后来 HTML5 支持了 CORS 协议。CORS 是一个 W3C 标准,全称是”跨域资源共享”(Cross-origin resource sharing),允许浏览器向跨源服务器,发出 XMLHttpRequest 请求,从而克服了 AJAX 只能同源使用的限制。它通过服务器增加一个特殊的 Header[Access-Control-Allow-Origin]来告诉客户端跨域的限制,如果浏览器支持 CORS、并且判断 Origin 通过的话,就会允许 XMLHttpRequest 发起跨域请求。

前端使用了 CORS 协议,就需要后端设置支持非同源的请求,Spring Boot 设置支持非同源的请求有两种方式。

第一,配置 CorsFilter。


@Configuration

public class GlobalCorsConfig {

    @Bean

    public CorsFilter corsFilter() {

        CorsConfiguration config = new CorsConfiguration();

          config.addAllowedOrigin("*");

          config.setAllowCredentials(true);

          config.addAllowedMethod("*");

          config.addAllowedHeader("*");

          config.addExposedHeader("*");


        UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource();

        configSource.registerCorsConfiguration("/**", config);


        return new CorsFilter(configSource);

    }

}



需要配置上述的一段代码。第二种方式稍微简单一些。

第二,在启动类上添加:


public class Application extends WebMvcConfigurerAdapter {  


    @Override  

    public void addCorsMappings(CorsRegistry registry) {  


        registry.addMapping("/**")  

                .allowCredentials(true)  

                .allowedHeaders("*")  

                .allowedOrigins("*")  

                .allowedMethods("*");  


    }  

}  





What is CSRF


How do you know a Spring Boot how many endpoints, and the endpoint details like path

How do you share session between different servers?


Microservice, UnknowHostException?



  1. Can you explain the differences between @RestController and @Controller annotations in Spring Boot?

  2. How do you implement security in a Spring Boot application?


How do you create and use Java annotations, and what are some common use cases for annotations?

Java annotations are metadata that provide additional information about the code to the compiler, runtime or other tools. They can be used to add information, enable/disable code generation or check code correctness.

Here are the steps to create and use Java annotations:

  1. What are the different operators available in RxJS, and how do you use them?

  2. What is the difference between the mergeMap and switchMap operators in RxJS?

  3. How do you use the retry operator in RxJS to retry an HTTP request?

  4. How do you use the combineLatest operator in RxJS to combine multiple observables?

  5. Can you explain the role of access tokens in OAuth 2.0?

  6. What is saml

In summary, while OAuth 2.0 is primarily designed for delegated authorization scenarios, SAML is designed for SSO scenarios.

Token type:

Access token/ID token/Refresh token/Reference token.


Access tokens can come in two flavours - self-contained or reference.

A JWT token would be a self-contained access token - it’s a protected data structure with claims and an expiration. Once an API has learned about the key material, it can validate self-contained tokens without needing to communicate with the issuer. This makes JWTs hard to revoke. They will stay valid until they expire.

When using reference tokens - IdentityServer will store the contents of the token in a data store and will only issue a unique identifier for this token back to the client. The API receiving this reference must then open a back-channel communication to IdentityServer to validate the token.

Reference tokens (sometimes also called opaque tokens) on the other hand are just identifiers for a token stored on the token service. The token service stores the contents of the token in some data store, associates it with an infeasible-to-guess id and passes the id back to the client. 

An ID token is encoded as a JSON Web Token (JWT).

An ID token is an artifact that proves that the user has been authenticated. It was introduced by OpenID Connect (OIDC).

In the OAuth 2 context, the access token allows a client application to access a specific resource to perform specific actions on behalf of the user. That is what is known as a delegated authorization scenario.

OAuth 2 core specifications say nothing about the access token format. It can be a string in any format. A common format used for access tokens is JWT.

An access token is a short-lived token that is used to access protected resources on behalf of an authenticated user. 


Saturday, December 16, 2023

The human consciousness is really like a tiny candle

 From Elon Musk:

Fermi was very good at asking profound questions and one of his questions which is called the Fermi Paradox is where are the aliens and one of the explanations is that and I think the one that and I think appears to be most accurate is consciousness is extremely rare ... and the crazist thing is that I've seen no evidence of aliens whatsoever this means that I think most likely at least in this part of galaxy we are the only consciousness that exists. And so you can think

The human consciousness is really like a tiny candle in a very vast darkness and we must do everything we can to ensure that candle does not go out.

If we do not become multiplanet species then eventually at some point something will happen to the planet either it'll be manmade or it'll be something natural like a meteor like whatever killed the dinosaurs for example and so eventually the sun will expand and will destroy all life on earth so if one cares about life on earth at all we should care about becoming multiplanet species and eventually going out there and becoming a multi stellar species and having many star systems we want the exciting parts of science fiction to not be fiction forever and we want make them real. 


https://www.youtube.com/watch?v=QnpPU1KjcIU 

Monday, December 4, 2023

Youtube video to audio

 

1. Youtube to autdio

Youtube to MP3 audio Converter - yt2k

2. Audio split

mp3splt download | SourceForge.net

https://mp3splt.sourceforge.net/mp3splt_page/documentation/man.html

mp3splt.exe -t 10.00 The5AM.mp3

3. Upload to QQMusic cloud

Sunday, December 3, 2023

Quote

 1. Love and do what you will

2. Take arrows in your forehead, but never in your back

Tuesday, October 31, 2023

Deep work

 The author speech Cal Newport

No context switch

    Email/Meeting/Coding

In average people check messages every 1/6 minutes

A world without Email (another book by Cal Newport)

Deep work becomes more valuable and increasingly rare.

Introduce some boredom into your life (stimulus)

productive meditation (not mindful meditation)

deep work/shallow work = ?

Morning hours is best for most deep workers.

Wednesday, October 25, 2023

Hurry slowly - Eckhart Tolloe

 There's even a thing in Zen, an expression in Zen, which says, hurry slowly. So when you are in a hurry, you have to move fast. How can you-- it doesn't make sense. 

Hurry slowly, they tell you in Zen. How does that work? Well, it means you can act fast, but the slow, what they call slow is the conscious.   You're still connected to the sense of Being, which is the conscious consciousness behind what you do. You are not lost in the hurrying. 

The hurrying happens externally. But internally, you're still at rest. That's the slowly aspect of the hurry slowly. And the restful sense of being is consciousness. You're conscious, not lost in the action yet able to perform the action better than unconsciously.  

Wednesday, October 4, 2023

Exercise Plan

 Exercise Plan Aug 29, 2023

  1. Run/Walk 40 mins Every Monday/Wednesday/Friday

  2. Yoga 30 mins Every Monday/Wednesday/Friday

  3. Muscle improvement 20 mins Every Monday/Wednesday/Friday

  1. Pushups 2 set of 15 rep, 30 secs rest between

  2. Crunch with twist 2 sets of 10 rep, 30 secs rest between

  3. Bar raise 2 sets of 5 rep, 30 secs rest between

  4. 20 bridge 2 sets of 20 rep, 30 secs rest between

  5. Hang 1 min

Sunday, August 27, 2023

Windows Forms Programming with C#

Although the DataGrid class is retained for

backward compatibility, the DataGridView control is the preferred mechanism for

displaying tabular data as of the .NET 2.0 release.

VirtualMode


DEPLOYMENT 

This section walks through two deployment methods. The first creates a traditional

setup file that can be copied and otherwise transported to other computers

for installation. The second is the new ClickOnce deployment offered as of the

.NET 2.0 release.

While setup projects are quite flexible and can install pretty much any configuration

on the target machine, they are also limited in their ability to manage ongoing

updates and changes to the associated application.

ClickOnce requires an available Internet Information Services

(IIS) Web Server.

Friday, August 18, 2023

cold water exposure tips

 1. up to their neck/cold water­­­ immersion to the neck

2. Consider doing deliberate cold exposure for 11 minutes per week TOTAL
3. I prefer to take a hot shower and towel dry after cold exposure
4. It’s better to wait 6 to 8 or more hours until after training, or do it before training
5. The use of information on this podcast or materials linked from this podcast is at the user’s own risk.

Controlling Your Dopamine For Motivation, Focus & Satisfaction

 

Wednesday, August 16, 2023

Friends - Jerry

 Um, honey, you do realize that we don't keep the women's lingerie here in the office?

Rachel, I need the Versachi invoice

Thanks, it's ah, Gaelic, for 'Thy turkey's done.'

Oh, nothing, he’s just goofy like that, I actually, hardly notice it anymore.

https://www.youtube.com/watch?v=98p1Ld3oXOU

Saturday, July 29, 2023

vocabulary

 

exodus

insomnia

euthanasia

penultimate

sapphire

sacrosanct

thyme

lucid

unadorned

prose

myopic

elusive (vs palpable)

contentment

maniac

mantra

transcend

privy

ebb

reflux

frugal

venerate

reverential

reverence

endow

incense

spar (boxing)

venereal

indulgence

dementia

alzheimer

zucchini

predicament

cosmetic

patron

devastated

concierge

intersperse

dread

loathing

loadthsome

annihilation

peculiar

pristine

marvel

palpable (vs elusive)

eon

perpetual


Wednesday, July 19, 2023

breathe and flow embark

 Stumble across:

1. Stumble across this video

2. I stumbled across this book by chance.

We don't need any props today.

Feel your rib cage expand and exhale gently

3. There shouldn't be any feelings of pain or numbness or tingling.

4. It takes the weight off the outside cartilage of the wrist you can paddle out the legs one leg at a time

5. stand one vertebrae at a time

6. begin to bend the arms for chaturanga

7. in the body the asanas

8. we are going to be doing breath work exercise called pranayama this one in particular is nadi shodhana

9. before we come into shavasna

10. we'll see you in tomorrow's video for day two with love and gratitude Namaste

Saturday, June 10, 2023

English

 

Jacob: It's so sad to see them controlled by the phone

Forgive them for they know not what they do



Saturday, May 20, 2023

C# 10 in a nut shell note.txt

 1.

//download https://www.linqpad.net/

dotnet new console -n MyFirstProgram //cannot use Console

cd MyFirstProgram

dotnet run MyFirstProgram 

//or run the below if just want to build without running

dotnet build MyFirstProgram.csproj


2. All C# types fall into the following categories:

Value types, Reference types, Generic type parameters, Pointer types


3.

Indices: char secondToLast = vowels[^2];

Ranges: Ranges let you "slic" an array: char[] lastThree = vowels[2..];

C# supports "ref" and "out", "in" (cannot be modifierd by the method), "params" modifier for the parameters.

Also can have default value, named arguments

Ref Locals: int[] numbers = {0,1,2,3,4}; ref int numRef = ref numbers[2]; when we modify numRef, we modify the array element

string s1 = null;

string s2 = s1 ?? "nothing"; /s2 evaluates to "nothing"

myVariable ??= someDefault; //equivalent to if(myVariable ==null) myVariable = someDefault;

StringBuilder sb = null;

string s = sb?.ToString(); //No error; s instead evaluates to null

string s = sb?.ToString().ToUpper();//No error; s instead evaluates to null

string foo = null;

char? c = foo?[1];//c is null

switch on types: switch(x) { case int i: ... case string s:...case bool b when b == true: ... default:...}

readonly prevents change after construction: static readonly DateTime StartupTime = DateTime.Now;

const: evalution occus at compile time: public const string Message = "Hello World"; const can also be declared local to a method.

local method: you can define a method within another method.

Deconstruct has one or more out parameters.

var rect = new Rectangle(3,4);

(float width,float height) = rect; or var (width, height) = rect;

Bunny b1 =  new Bunny{Name="Bo, LikesCarrots=true};

A static constructor executes once per type than once per instance. A type can define only one static constructor, and

must be parameterless.

You can also define module initializer which execute once per assembly.

Finilizers are class-only methods before the garbage collector reclaims the memory for an unreferenced object. //difference with deconstruct

partial types and partial methods


4.

int count = 123;

string name = nameof (count);

Asset a = new Asset();

Stock s = a as Stock;// s is null; no exception thrown

You can introduce a variable while using the is operator:

if (a is Stock s) Console.WriteLine(s.SharedOwned);

virtual->override

abstract->override

sealed: prevcent being override

GetType is evaluated at runtime, typeof is evaluated statically at compile time.



Wednesday, May 10, 2023

ChatGPT and C# are so cool

 ChatGPT and C# are so cool

I just begain to learn C#, thought it may need me one week to complete the below, but it only took me 10 mins



Tuesday, May 2, 2023

MAC M1 C# development

 1.

There's M1 version Visual Studio but I prefer to use the Visual Studio in the Windows 11 (Parallel Desktop)

2.

MS SQL Server by default does not support arm CPU, can install a docker image based on this document

https://database.guide/how-to-install-sql-server-on-an-m1-mac-arm64/

3.

Can install MS SQL Server Management Studio on PD Windows 11, and restore database AutoLotDocker.bak

Need to copy the file from the host to the docker use "docker cp" command

4. After that can compile and run the C# code to connect to the MS SQL Server database



Sunday, April 30, 2023

chimp paradox - 100 dying man to his grandson

1. Do what you want to do

2. Make contribution to the family, and the community/world

3. Exericse to make your body fit, and read to make your brain better

be specific: READ

Wednesday, April 26, 2023

Hug chatGPT, all in C#

I feel Visual Studio is way more powerful than Eclipse or IntelliJ Idea, in next few months/years, it could even improve a lot with chatGPT. chatGPT can guess and complete the leftover so it would be very effcient to develop with C#. What's more, chatGPT may make it easier to transform the C# code to Java/Python (With auto JUnit, Log added performance improved, cross-platform enabled).

Complete C# Master Class note 2

 1.

C# base virtual and child override behavior is same with Java. But C# can also have the new key word.

The new keyword is used to hide a method, property, indexer, or event of base class into derived class.

sealed doesn't allow override.

2.

Developers use the .NET Framework to create Windows desktop and server-based applications. This includes ASP.NET web applications. On the other hand, .NET Core is used to create server applications that run on Windows, Linux and Mac. It does not currently support creating desktop applications with a user interface.

3.

internal access modifier only allows same assemly/namespace/project access.

4.

struct is similar to class but it's value type. Struct cannot support inheritance.

CONSIDER defining a struct instead of a class if instances of the type are small and commonly short-lived or are commonly embedded in other objects.

5.

num8 = num6 ?? 8.53;

public delegate bool FilterDelegate(Person person);

            FilterDelegate filter = delegate (Person person)

            {

                return person.Age > 18;

            };

Display("Show adults",people,p=>p.Age>18);   //Lambda

Sunday, April 23, 2023

Complete C# Master Class note 1

 

1. C# variables defined in class level can be accessed by the method directly (without static keyword). Only if the variables are defined with static keyword, then they are shared by all instances. Variables defined within the method can only be used in the method.

2. decimal is used mostly in financial applications.

3. Value types hold the value directly on its own memory space. The value type uses a heap to store the value. Reference types store the memory location of the data, like string, class, array.

4.

// See https://aka.ms/new-console-template for more information

Console.ForegroundColor = ConsoleColor.DarkYellow;

Console.WriteLine("Hello, World!");

string? value = Console.ReadLine();

Console.WriteLine("You input {0}",value);

int n = Int32.Parse("32");//or int.Parse

Console.WriteLine(n);

Console.WriteLine($"Hello the value is {value}");

const double MYPI = Math.PI;

Console.WriteLine(MYPI);


string numberAsString = "128SDF";

int parsedValue;

bool success = int.TryParse(numberAsString, out parsedValue);

Console.WriteLine(success);

5.

destructor: ~Member()     Debug.write();

6.

By using the params keyword, you can specify a method parameter that takes a variable number of arguments. The parameter type must be a single-dimensional array.

7.

List<T> is a generic class. It supports storing values of a specific type without casting to or from object (which would have incurred boxing/unboxing overhead when T is a value type in the ArrayList case). ArrayList simply stores object references.

8.

Hashtable

foreach(DictionaryEntry entry in studentsHashTable){}

or

foreach(Student value in studentsHashTable.values){}


9. Dictionary implementation is actually based on Hashtable but it's generic and preferred.

10.

VS offers 2 automatic-watch tool windows: The Locals and Autos windows.

The Locals will show local variables of the current scope. It usually starts with this, which represents the current class.

The Autos window will show all variables used in the current line and in the previous line. These could be local variables, class members or static variables. The Autos also shows values returned from methods, which is useful at times.


Sunday, March 19, 2023

Use flask for auspix

 pip3 install flask

set FLASK_APP=auspix_service.py

flask run --host=0.0.0.0


I put the below content into a bat file auspix_serbice.bat

set FLASK_APP=auspix_service.py && flask run --host=0.0.0.0 >> C:/Auspix/logs/auspix_service_log.txt

And tried to add it into task scheduler (at system startup or daily...) but all cannot work as expected.

Then I added it into the startup folder according to this article

https://www.minitool.com/data-recovery/windows-11-startup-programs-folder.html

1. Press Windows + R, type shell:startup, and press Enter to open Windows 11 startup folder.

2. Create a shortcut for the bat file, and move the shortcut file into the startup folder. Now it works like a charm