Chủ Nhật, 24 tháng 1, 2021

Git và những thứ hay ho cần nhớ [Bài viết của dân không chuyên IT]

Git và những thứ hay ho

  1. Git là gì
  2. Github là gì?
  3. Cài đặt Git
  4. Các câu lệnh cơ bản trong git
  5. bla bla

GIT là gì?

Git là một hệ thống quản lý phân tán. Thay vì lưu file kiểu Project1, Project1_V1, Project1_Final, Project1_Final_Last.... bla bla. Thì Git giúp bạn không cần lưu kiểu củ chuối này, nhưng bằng cách nào thì cần theo dõi đến cuối.

Github là gì?

GitHub là một dịch vụ lưu trữ trên web của thằng Git. Github nó chả phải là con cái của thằng Git như trước giờ lầm tưởng. Một số dịch vụ thay thế tương tự Github có thể kể đến như BitBucket, GitLab, SourceForge, .... Việc bắt buộc để sử dụng được git là tạo một tài khoản vào một trong các dịch vụ này. Mà mọi người thì thường dùng Github.com

Cài đặt git

Lên trang dưới  https://git-scm.com/downloads và download tương thích với hệ điều hành của bạn. Việc cài thì chỉ bấm next ...đến hết.

Các câu lệnh cơ bản trong git

Git nó quản lý theo các Repository. Mỗi Repository bao gồm các branch, mà trong mỗi branch là một cụm code  hoặc cụm các file tùy thích. Một Repository có thể có một hoặc nhiều branch(es). Git nó ở 2 nơi, một là trên server gọi là remote, một là trên máy bạn gọi là local. Bạn cần phải khởi tạo git ở trên local, rồi sau đó mới đẩy lên remote. Có thể bỏ qua branch, nếu chỉ project chỉ làm 1 mình, và chắc chắn nó luôn đúng. haha

Các bước cơ bản để có thể gọi là dùng được: Tạo repository => Khởi tạo bằng lênh Init =>  lệnh Commit =>Tạo Branch => Tạo đường dẫn kết nối với remote => Push 

Để tạo Repository, bạn vào trang chủ Github, và nhấn vào góc phải như hình để tạo mới. 


Nhập tên và bấm Creat repository


Sau khi có repository, bạn tạo 1 folder trên máy tính của bạn. Truy cập vào thư mục, và chuột phải chuột chọn Git Bash Here
Ví dụ tui có một thư mục NewFolder và có 1 file Hello.txt. Sau khi chọn Git bash Here thì màn hình đen hiện ra:


Giải thích về các lệnh dưới đây:
git init   //Khởi tạo git
git add *   //thêm tất cả cacsc file vào git local, tức là trên máy tính bạn
git commit -m "first commit"  //commit, kiểu như make sure thao tác vừa làm
git branch -M main             //tạo một branch mới
git remote add origin https://github.com/lesonglam/newRepository.git  
                            //khởi tạo cho remote 
git push -u origin main  //đẩy lên remote
git branch -a //kiểm tra tất cả các branch đang làm việc(cả local và remote)

git clean -fX //xóa lỗi với vẩnclear hoặcctrl+l //xóa màn hình

git checkout master  //Để  di chuyển đến branch master.

git merge developBranch // để merge từ một branch có tên là develop branch

//sang branch có tên master

Link tham khảo: 
Link 1: https://forum.freecodecamp.org/t/push-a-new-local-branch-to-a-remote-git-repository-and-track-it-too/13222
Link 2: https://backlog.com/git-tutorial/vn/stepup/stepup2_4.html















Read more... »

Chủ Nhật, 14 tháng 6, 2020

Viết Intro - Conclusion theo phong cách 2 câu theo sếp Kien Tran

0. Mở đầu

Sau chục ngày mò mẫm, nay cũng là lúc để tập tành viết 1 câu Intro cho ngon lành.
Có những nguyên tắc để viết 1 Intro/Conclusion xịn kiểu sếp là:
  1. Không viết quá 2 câu cho Intro/Conlusion
  2. Không dùng which,that,...mang tính rườm rà
  3. Không dùng I, we,..các đại từ nhân xưng mang tính chủ quan. Ai còn dùng kiểu I disagree bala bla là chưa hợp mùi academic rồi. 
  4. Chỉ dành tối đa 5 phút cho việc hoàn thành Intro của bài bất kỳ.
  5. Chỉ dùng In conclusion để bắt đầu đoạn kết bài
Read more... »

Thứ Tư, 20 tháng 5, 2020

Học viết essay theo phong cách Kien Tran

0. Giới thiệu

Mình mới mua cuốn sách Kien Tran, bạn nào cần thì nt vào số mình nhé 0979829469
Đây là nơi mình tổng hợp những kiểu viết của Kien Tran với cuốn sách _BOOK 7.  7.5+ WRITING. Bài viết liệt kê chi tiết từ ngữ, câu cú theo cuốn sách đó, nhằm giúp mình ôn lại sau này.
Now, let's get started =))
-------------------------------------------------------------------------------------------------------------------------

I. Transitional words

Các transitions words thường xào, và nghe đâu chỉ cần xài từng này là đủ =))
First, Second: cái này dùng để liệt kê, một là, hai là...
Vd: First, I love you because you are lovely. Second, I also love My Tam,  because she is singing well
For example, For instance, In fact: Ví dụ
Vd: Cuộc đời là những niềm đau. For example, when we are young, chúng ta sợ mẹ.
In addition: Ví dụ (thêm vào đó) Cái này được dùng sau khi dùng một liệt kê trước đó, kiểu như First, bala bla... giải thích một đoạn...In addition (thêm mắm muối nữa thì)
Also: cũng là not only...but also....: sau dấu 3 chấm là đồng cấp.
Vd: Anh ấy không chỉ đẹp trai, mà còn giàu có nữa. He is not only handsome but also rich
In conclusion: chốt lại là, câu này dùng cho đoạn cuối
Although: Mặc dù
Vd: Mặc dù người ta nói Lam đẹp trai, nhưng anh ấy không phải vậy đâu
Although people say that Lam is handsome, he is not
Given that: mặc dù, gần giống với Although, nhưng tính đối lập nhẹ hơn
On the one hand/other hand cái này khỏi nói, ai cũng biết rùi
Nevertheless : thay thế cho But để đứng đầu câu
Therefore: bởi vậy(nên là)
As a result : Kết quả là

