Monday, March 21, 2022

Vulnerability Check of Logjam Attack

 Run command "openssl s_client -connect ${SERVER}:${PORT} -cipher "EDH" | grep "Server Temp Key"" found in following article

(Note that openssl version used for testing needs to be 1.0.2 or above)

The key needs to be at least 2048 to be ok.

Saturday, October 16, 2021

Enable PWA for React App

1. Create project "npx create-react-app myapp --template cra-template-pwa"

2. Update "App.css" and "App.js" with the desired functionality implementation

3. Change "serviceWorkerRegistration.unregister()" of "index.js" to "serviceWorkerRegistration.register()"

4. Deploy the app

Sunday, October 10, 2021

Enable Running iOS Simulator with XCode on Mac M1

post_install do |installer|
 installer.pods_project.build_configurations.each do |config|
  config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
 end
end

Wednesday, May 26, 2021

Install CMake on Mac

 Could be achieved with the following steps:

  1. Download CMake dmg file from https://cmake.org/download/
  2. Install CMake with dmg file
  3. sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install
Note: Instead of install VSCode with CMake, could also consider to generate XCode project file with command "cmake -G XCode ."

Saturday, May 15, 2021

Deploy React App to Firebase

1. Install Firebase CLI
    sudo npm install -g firebase-tools

2. Login to Firebase
    firebase login

3. Initiate your project
    firebase init
    (a) Select "Hosting"
    (b) Choose "Use an existing project" (if already created)
    (c) Choose the desired project
    (d) Enter "build" for public directory
    (e) Enter "No" for single-page app
    (f) Enter "N" to avoid overwritten index.html

4. Perform "npm run build"

5. Deploy with "firebase deploy"

Note: The above command is recommended to be executed in the React project directory

Reference: https://dzone.com/articles/react-apps-firebase

Saturday, April 17, 2021

Setup Unit Test and Code Coverage for C++ in Linux

Setup Unit Test

  1. Clone Google Test repo https://github.com/google/googletest
  2. Checkout latest release tag (Optional)
  3. Install the gtest library with the following commands:
    a. mkdir build
    b. cd build
    c. cmake ..
    d. sudo make install

Setup Code Coverage

  1. Get lcov source code tar bar from http://ltp.sourceforge.net/coverage/lcov.php
  2. Extract lcov tar ball
  3. Execute  sudo make install 

Implementation

At the beginning of "CMakeLists.txt", include the "test" option to allow test running to be optional.
option(test "Build and tests." OFF) # Makes boolean 'test' available.

In addition, at the end of "CMakeLists.txt", include the following.  Add more files under "add_executable" to include more unit tests.
if (test)
    enable_testing()

    add_executable(runUnitTests
        main_test.cpp)

    target_link_libraries(runUnitTests -pthread
        gtest gtest_main
        gcov
        )

    target_compile_options(runUnitTests PRIVATE
        -std=c++11
        -Wall
        -fprofile-arcs
        -ftest-coverage
        )

    add_test(NAME unittest COMMAND runUnitTests)
endif()

The following should be included in "main_test.cpp":

#include <gtest/gtest.h>

int main(int argc, char *argv[]) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}


Running Unit Test and Generate Code Coverage Report


./runUnitTests --gtest_output="xml:gtest.xml"
gcov main_test.cpp.gcno
lcov --capture --directory . --output-file LCOVOUTPUT.info
genhtml LCOVOUTPUT.info --output-directory ./code_coverage

Friday, January 8, 2021

Enable CocoaPods on Mac M1

 

  1. Duplicate the Terminal application in the Utilities folder.
  2. Right click on the app and choose Get Info.
  3. Rename the other version of the app as you like.
  4. Check the option "open with Rosetta".
  5. Install Cocoapods with the command "sudo gem install cocoapods"
  6. Type the command line "gem install ffi" to fix the ffi bundle problem. Now you can do a "pod install" without problem.

Courtesy from https://stackoverflow.com/questions/64901180/running-cocoapods-on-apple-silicon-m1