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 ...
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 ...
成長可以很早,可以很晚。最近一年的感覺是,這件事,好像終於到我身上來了。
深深體會沒耐心的壞處,凡事等一等,是今年的大課題。
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 |
Another silly mistake I made due carelessness .
I spent certain hours to just figure out the root-cause : Missing json.dumps when I pass the data.
Originally, I think put json content in header is OK...
#Call Rest API with json data import requests import json import os baseUrl = 'endpointAddr/api-link' #Parameters data = { "id":"1234568", "currency":"HKD", "amount":"1000" } #function to call def callAPI(): response = requests.post(baseUrl,headers={"Content-Type": "application/json","Authorization": "Bearer xxxxxxxxxxxxxxx"}, data=json.dumps(data)) if response.status_code == 200: print('Access token test :' , response.json()) authToken = response.json()['access_token'] print('Access token:', authToken) return (authToken) else: print('Login failed with status code:', response.status_code , response.text) return (0) #Main response1 = callAPI() print ('response 1 ' + response1)
Prequisites : Setup Connected App with X509 Certification.
預設需要先在Salesforce 上載X509證書。詳細設定連接。(可接受自行簽署版本證書)
Details Set up in Salesforce side : link
#POC of JWT call to API#Colab install library with >> !pip install pyJWT[crypto] import jwt from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import rsa import time import requests import json expTime = int(time.time()) + 900 #Unix Epoch Timestamp Expire time. 15mins buffer jwt_algorithm = 'RS256' jwt_private_key_file = '/myPath/server.key' jwt_payload = { "iss": "clientid", "sub": "salesforce_username_email", "aud": "https://test.salesforce.com", "exp": expTime } jwt_header = { "alg": "RS256", "typ": "JWT" } salesforceEndpoint = 'https://test.salesforce.com/services/oauth2/token' api_endpoint = 'https://instance_domain.my.salesforce.com/services/data/v57.0/sobjects/myObject__c' test_data={ "description": "PythonSent", "language": "en", "remarks": "xxx", "expiry_time": expTime+900, "created_time": expTime } def loginSfdc(): # Load the private key with open(jwt_private_key_file, 'r') as f: jwt_private_key = f.read() # Generate the JWT token jwt_token = jwt.encode(jwt_payload, jwt_private_key, algorithm=jwt_algorithm,headers=jwt_header) print('token : ' + jwt_token); salesforceUrlParams = { 'grant_type' : 'urn:ietf:params:oauth:grant-type:jwt-bearer', 'assertion' :jwt_token } response = requests.post(salesforceEndpoint, params=salesforceUrlParams, verify=False) if response.status_code == 200: authToken = response.json()['access_token'] print('return token ' + authToken) return authToken else: print('Request failed with status code:', response.status_code) print('Request failed with status code:', response.text) return(0) #function to call def callSfdc_pocApi(authToken): session = requests.Session() rheaders = { 'Authorization': 'Bearer ' + authToken, 'Content-Type': 'application/json' } response = requests.post(api_endpoint,headers=rheaders, data=json.dumps(test_data)) returnStr = '' if response.status_code == 200: data = response.json() returnStr = data else: print('Request failed with status code:', response.text) returnStr = response.status_code return returnStr #Main response1 = loginSfdc() if not response1 == 0: response2 = callSfdc_pocApi(response1) print ("OK") print(response2) else: print ('Failed to Login')
一直在Window 10 (64bit) 上使用PhotoImpact X3 都好好的,今天突然開不到。
查了很多資料,最後發現是暫存檔的問題。
把以下位置中所有今天才生成的檔案移走,重開就行了。
C:\Users\YOUR_NAME\AppData\Roaming\Ulead Systems\Ulead PhotoImpact\13.0\Ulead.DAT\
從中學開始用了PhotoImpact 系列20年,升學及工作都多用Photoshop,但自用時還是更喜歡輕量易用的PhotoImpact 呢!~
Due to the limitation of renpy in rendering dynamic screen , due the the black border it gives in different UI scale resolution , finally ...