II. Các dạng Essay phổ biến


III. Cấu trúc bài 1 bài essay

Một bài Essay trong sách này có cấu trúc 2552. Cụ thể là 2 câu Intro, 5 câu Body1, 5 câu Body2, 2 câu cho Conclusion

IV. Cách viết mở bài 

Những từ, câu chữ thường được dùng trong mở bài Essay
Trong các bài viết, sếp khuyên là chỉ viết 2 câu mở đầu, và học cách dùng Although cho tất cả các trường hợp. Câu 1 là mở cái câu paraphase lại, câu 2 là dùng althogh.
Advantages or disadvantages
Đề như sau: Nhiều cha tin rằng học tiếng anh Online tốt hơn offline. Ông có đồng ý hay phản đối?
Thì Intro được quất như sau: Thời gian gần đây, học tiếng anh online được phổ biến trong công chúng. Although this trend không phải không có nhiều bất lợi, nhưng những điểm lợi thế luôn là thứ áp đảo hơn
In recent years/These days, learning English online has gained (in) popularity. Although this trend is not without disadvantages, the upside can justify these.

V. Các thế võ cần nhớ

1. If

If được dùng tối đa một lần trong mỗi phần thân bài, với mỗi phần thân bài là 4 câu,(trừ đi một câu topic sentence) thì chiêu if đã giúp hoàn thành 25% thân bài. 

2. Since 

Since được dùng vào đầu câu, thay thế cho Because, để trông câu cú có vẻ thuận tai hơn trong văn viết. Cấu trúc Since [reason] [result][End result]
Ví dụ: Since many students play online games, they use computers professionally which can help them get a better job in software companies.

3.  By

By được dùng trực tiếp với kiểu nghĩa Bằng việc bla bla trong tiếng Việt. Ví dụ, bằng việc cho phép đua xe tùm lum, việc này có thể giúp tìm kiếm những ngôi sao đua xe, haha
In fact, by monitoring illegal motor races, famous managers can spot new talented drivers.

4. This

This dùng để tăng tính coherrence cho câu. This được dùng theo những cụm dưới đây.


VI. Các viên doping cần dùng 

1. Which 

which được dùng để dẫn đến [end result]
Which có thể bổ ngữ cho 
NOTE: Which có thể bổ nghĩa cho cả một  mệnh đề-clause trước đó và cũng có thể bổ nghĩa cho từ trước đó. Tuy vậy, không nên dùng which để bổ ngữ cho từ trước đó, mà thay vào đó hãy dùng that
Ví dụ: Không nên viết là I love cats, which is nice. Thay vào đó, hãy viết:  I love cats, that are nice

2. such as

Dùng such as với nguyên tắc:
Kẹp giữa 2 dấu phẩyChỉ nêu ra 1-2 ví dụDùng “and” ở trước từ cuối
Note: eat on time cần được thay thế bằng Having scheduled meals.
For instance, playing with toys will keep the children occupied fora long time and having scheduled meals will keep children healthy, which ensure their mental and physical developments  
Note: viết những điều chung chung để có thể dùng such as vào câu.

3., especially 

Nhớ là viết ở giữa cần kẹp giữa 2 dấu (,), viết ở cuối thì cần có một dấu (,).

First, companies, especially manufacturers, have to make sure there is no toxic waste

4. Due to

Due to không dùng để thay thế cho Because cho mọi trường hợp.  Due to chỉ dùng cho trường hợp nêu lý do tiêu cực thôi. 
First, since many of their educational approaches have been obsolete due to the fast-changing environment nowadays, older leaders tend to use old ways to look at new problems. 

5. Either or

I love public transportation either buses or trains

6. Not only but also

I like modern transportations not only buses but also cars

7. As

Sau as là một clause
For example, Stonehenge, a well-known historical site in England, attracts mostly tourists as the locals have already visited it too many times and lost their interest as they grow up. 

8. Regardless of 

I will buy gold regardless of price.
I will buy gold at
either high or low price.
I love social activities,
either for community or for the government.
I love social activities
regardless of whom I work for  

9.  Including 

Many jobs, including low-earning ones, are not available  

VII. Các weapons cần có

1. Require/Are required to

Most companies require younger leaders in order to keep up with new technologies. 
Schools now require students to take an IELTS test before their graduation.
Students are required to take an English test to graduate.

2. To ensure

Ensure có 2 loại: Ensure Ensure that. Nếu chỉ là Ensure không thì đằng sau nó sẽ là cụm danh từ. Nếu có that thì sẽ là một clause.  

3. Be conducive to

“Be conducive to” có nghĩa là làm cho thuận lợi, dễ chịu để làm một việc nào đấy. (Make a certain situation or outcome likely or possible.) Cụm này có thể phần nào thay thế cho cách tư duy Việt Anh:
Make it easy to… Đây là một loại vũ khí mạnh và tất nhiên có thể áp dụng cho hầu hết các đề. Nếu bạn sử dụng cụm từ này đúng, giám khảo sẽ rất ấn tượng với bạn. Từ Conducive thường hay đi
cùng với từ condition / environment (môi trường thuận lợi). Sở dĩ Conducive mạnh vì đây là quan hệ nhân quả (cause-effect)
  

4. At the expense of

Với cái giá để làm cái gì đó.
You should not earn money at the expense of your own health
Don't be rich at the expense of your own health
Being honest can come at the expense of being bullied

5. Be less/more reliant on

Nowadays, students have been less reliant on teachers.
There are some ways you can make your own home, less energy reliant. 
North Korea wants to reduce reliance on import
Japan should be less reliant on the US military  

6. allow

Online platforms allow students to learn subjects independently. 

7. Take steps to


Dạng viết solutions cho government 
The government should take steps to reduce unemployment
The government should take steps to reduce crimeThe government should take steps to improve the integrity of the politicians  

8. Are susceptible to

