Skip to main content

Posts

How to make pull request

PURPOSE Pull requests are a mechanism for a developer to notify team members that they have completed a feature. HOW IT WORKS //============================================== For developer Main step: 1. Make sure branch naming is corrected. Rename command: git branch -m newName 2. Make sure your source code based on lastest source code in "develop" branch git checkout develop git pull git checkout your-branch git rebase resolve conflict(if any) 3.Squash commit A nice way to group some changes together, especially before sharing them with others. https://www.internalpointers.com/post/squash-commits-into-one-git 4. Final step Re-check "Commit message" Re-check "Source changes" Add reviewer //============================================== For reviewer/project maintainer 1. Review code - Convention (naming, format) - Clean code(duplicate, pseudo code, debugger....based on SOLID, DRY, KISS) - Unit test code 2. This implementat...

Car gadget 2020

Introduction This is a car gadget which is a present for my wife who got a driver’s license not long ago. In fact, the traffic in Vietnam is terrifyingly dangerous because vehicle owners usually break the rules. For example, reckless driving, road rage, making improper turns, following too close, jaywalking and accidents are common sense in Hanoi. Driving is truly a big challenge for a new driver. This device may improve one-way communication between the driver and another from the following vehicle. Main features This device has two separated modules:  The first module will be set up in front of the driver. It can recognize the driver's voice. Then it automatically translates driver voice to text commands and forwards these commands to the other module which is installed in the rear-end of the car. The second module receives the command from the first module and displays corresponding content on the led matrix screen. It also reads car speed from the GPS...

How to start python script by batch file on window

How to start python script by batch file on window Reference https://datatofish.com/batch-python-script/ Assumption - Your python script is manage.py - Create a batch file "run.bat" which is placed in the same directory with your python script. run.bat source code :: find python.exe path @ for %%i in (python.exe) do @ set py = %%~$PATH:i ::run main program %py% %CD% \manage.py ::wait for stop pause manage.py source code print ( "Surprisingly, The naughty kitten defeated a giant python" ) Looking more sample batch file https://www.robvanderwoude.com/batexamples.php

Develop the first python client test application by Paho mqtt

Develop the first python client application by Paho I. Purpose: 1. Try to send messages between 2 clients via MQTT protocol. Then, we will create 2 clients: - One for publishing (or send) the message. Other for subscribing (or receive message). II. Pre-condition: - You already installed Mosquitto broker, Python. III. Step by step 1. Download example from Github https://github.com/eclipse/paho.mqtt.python 2. Modify subscriber(client) source In folder example/client_sub.py. Modify some pieces of source code. before mqttc.connect("mqtt.eclipse.org", 1883, 60) mqttc.subscribe("$SYS/#", 0) after mqttc.connect("192.168.203.76", 1883, 60) mqttc.subscribe("test/topic1", 0) note: "192.168.203.76": IP address of machine which Mosquito broker installed on. 1883: mqtt port 3. Modify publisher(client) source In folder example/publish_single.py. before: publish.single("paho/test/sing...

How to test Mosquitto broker on Windows machine

Install Mosquito broker https://mosquitto.org/download/ 1. Install service easily by some click. 2. Check operation Reference: http://www.steves-internet-guide.com/install-mosquitto-broker/ - open command prompt and check installed directory cd C:\Program Files\mosquitto mosquitto -h or mosquitto -v - start service mosquitto -p 1883 - check port 1883 is listening or not netstat -a - add system environment variables. Add below string to the system environment path. It helps you call mosquito in the command line window. ;C:\Program Files\mosquitto Example Reference: https://www.win.tue.nl/~lrahman/iot_2016/tutorial/MQTT_2016.pdf 1. Open the first command windows 2. Start mosquitto by command mosquitto -p 1883 3. Open the second command windows 4. Allow client subcribe the topic by command mosquitto_sub -t 'test/topic' -v This time, a client has the ability to handle the message from publisher. 5. Open the third command windows 6. Publish message...

[Bài dịch] Độ phủ của test case bao nhiêu là đủ? Code Coverage ?

Trên một ngôi chùa nhỏ tên là Toàn Âm Tự trên núi Lỗ Tề (Lotte Tower) Dự án kiểm thử phần mềm đếm số hạt bụi mịn 2.5pm ở kinh đô Hà Nộ đang bắt đầu triển khai phase Unit test. Sáng sớm, một hòa thượng mới nhập chùa một năm hỏi đại sư Thích Đề Mô - trưởng dự án.  Thưa đại sư, con sẵn sàng chạy Unit test cho chức năng đo bụi mịn, vậy chẳng hay đại sư muốn tỷ lệ phủ (code coverage) là bao nhiêu? Đại sư nhìn chú với ánh mắt hiền từ và nói: "Con ah, đừng lo lắng quá về tỷ lệ phủ, con hãy cố gắng viết thật nhiều những test case tốt." Chú vâng lời, cúi chào và rời đi. Ánh nắng cuối thu len lói qua những màn sương lờ mờ chiếu rọi khắp sân chùa. Mặt trời đã lên quá ngọn tre đằng ngà. Một hòa thượng khác đến hỏi câu hỏi tương tự cho chức năng hiển thị trên mobile app. Đại sư từ tốn chỉ vào nối nước đang sôi dưới bếp và hỏi: "Con hãy cho ta biết, ta nên cho bao nhiêu gạo vào nồi nước đang sôi kia?" Chú hòa thượng lúng túng đáp: "Thưa đại s...

[OpenCV] Simple example C++ and ubuntu

Prerequisite: Opencv is already installed. Source code: //include high gui headers #include "opencv2/highgui/highgui.hpp" //we are using standard and OpenCV namespaces using namespace cv; using namespace std; int main( int argc, const char** argv ){ //create a window named theWindow namedWindow("theWindow", CV_WINDOW_AUTOSIZE); //wait user hit some key waitKey(0); //destroy window named theWindow destroyWindow("theWindow"); return 0; } Build command: g++ -o firstcv $(pkg-config --libs --cflags opencv) main.cpp if error happened. /tmp/cceyijPd.o: In function `main': main.cpp:(.text+0x3d): undefined reference to `cv::namedWindow(cv::String const&, int)' main.cpp:(.text+0x53): undefined reference to `cv::waitKey(int)' main.cpp:(.text+0x70): undefined reference to `cv::destroyWindow(cv::String const&)' /tmp/cceyijPd.o: In function `cv::String::String(char const*...