Wednesday, January 15, 2025

Great free tools for System Integration : Inspecting the HTTP-based request for API testing 免費好用的API測試工具

In order to setup a  HTTP-based API successfully, it is necessary to check request and response.

Postman is a great tool to check the response, how about the request ?

It can be trouble that if we cannot access a 3rd party system's request log while we have to send request to them . How can we verify the request we made is valid ? If the request will be altered by some middleware we may not able to touch ?

Here is one of the solution , make a mock server to capture the final request to the endpoint.
In past , it may takes time to setup a mock server , now , it becomes super easy. 

The great tool here is beeceptor !!! No registration needed , no installation needed.
Just need one browser tab ~

Steps as simple as below :

  1. Create an endpoint at https://beeceptor.com/ and leave this browser tab open.
    The endpoint will be like : 
    https://{your_input_name}.free.beeceptor.com 



  2. Change the endpoint used in code to the endpoint you just created .
  3. Execute the request in code from your IDE or other place , just execute your callout code.
  4. Refresh your https://beeceptor.com/ browser tab .
  5. Now you can check the request and header you just send, and you may create any response in the mock server .


Is is simple and easy , recommended by many platform like Salesforce.
Reference : 
https://help.salesforce.com/s/articleView?id=000384720&type=1

Thanks for reading.





Tuesday, October 15, 2024

Salesforce flow or Process deployment : Setting of active and test flow coverage

When deploy a new flow, it is default to be inactive.

But there is a setting to make it active in PROD org called "Process Automation Settings". 


We need to ensure coverage of the automation . It can be check by SOQL to FlowTestCoverage:

To calculate your flow test coverage, determine the number of all active flow versions with or without test coverage.
Single SOQL with + symbol.

SELECT count_distinct(Id) 
FROM Flow 
WHERE Status = 'Active' AND Id NOT IN ( 
SELECT FlowVersionId 
FROM FlowTestCoverage 
)
+
SELECT count_distinct(FlowVersionId) 
FROM FlowTestCoverage

 

Ref :https://help.salesforce.com/articleView?id=sf.flow_distribute_deploy_active.htm&type=5

Sunday, July 7, 2024

Python Error (Renpy) : TypeError: 'str' object is not callable

Met an error in renpy when writing the action function of an image button like below :
 action Function( '\u2192', pygame.K_RIGHT)

Error shown as below : 
File "renpy/common/00action_other.rpy", line 583, in __call__

    rv = self.callable(*self.args, **self.kwargs)

TypeError: 'str' object is not callable

Forgot to add the function name 
Corrected the syntax to below (also added the parameter name to before value):
action Function(simulate_keypress, unicode_key='\u2192', pygame_key=pygame.K_RIGHT)


Friday, June 28, 2024

Window Command line : Super easy command to search file in whole PC quickly

 1: cd "therootpath" 

2: dir "filename.extension" /s

For example search tje entire C drive : 
C:\>dir "myFile.jar" /s

Save me a day when searching for a jar file ...

Friday, March 22, 2024

安而後能慮。Think and plan , implement later . All about Patient .

成長可以很早,可以很晚。最近一年的感覺是,這件事,好像終於到我身上來了。
深深體會沒耐心的壞處,凡事等一等,是今年的大課題。


知止而後有定,定而後能靜;

靜而後能安,安而後能慮,慮而後能得。


太急進,急於求成,是很大的性格缺憾。管理人或事,都成很大的絆腳石。

Thursday, December 28, 2023

上架Play Store 之路 : Java Keytool 的亂碼字符 還有 存取被拒 使用的簽署憑證即將過期 的解決方法

第一次做react native App , 因電腦配備低只用React Native Cli. 

需要 Keytool做keystore. 

然後遇上第一個難關:
Run 以下command ,出現了亂碼 :
keytool -genkey -v -keystore my_key_name.keystore -alias my_key_alias -keyalg RSA -keysize 2048 -validity 10000 

原因是中文Window OS (也可能只有Win 10 這樣?) 

解決方法是輸入 : chcp 936 
將encoding 轉utf-8 . 

接著是第二個難關
密碼都打完了,卻發生存取被拒,無法生成keystore. 
解決方法是用管理員身份執行 Command line ... 😅

第三個難關
上載至Play Console 後,出現 
你上載的 APK 或 Android App Bundle 使用的簽署憑證即將過期,請使用有效期至較遠時間的憑證簽署 APK 或 Android App Bundle。

解決方法是修改validity 至更長時間
插曲 : 最後發現copy 至commandline時出錯,少copy 了validity..😭 

keytool -genkey -v -keystore my_key_name.keystore -alias my_key_alias -keyalg RSA -keysize 2048 -validity 20000 

第四個難關
是修改證書時間後再上載,然後出現的..
由於 Google Play 中已存在「com.xxx」,你需要改用其他套件名稱

解決方法是修改build.gradle中的applicationId...

第5個難關

都上載完成了,但是測試員無法下載...
A testing version of this app hasn't been published yet or isn't available for this account.

後來終於找到類似的解答 : Alpha test (Closed test封閉測試) 要等Google Review完成,才可以讓測試員下載。

Quoted : "
Every new app version that you release on Closed testing track are religiously reviewed by Google before they are made available to the testers. During this time, the release will show up as “in review” in the PlayStore console."

Ref : 這一篇關於Google Play Store Alpha Testing

根據文章資料,一般Google Review需要數小時至4天...

為了上架,撞得頭破血流了,希望快點Review完成,一切順利。

Sunday, November 12, 2023

Batch Script : The mystery of setting variable inside for loop

 Spend whole day to figure out how to get a random terms inside for loop.


Tried %%list[!index!]%% , %list[!index!]% , !list[%index%]! many many combination. 

Finally, a "call" made the magic.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@echo off

setlocal enabledelayedexpansion



REM Define the list

set "list[0]=a"

set "list[1]=b"

set "list[2]=c"



REM Enable delayed expansion within the loop

for /l %%i in (1,1,3) do (

    REM Generate a random index within the range of the list

    set /a "index=!random! %% 3"

    

    REM without that call, cannot get the string

    call set "randomString=%%list[!index!]%%"

    

    REM Print the iteration number and the corresponding random string

    echo Random string for iteration %%i: !randomString!

)



endlocal

Migrating from Renpy to Godot

 Due to the limitation of renpy in rendering dynamic screen ,  due the the black border it gives in different UI scale resolution , finally ...