be susceptible là có nghĩa kiểu dễ dính , dễ bị ảnh hưởng gì đó.
Children are more susceptible to diseases.
Japan is highly susceptible to earthquake
Stressed people are more susceptible to diseases
Lazy people are more susceptible to failure  thay vì Lazy people are more likely to fail

9. Act as an incentive for/Act as a deterrent for  

incentive: khích lệ , kích thích
deterrent: ngăn cản, răn đe

The car that my boss gave me acts as an incentive for me to work harder and love this job
Stricter penalty acts as a deterrent for crime
Bigger fines act as a deterrent for traffic violator
The penalties are too low to act as a deterrent
Increasing prices for cigarettes can act as a deterrent for smokers.

10. contribute to

A contribute to B = B is caused by A

Universities contribute to local business growth
Opening school contribute to drinking shops around it

IIX. HOW TO EXPAND YOUR VOCABULARY RANGE  

  • Natural science
  • Environment
  • Family & parenting
  • Perserving wild animals
  • Business
  • Society
  • School
  • Habit
  • War
  • Globalization  

IX. Chiến thuật viết bài

0. Khoanh tròn keywords

1. Viết tất cả các từ dưới ra thành 3 cột

2. Plan ideas 2552

Bảng ma thuật sếp khuyên cần nhớ 

3. Cách hoàn thành Intro

Đây là lời khuyên của sếp cho dummers =))
Câu Opinion (OP) tuỳ dạng bài mà bạn sẽ viết theo kiểu khác nhau.
  1. Dạng Agree/Disagree: Sử dụng Although, và đưa cái ý mà bạn Agree/Disagree ra vế thứ 2, viết thành một câu khẳng định (không dùng I)  
  2. Dạng Advantages/Disadvantages: Sử dụng Although, bạn có thể viết kết luận cái nào outweigh cái nào ở phần kết luận. Trong câu OP, bạn chỉ cần viết câu đại ý
    ~Although it has advantages, there are disadvantages. Nếu disadvantages mạnh hơn, hãy
    cho nó ở vế 2. Tương tự, nếu Advantages mạnh hơn, hãy cho nó ở vế 2. Vế 2 thường là vế ưu tiên. 
    ~Although it has advantages, there are disadvantages. Nếu disadvantages mạnh hơn, hãy cho nó ở vế 2. Tương tự, nếu Advantages mạnh hơn, hãy cho nó ở vế 2. Vế 2 thường là vế ưu tiên.
  3. Dạng Discuss both views: Tương tự, sử dụng Although, cho view mà bạn ủng hộ sang vế 2. 
  4. Dạng Problems/Solutions: Tương tự, sử dụng Although, vế 1 problem, vế 2 solution.
  5. Dạng Reason/Solutions (Why and what can be done): Sử dụng Given that như model essay để giảm tính đối lập  

Các cụm từ hay ho thường dùng strong Intro
  • One of the […]
  • A growing trend / a declining trend
  • Has gain in popularity / has become a publicly recognized phenomenon
  • Has been considered
  • Causing some public controversy
  • Due to, thanks to, because of
  • In recent decades, these days
  • Some, certain
  • Around the world, locally
  • Has been receiving a great deal of media attention / public attention In recent decades, global warming has been receiving a great deal of media attention around the world due to its ...............
  • Has rapidly evolved over 

4. Các câu mẫu hay ho trong bài viết

  1. There are also a number of benefits for tourists traveling to isolated natural environment. 
  2. One of those benefits is that....
  3. helps raise public awareness on the issue. 
  4. benefits students, scientists, and the world at large in a variety of ways.
  5.  This is not an indication of (~This doesn't mean)
  6.  so much of it to be dug up and removing it from the earth can have environmental consequences.
  7. It is true that responsible corporate behavior contributes to broad-based benefits for the countries in which the companies are active
  8. government should take steps to...: thực hiện các biện pháp để
  9. that would give them an opportunity to save more lives overseas
  10. have access to resources to deal with problems like hunger and poverty.
  11. Another compelling reason is that
  12. can ensure their sustainable long-term growth
  13. This benefits not only the countries but also the companies
  14. It is true the use of cell phones has gained in popularity over the past few decades
  15. There are a number of reasons why
  16. suggesting a significant causal relationship between driving private transports and traffic congestion in cities. 
  17. In addition, before the appearance of online shops, buying commodities would require physical travel, costing unnecessary time, effort and money.
  18. For example, people are more likely to lose important contacts and might even forget one another if there are not exist coffee shops for hanging out.
  19. the net advantage of using private transports is still too high to consider banning.
  20. In recent years, driving private transports to works has gained in popularity for many reasons. 
  21. Although some might suggest banning automobiles in cities due to its air pollution effects, the suggestion is groundless and should not be implemented. 
  22. Although this trend/suggestion is not without disadvantages, the upside can justify these.
  23. There are a number of reasons leading to that trend.
  24. require a great deal of patience and hard work
  25. which results in better salary and wages.
  26. has become a growing trend
  27. There are also advantages and disadvantages of that trend.
  28. As for the upside (về mặt tích cực)
  29. have time to get more done(làm được nhiều việc hơn)
  30. either at work or in life 
  31. making them happier overall
  32. In fact, studies have shown that people who
  33. have a higher level of happiness than those who do not.
  34. Nevertheless
  35. have an increased risk
  36. Although the trend appears to challenge the preservation of traditional fashions of those countries, it brings more positive changes overall.
  37. in an excellent state of preservation (pr ờ-zơ- v'ê - shion) bảo quản tốt đó
  38. thanks to globalization
  39. in the apparel industry. (trong nghành thời trang )
  40.  to allow citizens to choose what to wear based on personal preferences
  41. without having to take into account social approval on clothing
  42. Even though the trend has received some criticisms over the years, it has positively affected those countries at the other end (at other end, ở mặt khác / khía cạnh khác, ngược lại)
  43. the development should be embraced because of its overwhelming advantages.
  44. benefits the citizens in different ways
  45. imported at an increasing rate.
  46. causing some public controversy : nguyên nhân gây ra nhiều tranh cãi
  47. this trend comes at the expense of the country's culture: với sự đánh đổi văn hóa quốc gia
  48. plenty of evidence suggests that the opposite is true
  49. There are a number of reasons why this trend benefits communities/individuals
  50. First, thanks to... Đầu tiên , đội ơn bla bla
  51. will obtain the opportunity to fix its existing flaws (có được cơ hội để sửa những lỗ hổng-thiếu sót)
  52. do more harm than good
  53. should also recognize the benefits of
  54. Get perfected nghĩa là get improved, get perfect nghĩa là trở nên hoàn hảo
  55. are the ones who need the most help from the governments
  56. from the rest of the world
  57. have not recognized fundamental human rights
  58. in many inhumane ways.
  59. pro-democracy activists
  60. For instance, many pro-democracy activists in Hongkong were sentenced to prison even to death by the Chinese Communist Party, which have been saved, if the US had tried to interfere with the military. 
  61.  For example, many dissidents in Hongkong were suppressed by the Chinese authority, some even to death, which had been saved if the US tried to support it/prevent that from happening.
  62. It has been true in many cases that prolonged poverty cannot be solved without the assistance from foreign governments. prolong là kéo dài. the drugs can help patients to prolong their life
  63. One product of poverty is hunger
  64. If outside governments had stepped in and provided financial assistance
  65. Plenty of evidence suggests [11] that the most effective way to overcome poverty is education.
  66. By using diplomatic pressure, dùng áp lực ngoại giao
  67. Although the problems associated with this situation can be pronounced, there are not without solutions. problem/Solutions
  68. Wealth inequality  has been receiving endless public attention and criticisms from academia, in both developed and developing nations
  69. There are a number of problems caused by wealth inequality.
  70. at the expense of other social classes
  71. Nevertheless, there have been many good solutions for wealth inequality problems-solution 
  72. loophole: lỗ hổng pháp lý
  73. taking advantage of
  74. In conclusion, although wealth inequality can cause ........ there are still some practical solutions.  problems-solutions
  75. a fairer society / it is more fair
  76. A whole host of problems" "A whole host of bad people" etc. Khi nói đến tích cực hãy dùng A great deal of, plenty of.
  77. Dạng bài problems/solutions thì đoạn Body2 dùng Nevertheless để bắt đầu, kiểu là dù vậy nhưng bla bla
  78. instead of relying on their governments
  79. effective: đúng việc, đúng vấn đề
  80. efficient: đúng cách, đúng phương pháp
  81. future generations would have the same or even worse living conditions and lifestyles, which deteriorates their health.
  82. as healthy dieting and active lifestyles come into play
  83. to focus on preventive approach
  84. This benefits not only the governments but also the citizens’ health.
  85. has become a topic of discussion. một chủ đề bình luận
  86. In recent years, the question of who should take responsibility in educating the public on healthcare has become a topic of discussion.
  87. be ones who hold the most responsibility.
  88. doctors are the only ones who are qualified to provide knowledge to patients
  89. his or her advice is more trustful than other sources of information
  90. encounter misinformation or bad advice, which can be...
  91. Europe has tackled online disinformation by investing heavily in technology and review teams, promoting trusted information from official sources, and developing policies like banning all political advertising from preventing misinformation.
  92. there will be a good chance.
  93. either directly or indirectly.
  94. therefore only doctors can tailor their advice to: điều chỉnh, nó như regularize
  95. inherently: vốn dĩ
  96. Harvard students are inherently smart, therefore smartness is not something special there. 
  97. highly respected profession: nghề được đề cao của xã hội ( profession ~ jobs) highly respected career/scientist 
  98. For example, my gf, as a highly respected doctor, is always responsible for my life.  haha
  99. those who cannot afford medical services
  100. should be one of many responsibilities of (danh từ số nhiều)
  101. which suggests different approaches in dealing with crime. problems/solutions
  102. identifying the reasons behind this pattern is key to finding the solutions. reasons/solutions
  103. which potentially leads to... cái gì đó
  104. practical ones are gaining more attention recently. đang dần được chú ý hơn tgian gần đây
  105. are of vital importance for students
  106. a student certainly needs to acquire complex knowledge and be fluent in academic theories
  107. help graduates land higher-paying jobs
  108. most high-salaried workers
  109. which can only be achieved if they have taken academic subjects. 
  110. For example, most of the technology leaders in corporations must have complex/sophisticated knowledge, which can only be achieved if ones have taken academic subjects/ones hold a postgraduate degree. 
  111. allow the majority to make a living much earlier.
  112. workers who have solid practical experience
  113. the brink of extinction: bờ vựt tuyệt chủng
  114. potentially bring all species, including humankind, to the brink of extinction: khả năng cao....
  115. seem reasonable
  116. the benefits do not justify the costs
  117. in order to conduct various required experiments and bring objects into space for the purpose of finding other planets, space-exploration projects usually consume plenty of natural resources from the Earth, such as oil and metals.
  118. a great number of resources
  119. Nowadays, there has been a tendency for children likely to watch TV rather than spending time on activities for many reasons. Although this tendency leads to a number of ramifications, there is not without solutions.
  120. shrinking playgrounds and parks hết chỗ để chơi
  121. identifying the reasons is key to finding the solutions
  122. livestock: thú nuôi, gia súc
  123. can be composted or used to feed livestock. dùng để cho gia súc
  124. not only benefit the agriculture industry
  125. Edible: có thể ăn được: can be edible 
  126. Food waste has become an emerging issue of great public concern in recent years. Given that this issue leads to a series of environmental impacts, identifying the reasons behind it is the key to finding solutions. Intro
  127. oppose this idea due to its seemingly high costs Intro
  128. is among the most beneficial ways to Intro
  129. In many nations, governments have spent a large amount of national budget on improving Internet access, causing some public controversy. Although some might oppose this idea due to its seemingly high costs, improving Internet access will be the most beneficial ways to spend government money INTRO
  130. recognized the significance of a knowledge economy EX 
  131. which in turn saves a great deal of money EX
  132. as there is a causal relationship between the two indicators EX
  133. Considering all the relevant factors involving TS
  134. ensure government and corporation transparency and integrity. EX
  135. For instance, by using the Internet, citizens can disseminate other's behaviors, either good or bad, the authorities would be very mindful of their actions. EX
  136. For instance, since almost every behavior, either good or bad, can be recorded/videotaped and shared/disseminated on the Internet, governments, and corporations would be very mindful of their actions. EX
  137. For example, anyone with a computer and internet connection can have the same opportunities as others because he or she can acquire the knowledge that had long been considered a secret to the majority EX
  138. in a variety of ways. CL
  139. Juvenile crime has become an emerging issue of huge public concern in recent years. Given that this issue leads to a series of future impacts, identifying the reasons behind it is the key to finding solutions.
  140.  There has been a rasing public concern about juvenile crime in recent years. Given that issue leads to a series of substantial impacts, identifying the reasons behind it is the key to finding solutions. Intro 
  141. Although some believe that violence in media is the cause of juvenile crime,  some other causes should be taken into account as well 
  142. Nowadays, the model of running a business within family members have gained in popularity around the world. Although some experts applauded this model, there still exist many limitations.  Intro
  143. In conclusion, given the clear advantages that a family-run business have, there
    are still limitation
    s.
     By acknowledging these limitations, the business owner
    can find ways to
       CL

















Read more... »

Thứ Tư, 6 tháng 5, 2020

Đọc file Matlab .mat vào C#

Để đọc file .mat được xuất ra từ Matlab, cần dùng thư viện MatFileHandle từ Github, bằng đường dẫn sau: https://github.com/mahalex/MatFileHandler.git
Trong đoạn code dưới, ex3weights.mat là tên file. For....each hiển thị 10 hàng đầu tiên của mỗi cột data

  static void Main(string[] args)
        {
            IMatFile matFile;
            using (var fileStream = new System.IO.FileStream("ex3weights.mat", System.IO.FileMode.Open))
            {
                var reader = new MatFileReader(fileStream);
                matFile = reader.Read();
               double[] vars = new double[matFile.Variables.Length];
               foreach (IVariable variable in matFile.Variables)
                {
                    var a = variable.Value.ConvertToDoubleArray();
                    Console.WriteLine(a.Length.ToString());
                    //a.Length
                    for (int i = 0; i <=10 ; i=i + 1)
                    {
                        Console.WriteLine(a[i].ToString());
                    }
                }
Read more... »

Thứ Tư, 15 tháng 4, 2020

Eigenvalue Eigenvectors

Hôm nay mình học PCA, gặp cái eigen  value và eigen vector mà chưa hiểu rõ meaning nó lắm. Google rồi ra mấy kết quả này này. Đem lưu lại đây để sau này lỡ quên còn đọc

In mathematics, eigenvalue, eigenvector, and eigenspace are related concepts in the field of linear algebra. Linear algebra studies linear transformations, which are represented by matrices acting on vectors. Eigenvalues, eigenvectors and eigenspaces are properties of a matrix. They are computed using various matrix methods, give important information about the matrix, and can be used in matrix factorization. They have applications in areas of applied mathematics as diverse as finance and quantum mechanics.
In general, a matrix acts on a vector by changing both its magnitude and its direction. However, a matrix may act on certain vectors by changing only their magnitude, and leaving their direction unchanged (or, possibly, reversing it). These vectors are the eigenvectors of the matrix. A matrix acts on an eigenvector by multiplying its magnitude by a factor, which is positive if its direction is unchanged and negative if its direction is reversed. This factor is the eigenvalue associated with that eigenvector. An eigenspace is the set of all eigenvectors that have the same eigenvalue. The concepts cannot be formally defined without prerequisites, including an understanding of matrices, vectors, and linear transformations.
In quantum mechanics, and in particular in atomic and molecular physics, within the Hartree-Fock theory, the atomic and molecular orbitals can be defined by the eigenvectors of the Fock operator. The corresponding eigenvalues are interpreted as ionization potentials via Koopmans' theorem. In this case, the term eigenvector is used in a somewhat more general meaning, since the Fock operator is explicitly dependent on the orbitals and their eigenvalues.
In geology, especially in the study of glacial till, eigenvectors and eigenvalues are used as a method by which a mass of information of a clast fabric's constituents' orientation and dip can be summarized in a 3-D space by six numbers. In the field, a geologist may collect such data for hundreds or thousands of clasts in a soil sample, which can only be compared graphically such as in a Tri-Plot (Sneed and Folk) diagram, or as a Stereonet on a Wulff Net. The output for the orientation tensor is in the three orthogonal (perpendicular) axes of space.
In mechanics, the eigenvectors of the inertia tensor define the principal axes of a rigid body. The tensor of inertia is a key quantity required in order to determine the rotation of a rigid body around its center of mass.
Eigenvalue problems occur naturally in the vibration analysis of mechanical structures with many degrees of freedom. The eigenvalues are used to determine the natural frequencies of vibration, and the eigenvectors determine the shapes of these vibrational modes. The orthogonality properties of the eigenvectors allows decoupling of the differential equations so that the system can be represented as linear summation of the eigenvectors. The eigenvalue problem of complex structures is often solved using finite element analysis.
Nguồn: Nguồn
Read more... »

Thứ Năm, 5 tháng 3, 2020

Tính CRC - Modbus RTU

Tính CRC Modbus

int[] intSend = new int[8];
intSend[0] = 0x01; // ID of slave device
intSend[1] = 0x03; // code of the command
intSend[2] = 0x1D; // Register address 0x1D63
intSend[3] = 0x63; // Register address 0x1D63
intSend[4] = 0x00; // First 8 bits of the data
intSend[5] = 0x02; // Second 8 bits of the data

int int_crc = 0xFFFF;
int int_lsb;
int int_crc_byte_a, int_crc_byte_b;

for (int int_i = 0; int_i < intSend.Length - 2; int_i++)
{
int_crc = int_crc ^ intSend[int_i];
for (int int_j = 0; int_j < 8; int_j++)
{
int_lsb = int_crc & 0x0001; // Mask of LSB
int_crc = int_crc >> 1;
int_crc = int_crc & 0x7FFF;
if (int_lsb == 1) int_crc = int_crc ^ 0xA001;
}
}


Mình sẽ cho các bạn 1 đoạn mã để thử như sau :
"01 03 00 01 00 04" có mã CRC = 15 C9
----------------------------------------

Hoặc có hàm tính CRC này thấy dễ xem hơn .
Khi sử dụng, thì hãy truyền vào 1 mảng, kiểu dữ liệu là byte và "len" là số byte của chuỗi truyền.
Ví dụ: Với chuỗi "01 03 00 01 00 04". Ta khai báo 1 mảng byte mang[];
Hãy gán giá trị cho mảng như sau: mang[0] = Convert.ToByte("01",16) ....và tiếp tục với
các giá trị còn lại còn lại.
chuỗi truyền có 6 byte nên "len = 6";
Khi sử dụng thì hãy gọi hàm ModRTU_CRC(mang,len);


UInt16 ModRTU_CRC(byte[] buf, int len)
{
UInt16 crc = 0xFFFF;

for (int pos = 0; pos < len; pos++) {
crc ^= (UInt16)buf[pos]; // XOR byte into least sig. byte of crc

for (int i = 8; i != 0; i--) { // Loop over each bit
if ((crc & 0x0001) != 0) { // If the LSB is set
crc >>= 1; // Shift right and XOR 0xA001
crc ^= 0xA001;
}
else // Else LSB is not set
crc >>= 1; // Just shift right
}
}
// Note, this number has low and high bytes swapped, so use it accordingly (or swap bytes)
return crc;
}




Và đây là 1 video tui từng làm 

https://www.youtube.com/watch?v=eKS4dYHkMls
Read more... »

Thứ Hai, 23 tháng 12, 2019

Tài liệu học tiếng Anh từ vỡ lòng đến mức tèo như Lam @@

 Vào những ngày sau bảo vệ đồ án tốt nghiệp đại học, 2014, trong khi bản thân mình đang đi sửa máy ở các khu công nghiệp, thì thằng bạn của mình được làm ở Schneider Electric. Khi đó, mình có thử mở một clip tiếng anh xàm xàm gì đó, và hỏi nó hiểu gì không. Thằng bạn trả lời vanh vách. Mình thấy ngưỡng mộ nó quá, vì mới thấy nó học có một năm mà sao kinh thế? :3 (Sau này mới biết được mấy cái từ tiếng Anh level trẻ em hết à). Thằng đó trả lời mình cách học theo pp Effortless English. Tìm ra thì thấy cái này free này, mình cũng chỉ đặt mục tiêu học giỏi bằng nó thôi. kaka
Và hành trình học tiếng Anh bắt đầu từ đó. Ngày nào cũng học cỡ 30p, chia làm hai ca sáng-tối. Nhiều bữa đi nhậu về xỉn vẫn nhớ học. kaka
Bài học rút ra là trừ khi bạn là thiên tài, còn lại bạn phải dành ra 30p mỗi ngày để học tiếng Anh thì mới dám nói chuyện bập bẹ sau hơn nửa năm.
 
Sau đó một năm, mình bắt đầu đăng ký kỳ thi đầu ra tiếng Anh cho mấy cu em khóa sau, (khóa mình không cần thi), mình đạt 435 điểm gì đó. Một con số khiêm tốn, nhưng mình chợt nhận ra sự tiến bộ vượt trội trong bản thân, từ một chữ cũng không nói được rõ, mà sau một năm chả tốn xu tiền học nào mà lên được 435 điểm TOEIC. Wow. Mình cười nắc nẻ, tự phục lấy bản thân mình.
Bài học rút ra là phải tự cảm thấy tự hào về bản thân sau mỗi thành công, dù bé tí.

Một thời gian sau, mình có thuê cô giáo Nhung dạy phát âm. Nói là thuê, nhưng chỉ dẫn cô đi ăn, chứ cô không lấy tiền. Nhớ có hôm Cô bắt nói các âm /t/ cả buổi, uống hết 2 chai nước suối mà vẫn chưa đâu vào đâu luôn. Đúng ra là cũng học với cô lâu hơn xíu, nhưng sau đó lại bận đi đạp xe xuyên Việt nên ngưng rồi hủy lịch học luôn sau 2-3 buổi gì đó. 

Sau cỡ chừng gần 2 năm học, vẫn cứ theo phong cách bập bẹ mỗi ngày 15p bữa sáng/15p bữa tối, mình lại đi thi tiếng Anh TOEIC lần nữa. Mình cũng đã dành thời gian làm hết các đề trong RC/LC 1 download lậu trên mạng. Mình cũng thuê bé Linh, trường BUH dạy cho 2 buổi, bé chỉ cho cách làm đề TOEIC, mình cũng cảm ơn bé bằng một bữa ăn và 200k. :v 

Bài học rút ra là trong hành trình học tiếng anh của một thằng con trai, cần phải có một người con gái kèm ;v

Và rồi mình cũng được đâu 535 điểm trong kỳ thi đó, và apply vào trường CCU bên Taiwan học. Trước khi đi, mình cũng tự tin lắm, vì cứ nghĩ mấy chữ tiếng Anh lâu nay chắc cũng đủ dùng. Nào ngờ đâu, qua đó rồi mới biết trình còn gà lắm, kể mấy story cũng không được luôn. Vậy là phải tiếp tục học nữa. =)). Mình bắt đầu viết script cho các câu chuyện muốn nói. Mình đi kể cho hết đứa này đến đứa nọ nghe. Đến chừng nào nói trôi chảy thì mới đổi chuyện. 

Mình biết đã tự tin lên khá nhiều, nhưng khổ cái nhiều bạn trong trường cứ chê mình trề môi. :v Mình cũng thấy tự ti lên khi nói trước các bạn đó. Quả thật, thời điểm đó mình thấy ai cũng giỏi hết trơn á. Nhưng đó cũng là một động lực giúp mình chăm học hơn. Mình có nhớ có lần mình phát âm sai từ "start-up", mà bạn ấy bắt bẻ ối dồi ôi luôn ạ. Sau này vô tình nghe lại tiếng anh của bạn ấy năm 2020 về giới thiệu promotion cho trường của bạn ấy, đúng là bạn nói như shit, dù bạn từng là sv trường quốc tế. Điểm chung của các bạn hay chê là không đủ giỏi. Cũng có một số bạn khác mình nghĩ là giỏi hơn, thì họ cũng có dành những lời khen cho mình (dẫu chỉ là white lie).

Bài học rút ra là khi bạn đem so sánh hơn-bằng-thua một con bò thì cũng đều ngu như nhau cả thôi. Nếu không khích lệ learners được một câu tử tế, thì im lặng thì tốt hơn.
Read more... »

Thứ Năm, 13 tháng 6, 2019

Làm quen với ESP8266 cho người mới - TCP Server, STA mode ...etc

Chả là hôm nay rảnh hơi, đi mua cái module 4 relay ESP8266 về làm chơi. Mà làm mãi dựa trên cái SmartConfig của mấy bạn tàu mà không được, hỏi cũng chả ai nói sao, thật là khó hiểu,,,,hay là tại tui....chậm tiêu. Anyway, kệ nó vậy, viết bài Tut cho sau này lỡ quên thì còn có chỗ mà coi.

Q1. Nên mua board mà có tích hợp sẵn của mấy ông LCTECH không?
A1: Nope, đừng có mua, mé nó cứ làm lằng nhằng bỏ mịa, việc gì cứ phải đâm đầu ngồi nhớ A1 00, với A1 01 làm gì.
Q2. Nên mua board nào? Mua thêm phụ kiện gì?
A2. Nên mua loại board tích hợp về thử trước, mấy board Node MCU, có ra chừng chục I/O, tha hồ chơi, nó cũng cho code thoải mãi trên IDE của Arduino. Giá mấy con này loại chíp chuyển là CH340 cg chỉ chừng 70k. Sau đó mua thêm một cái module 4 relays chừng 30k nữa là về đóng mở điện bá cháy. Mua thêm vài cái Jump đực-cái, với cái sợi Usb micro của mấy đt  Android.
Chốt lại, cần những thứ sau để bắt đầu chơi:

  1. Board ESP8266 Node mcu, loại chíp CH340 hoặc tương đương
  2. Module 4 relays loại kích cao(thấp)
  3. 10 sợi bus đưc, 10 sợi cái
  4. Dây micro usb
Nào cùng bắt đầu nhé....tèn tén ten

Sơ đồ chân của em ESP8266 Node MCU


Ví dụ 01: Thay đổi trạng thái cho ngõ ra D1


#define LED_PIN D3   // Lưu ý khi khai báo chân cho ESP, nhìn vào mặt trên để khai báo,
                                      // đừng mất công đi khai báo theo chân GPIO

void setup() 
{
  pinMode(LED_PIN, OUTPUT); 
}
int delay_temp=0;
bool stt=0;
void loop() {

     digitalWrite(LED_PIN, stt);
     stt^=1;   //đảo trạng thái bằng lệnh XOR
    delay(500);
    
}


Đấy, giờ nạp được rồi đấy.


Bài 2: Tạo TCP Server trên ESP,  STA network mode

Code sườn được lấy từ Tech Tutorial's website , so  Credite to Tech tutorial 



#include "ESP8266WiFi.h" #define LED D3 const char* ssid = "Lam de thuong"; const char* password = "Lam dep trai"; WiFiServer wifiServer(80); void setup() { pinMode(LED, OUTPUT); Serial.begin(115200); delay(1000); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting.."); } Serial.print("Connected to WiFi. IP:"); Serial.println(WiFi.localIP()); wifiServer.begin(); } void loop() { WiFiClient client = wifiServer.available(); if (client) { while (client.connected()) { while (client.available()>0) { char c = client.read(); if (c=='H' ) { digitalWrite(LED, HIGH); Serial.println("LED-HIGH"); } if (c=='L' ) { digitalWrite(LED, LOW); Serial.println("LED-LOW"); } delay(10); } } client.stop(); Serial.println("Client disconnected"); } }


Bây giờ làm sao để test code này nhỉ?

Bạn cần down load 1 phần mềm TCP Client bất kỳ và thử connect nhé. Ví dụ nếu tui dùng Hercules để thử chẳng hạn. 


Thứ tự cần làm là: Mở terminal COM trên IDE arduino =>> Mở Hercules =>> Chọn TCP Client =>> Điền IP và port tương ứng với mạng nhà bạn, của tui là xx.xx.1.13 port là 80 =>> Nhập chữ L và H như góc trái dưới =>> Bấm Send.,,,,yeah
Read more... »

Thứ Sáu, 8 tháng 2, 2019

Review sách - Đời ngắn đừng ngủ dài

Đời ngắn đừng ngủ dài
Một cuốn sách nói về các triết lý lõi cơ bản trên con đường thay đổi, phát triển bản thân. Sách được chia thành nhiều mục, mỗi mục là một bài học riêng. Mỗi bài học được viết gói gọn trong hai hoặc ba trang giấy, cùng với đó là một "quote" trích dẫn đi kèm.
Và đây là các mục chuyện mà tôi cảm giác thích nhất.
Sự cân bằng.
Cuộc sống nói chung là sự quân bình. Một trong số những sự quân bình sống còn là giữa tự do và trách nhiệm. Bằng đam mê, sự thoải mái, hãy cứ tự do tận hưởng giây phút này, hiện tại. Những hãy tưởng tượng xem Tôn Ngộ Không chẳng có một vòng kim cô? Hắn sẽ mãi là chú khỉ, cả gan náo loạn thiên đình. Vâng, mọi thứ cầng một sự ràng buộc, và tự do cũng cần trách nhiệm để kìm hãm.Quá nhiều thời gian cho sự tự do sẽ không đủ thời gian thực hiện các đòi hỏi để xây dựng sự nghiệp và bổn phận hàng ngày hoặc ngược lại.

Nguyên tắc cơ bản: Tôi rất sợ người nào hòa nhã với tôi, mà thô lỗ với người bồi bàn, chẳng nhất quán gì cả. Sự vượt trội đến từ những giá trị cốt lõi cơ bản




Review sách: Cách sống
Nguyên tắc của start-up: Khi mới ra ý tưởng, hãy chọn những ý tưởng từ kẻ khờ khạo, vì đó mới có sự phá cách, không bị bó buộc bởi các nguyên tắc hay tư duy lối mòn. Còn khi bắt đầu, hãy chọn kẻ có thiên hướng bi quan, để có thể vạch ra những rủi ro chi tiết nhất có thể.
Còn nữa....
Read more... »

Thứ Ba, 4 tháng 12, 2018

Comfort zone- Vùng an toàn


Comfort zone- Vùng an toàn

Ở một ngôi làng nọ, hai chú ếch vẫn hạnh phúc trong cái vùng trời bằng chiếc vung và chẳng màng tới thế giới. Rồi một ngày, hai chú ếch nhỏ đã bắt đầu tò mò về những câu chuyện về thế giới ngoài được vọng miệng chiếc giếng. Chú ếch nhỏ đã bàn về việc cùng nhau về sự tiềm năng nếu ra khỏi cái giếng. Chú ếch lớn thì say “no” ngay  tức thì với ý tưởng điên rồ này và vẫn tiếp tục cuộc sống hạnh phúc của thực tại.
Thời gian sau đó, chú ếch con đã quyết định làm chuyến phiêu lưu ra khỏi ngôi ngày của chú. Để làm được việc đó, chú dự tính tập luyện chăm chỉ trong suốt 2 năm ròng rã. Và cuối cùng, chú đã được thoát ra  bằng dây kéo nước của chủ nhà như dự định. Ngày đầu bước ra khỏi cái giếng, chú nhìn xung quanh một cách lạ lẫm, có chút phấn khích, tự hào với bước đi kẻ khai sáng. Chú thấy tiếc nuối với người bạn còn lại trong cái giếng. Ôi, con đường rộng quá, những ngôi nhà cao quá. Chú cảm giác hạnh phúc tràn đầy với quyết định thay đổi “chiếc vung” bầu trời. Nhưng sau những phút giây phút hạnh phúc ban đầu, chú đành phải vật lộn với những bước làm quen với cuộc sống mới. Chú không có chỗ trú ngụ cùng thức ăn sau mỗi ngày du hành mệt rã rời. Những lúc như thế, chú đành tự hỏi liệu có đáng hay không với quyết định du hành này? Chú ếch bé luôn trấn an rằng rồi ngày sau sẽ tốt hơn, nhưng “How good is good?” thì chú cũng không thể biết được. Còn nữa....
 ----------
Chú ếch lớn vẫn hạnh phúc trong vùng trời của mình, còn chú ếch con sau những phút giây hạnh phúc thì đang vật lộn với cuộc sống?
Ai là kẻ có sự lựa chọn đúng đắn hơn?




Read more... »

Thứ Ba, 9 tháng 1, 2018

How to get to my dorm?

Hello all,
This is Lam from Vietnam. I am student at National Chung Cheng University, Chiayi, Taiwan.
Recently, I’ve hosted some CSers from around the world in my dorm. A common thing that these guys often face is struggle to get to my dorm. This file is to help these traveler who want to stay with me to find the way to come here easily. There are two opptions, by bus or by train. 
Okie, check it out!
Read more... »

Thứ Bảy, 7 tháng 10, 2017

Hướng dẫn xin học bổng Đài Loan - Handbook

[Updated 15th Jan,2018]
Chào mọi người, với bài đăng lần trước có rất nhiều bạn quan tâm, nên hai ngày rồi mình ngồi viết lại toàn bộ quá trình làm sao xin học bổng ở các trường đh ở Đài Loan. Các thông tin được cung cấp từ chính quá trình của bản thân, mang tính tham khảo nhá, k chịu trách nhiệm về độ chính xác hi. Các bạn down về đọc nhé. Mục phụ lục như dưới hen, trong đó có phần thông tin học bổng cực khủng từ trường tui đang học. Link ở cuối bài viết.
Bonus thêm cái ảnh chụp năm ngoái, quần đùi dép lào là phong cách đến trường bên đây.


Nếu bạn k download được file trên, hãy email cho mình, mình sẽ gửi file lại cho bạn.!

Vì đây là lần đầu tiên tui viết bài hướng dẫn nên sẽ có nhiều lỗi, cũng như thiếu sót. Do đó, các bạn đọc nhớ cmt góp ý bằng cách cmt phía dưới hoặc gửi về địa chỉ email hoặc fb trong mục Contact. 
Thân ái !!!

Read more... »

Thứ Hai, 2 tháng 10, 2017

Làm sao xin học bổng ở Đài Loan?

Học bổng ở Đài Loan

Đài Loan - một hòn đảo tương đương 1/10 diện tích Việt Nam, nhưng lại có nên giáo dục cực kỳ tiên tiến với những đại học top 70 thế giới là một lựa chọn để các bạn sinh viên hoàn thành giấc mơ du học. Đặc biệt chương trình giáo dục ở đây được dạy bằng tiếng Anh, theo chuẩn Mỹ nên dễ dàng hơn cho sv quốc tế. Chừng chục năm trở lại, đặc biệt từ khi bà Thái Anh Văn lên làm tổng thống, thì chính sách thu hút du học sinh đặc biệt ở các nước Đông Nam Á trở nên hấp dẫn hơn. Bên cạnh đó, với mong muốn thăng hạng trong bảng xếp hạng các trường đại học trên thế giới, cũng như thu hút sinh viên để gia tăng nguồn nhân lực nghiên cứu thì hầu hết cách trường đều có chế độ đãi ngộ riêng cho sinh viên quốc tế,  đặc biệt là các nghành kỹ thuật.
Học bổng thường có 2 loại,
Read more... »

Thứ Hai, 3 tháng 7, 2017

Bus from Chiayi - Alishan - Sunmmon lake

Yesterday, some new friend asked me how to get to Alishan from Chiayi by bus.
As attached link is bus time table, more details about.
The original file is only in Chinese, so I translated it to English, hope to help foreign person who can not read Chinese. Do not hesitate to ask if you have any problem.

Lam from CCU, Chiayi, Taiwan
Link mediafire.com : Download
If that link does not work, please check google driver link:  Other download link
Enjoying your life.
My friend and I were in Alishan in March 2017.



Read more... »