Jiacheng Zhang Software Developer A software developer who loves attempting everything. Working as Project Manager for Unisoft in Changsha, China.

English Reading 6

Activities to improve your health

点击喜马拉雅-Reading Record 百度网盘

## 2024-01-13

## Words
chronic adj. 慢性的;长期的; n.慢性病人
detrimental 损害的
exacerbate 加剧
remedy 疗法
circulation 循环
tandem adv. 同时地 n.双座自行车;双人自行车 adj.串联;(两匹马)前后纵列
martial 武术的 martial art
stamina 耐力

## Key Sentences
We knonw chronic stress can be decrimental to pretty much very facet of your health.

Tai chi has been found to improve psychological well-being and to be a valuable method for decreasin stress, anxiety, and depression, as well as improving energy, stamina, mood and areobic capacity.

OpenAI CEO Altman ousted and back in

点击喜马拉雅-Reading Record 百度网盘

## 2024-01-14

## Words
whirlwind 旋风
oust 解雇
reinstate 复职
embolden vt.更有勇气 bold adj. 大胆的,n. 黑体
rally n. 集会, v. 召集 rallying around 围绕着


## Key Sentences
There's been a whirlwind week for the world of artificial intelligence.

Microsft still would have won, because they would have had Sam Altman and they would have maybe hundreds of OpenAI employees too.

Faithful employees sort of rallying around and being even more existed about what they were working on before.

English Reading 5

Finland and US signed Defense Cooperation Agreement

点击喜马拉雅-Reading Record 百度网盘

## 2023-12-20

## Words
Obligate 规定
Bolster 增强
Bilateral 双边的
Navay /ˈneɪvl/ adj. 海军的 navy n.
garrison  /ˈɡærɪsn/ n.卫戍部队;卫戍区;守备部队;驻防地  vt.驻防;派(兵)驻守
barrack /ˈbærək/ v.喝倒彩;起哄;给(所支持的人或队)加油;喝彩助威 n.兵营;营房;(临时性的)棚屋;外观简陋划一的房屋
vessel 船只 more formal, encompasses any watercraft ;  boat: with relatively smaller size than ship

## Key Sentences
The United State and Finland signed a defense cooperation agreement (DCA) on Monday.
It obligates Helsinki to open its military bases to US forces and allows the two militaries to conduct joint training, among other measures.

Furthermore, the DCA facilitates the prepositioning of defense equipment, supplies, and material within Finland's territery by US forces.
It also permits the entry and movement of US aircraft, vessels and vehicles.

US Federal Judge blocked a California law to control the gun

点击喜马拉雅-Reading Record 百度网盘


## 2023-12-31

## Words
deem 认为
deprive 相违背
conceal vt. 隐藏,隐蔽
sweep /swiːp/ v. 打扫 n. 清扫
repugnant /rɪˈpʌɡnənt/ adj. 令人厌恶的
defiant /dɪˈfaɪənt/ 公然违抗的
appeal n. v. 上诉, 吸引力

## Key Sentences
A federal judge has blocked a California law that would have banned carring guns in most public places.
The judge deemed the law unconstitutional.

He said the law "is sweeping, repugnant to the Second Amendment, and openly defiant of the Superme Court"

Good habits to avoid depression

点击喜马拉雅-Reading Record 百度网盘


## 2024-01-07

## Words
Susceptible 更容易的
compound 复合的
cortex 皮质
congnitive 认知
conincide vi. 重合,重叠,同时发生


## Key Sentences
Wouldn't you be curious to know about several healthy habits you could adopt right now to help lower your chances of suffering from depression?

A larger volume of the orbitofrontal cortex and the medial prefrontal cortext might improve cognitive control and emotion regulation.

Stay healthy during holidays

点击喜马拉雅-Reading Record 百度网盘


## 2024-01-09

## Words
dull 沉闷的
flavourless 无味的
hydration 水分
sluggish 疲倦
excess 过量的
decent 充足的,得体的


## Key Sentences
Water is dull, flavourless and just so unexciting.
But it is brilliant at keeping us hydrated, and you should be drinking eight 8-ounce glassses of it a day.

Without adequate hydration, we often feel hungry, sluggish, and tired.
This can cause us to miss workouts, snack on unhealthy food, and reach for excess caffeine.

Gym access may be difficult. Incorporate bodyweight movements such as squats, lunges, shoulder taps, and burpees, and take your fitness on the road with you.

US exhausts Ukraine military assistant founding

点击喜马拉雅-Reading Record 百度网盘


## 2024-01-13

## Words
artillery n. 炮,大炮
munition n. 弹药,军火 ammunition n. 弹药,军火. While "ammunition" specifically relates to the materials used for firing weapons, "munition" is a more comprehensive term that includes various military supplies and equipment beyond just ammunition.
reiterate vt. 重申
withhold vt. 决绝给, 保留
contingent n. 代表团,分遣队; adj. 依情况而定的


## Key Sentences
The US State department announced this year's final package of weapons and equipment to aid Ukraine.
This exhausts the existing founding still at the Biden adminstration's disposal.

Republicans on Capitol Hill are withholding their votes for new founds for Ukraine.
Their approval is contingent upon Democrats making compromises to meet the GOP's demand for stricter border control measures to deter incoming migrants.

English Reading 4

30th San Francisco APEC Meeting

百度网盘

## 2023-11-26

## Words
downtown [ˈdaʊntaʊn , ˌdaʊnˈtaʊn] n.市中心; adv.在市中心;  adj.闹市区的;  
emission [iˈmɪʃn] n.排放;   排放物;   发出;   射出;   散发物;  
bear [ber] n.熊;   (在证券市场等)卖空的人;  v.有(某个名称); 支撑; 承受; 显示; 忍受; 开(花); 携带;承担责任;  bear responsiblity
mobilize [ˈmoʊbəlaɪz] v.(战时)动员;   调动;   组织;   调用;   鼓动;  


## Key Sentences
The 30th Asia Pacific Economic Cooperation (APEC) Economic Leaders' Meeting kicked off on Thursday in San Francisco, the US.

We're reponsible for the largest share of emissions, so we must also bear responsiblity for the solutions while we still have time to change course.

This year, the world is on track to meet the climate finance pledge "that we made under the Paris Agreement of 100 billon US dollars collectively" Biden said.

The meeting is the highlight of the APEC leaders' week, held in San Francisco from Nov. 11 to 17.
Its theme was "Creating a Resilient and Sustainable Future for All."

It is Crucial to recruit fresh blood for US Agriculture

点击喜马拉雅-Reading Record 百度网盘

## 2023-11-28

## Words
Commissioner 专员
Rancher 农场主
Rear 饲养
cattle 牛
Lease 租赁: Typically apply to long-term commitment, and more formal than Rent; Rent 租用: Typically apply to short-term commitment
hectare 公顷


## Key Sentences
More than half of all farmers in the United States will retire in 10 years or so.
There may not be enough young people recruited into the industry to take over when this happens.

In 1935 the US had 6.8 million farms, but as of last year, there were just 2 million farms left, the department of agriculture said.

The techniques to improve focus

点击喜马拉雅-Reading Record


## 2023-11-29

## Words
Counterintuitive 不合常理的
thrive 专注
ambient 环境的
accustomed 习惯的
concentration 注意力集中的 - distraction - 注意力分神


## Key Sentences
Focus matters in  all aspects of life: work, relationships, day-to-day tasks and responsibilities.

Whether you're working, writing music, or simply diving into a good book, having the right surroundings for you is essential to keeping your focus in check.

The Pomodoro Technique trains individuals to concentrate on completing a specific task for short periods of time, typically 25 minutes.
This is followed by a mandatory break to ensure they return refreshed for the next 25-minutes focus session.

An incredible photo captured baby star screamed in space

点击喜马拉雅-Reading Record 百度网盘

## 2023-12-02

## Words
Scream 尖叫
Sprawl /SPR ɔː L/ vi. n 蔓延
Constellation /ˌkɑːnstəˈleɪʃn/ n 星座,一系列(相关的想法、事务、人)
lightsaber 光剑
infrared 红外线
goggles 护目镜
gravity 引力
accretion 堆积层
Asteroid 行星
comet 彗星

## Key Sentences
An incredible photo from space has captured the moment a baby start "Screamed" for the frist time.

A  young star ignites as dust and gas collapse under the force of gravity, before spinning and getting hotter.
The leftover material forms an accretion disc and under the right circumstances could evolve to form the base material for plannets, asteriods and comets.


Lack of activity brings bad impacts of your health

点击喜马拉雅-Reading Record 百度网盘

## 2023-12-10

## Words
silvere lining 一线希望
cardio 有氧的
endorphin 内肽芬
deprecate 不赞成,否定, self-deprecating 自我否定
euphoria n. 兴奋
vibrant adj. 有活力的,活泼的

## Key Sentences
Our brains have a higer risk of anxiety and depression.

Once these thoughts begin, they're tough to beat.
It becomes a cycle of putting ourseleves down, not having enough energy to work out, and then feeling worse aferward.

你怎样才行Whether you can

你怎样才行 最近在看了一些王立群先生的历史讲座,他总结了历史上能干出一番事业的人物的几个决定条件(四行)。

  • 你要行
  • 有人说你行
  • 说你行的人要行
  • 你的身体要行

王立群’s you can formula The four Criteria that determined whether you can

  • 1 You must can
  • 2 The People say you can
  • 3 The People who say you can must can
  • 4 Your health can

王立群's you can formula = 1 & 2 & 3 & 4

English Reading 3

Biden’s speech for UN general assembly

点击喜马拉雅-Reading Record 百度网盘

## 2023-10-06

## Words
bore vt. 令人厌烦,
hollow 空洞的
verbosity 冗长
linchpin n. 关键任务,关键事物
grapple v. 搏斗,扭打,努力设法解决 ; n. 格斗,紧握,抓机
resurgent adj. 复活的,复兴的
solidarity 团结
tarnish 使..变灰 抹黑
exert vt. 施加
commandeer vt. 强征,征用
genuine adj. 真正的,名副其实的,真诚的 gene 基因
perpetuating v. 使持续,使永久化 adj. 永久的,不灭的
perception n. 感知 看法
indifference n. 冷漠 漠不关心



## Key Sentences
Biden gave a disappointing speech that bore the stamp of hollow verbosity.

The topic served as the linchpin for reinforcing alliances with select partners.

Washington's genuine interest in assisting these nations remains questionable,
Perpetuating a perception of indifference when it comes to supporting the world's most vulnerable populations.


Stunning Image of the moon

点击喜马拉雅-Reading Record 百度网盘

## 2023-10-15

## Words
stunning adj. 惊人的
terrain 地形
hydrogen  氢气
oxygen 氧气
crater 坑
immerse vt. 沉浸在
rubble  瓦砾
asteroid 小行星
parachute n. 降落伞 v. 跳伞
spillage n. 溢出物
deflect v. 偏转
catastrophic adj. 灾难的


## Key Sentences
Stunning images from NASA show the Moon's south pole in incredible detail.

Experts at tehe space organisation were interested in the area around the Shackleton Cater because of the suspected ice deposits.

The ice deposit could serve as an important resouce for exploration because they are comprised of hydrogen and oxygen.

The Israel and Plestine War

百度网盘

## 2023-10-21

## Words
raging [ˈreɪdʒɪŋ] adjs. 严重的 v. 发怒
snatch [snætʃ] v. 抢夺 偷窃 n. 抢夺 偷窃
massacre [ˈmæsəkər] vt. n. 屠杀;   杀戮;  
grievance [ˈɡriːvəns] n. 冤屈;  委屈; 抱怨; 牢骚; 不平的事;
maim [ˈmeɪm] v. 使残废; 使受重伤;  
abduction [æbˈdʌkʃən] n. 绑架; 劫持; 诱拐; 外展; 外转; 
pound [paʊnd]   n.磅 v.捣碎; (心脏)狂跳; 怦怦地跳; 狂轰滥炸;
shell [ʃel] n.壳;(任何物体的)外壳, 壳体; 炮弹;    v.炮击;   给…去壳;  
hostage [ˈhɑːstɪdʒ] n.人质;
raid  [reɪd] n.突袭; 抢劫; vt.突袭; 突然搜查; 偷袭; 劫掠; 打劫; 突击搜捕;  
retaliatory [rɪˈtæliətɔːri] adj.报复性的;反击的;
infiltrated [ˈɪnfɪltreɪtɪd] v.渗透; 渗入; adj.渗透的;浸润的;
barrage [bəˈrɑːʒ] n.火力网;  堰; 水坝; 拦河坝;弹幕射击;   vt.以密集火力攻击(或阻击);
poised [pɔɪzd] adj. (暂时)平衡,稳固; 准备好;  v.保持(某种姿势); 使稳定; 抓紧; 
siren [ˈsaɪrənz] n. 警报器;   汽笛;   性感妖女; 妖冶而危险的女人; v.引诱;鸣笛行驶
blare [bler] v.发出(响亮而刺耳的声音);  

## Key Sentences

Amid bombings and bloodshed, innocent vistims raging accross Gaza and Israel contunue to suffer unimaginable horrors.

As the UN begged both sides to stop targeting civilians, fears were growing for thousands of people.

But any hopes of peace look a long way off as Israel contunues pounding Palestine and Hamas keeps up the shelling of its neighbour, resulting in a rising deatch toll.


Palestinian rocket barrages on Israel continued as sirens blared throughout Jerusalem and Tel Aviv.


To cease-fire the Israel and Palestine war

百度网盘

## 2023-10-24

## Words
spark [spɑːrk] n. 火花 v. 引发;   触发;   产生电火花;  
outrage [ˈaʊtreɪdʒ] n. 愤怒;   愤慨;   暴行;   义愤;  vt.使震怒;   激怒; 
resist  [rɪˈzɪst] v.抵抗;   抵制;   反抗;   阻挡;  n.防腐剂;   防染剂;  insist v.坚持
stance n.立场;   态度;  
constituency [kənˈstɪtʃuənsi] n.(选举议会议员的)选区;   (统称)支持者;   选区的选民;  
vow [vaʊ] n.誓言;    v.发誓;   立誓;   起誓;  

## Key Sentences
Rejecting truce demand sparks concerns over reelecction bid amid public outrage.

Biden has resisted calls for cease-fire, saying that Israel has a right to defend its citizens.

Some vowed not to support Biden's reelection as well as campaigns by other Democrats seeking office.

Leaning a language is a process

点击喜马拉雅-Reading Record 百度网盘

## 2023-10-30

## Words
calligraphy [kəˈlɪɡrəfi] 书法
fascinating [ˈfæsɪneɪtɪŋ] adj.迷人的; 极有吸引力的;  v.深深吸引; 迷住;  
redicule [ˈrɪdɪkjuːl] n.嘲笑;   奚落;   讥笑;  vt.嘲笑;   奚落;   讥笑; 


## Key Sentences
Start seeing lanuage as a process, not as a finish line.

As is the case with driving, your goal with a target language should be to try to make it a habit.

It will become more and more effortless with time and practice.

As for your native language, do you feel upset, ridiculed, frustrated, inferiorized or even angry when you come across a word you haven't seem before? Of course not!

And appreciate the fact that you are devoting your time to an art that makes centuries to develop.

English Reading 2

Basic grammars of English

点击喜马拉雅-Reading Record 百度网盘

## 2023-10-04

## Words
gerund 动名词
habitual 习惯性的
granted 当然的,不错,的确
punctuation 标点符号
nerve n. 神经 vt. 鼓起勇气
essay 散文


## Key Sentences

While punctuation may not be considered a traditional part of English grammar, one cannot have perfect grammar without it.

On the contrary, one of the main usages of the present simple tense is, in fact, to describe habitual actions and routines - something we've all probably learned in our very first English lessons.

The greate part of the world's troubles are due to questions of grammars -- Michel, the complete essay.
And he couldn't have been more right!

Polls revealed currently Trump is advance than Biden for 2024 Presidential Election

点击喜马拉雅-Reading Record 百度网盘

## 2023-10-03

## Words
contender 竞争者 contest 竞争
laysuites 诉讼


## Key Sentences
Multiple political polls indicate Donald Trump is seem as the top contender for the Republican predidential nonimation.

//---虚拟语气 Subjunctive mood, 如果怎么样(而非真实发生的),用过去时
If the election were to be held during the poll, 39% would vote for Trump and 36% would vote for Biden.

Befriend to timers to make you a well-orgnized person

点击喜马拉雅-Reading Record 百度网盘

## 2023-10-02

## Words
daunting 令人生畏的
knock out 清理
drawer 抽屉
momentum 动力
clutter 混乱 mental clutter 精神混乱
bask 享受
glory 荣耀 bask in the grory 享受荣耀
junk 杂物
linen 亚麻
feat n.壮举;技艺;功绩;武艺;英勇事迹 adj. 合适的;灵巧的;整洁的


## Key Sentences
Befriend your timer.
Another fantastic way to make cleaning and organizing to-dos less daunting is to set a timer.

When you successfully tackle one shelf, one surface, or a single drawer, you'll see yourself as someone well-organized.

Bask in the glory.

This was no small feat.

We are worth the time and effort it takes and we deserve a comfortable and well-maintained living space.

New phone release of HUAWEI attracted international attention

点击喜马拉雅-Reading Record 百度网盘

## 2023-10-01

## Words
longing  渴望,热望 Example: is longing for sth
snap up  抢购,一抢而光

## Key Sentences

It was quickly snapped up by fans in China and captured international attentions.

She is excited to see the improvement in the camera quality and is longing for more phone storage.

Although Apple has earned billons of dollars in China, Huawei has been banned in the US for years.

Stephen, an independent history filemaker, said it is not surprising that China is able to develop its own chips despite US sanctions, and China had to figure out a way.

A specific amount of exercise is needed for sedentary lifestyle

点击喜马拉雅-Reading Record 百度网盘

## 2023-09-30

## Words
sedentary  久坐
detrimental 损害
longevity 长寿
offset 抵消
vigorous 剧烈
stave off 避免
aerobic 有氧 areobic exercise 有氧运动
cardio 有氧运动
cohort n. 同伙,支持者

## Key Sentences

A sedentary lifestyle, lacking physical activity, is widely supported by scientific research as detrimental to our health.

Not only to our physical health but also to our mental well-being and even the overall longevity.

A specific amount of daily exercise is needed to offset the negative effects of sitting for 10 hours a day.

Salesforce Sales Cloud Forecasting

Data Model In Salesforce Sales Cloud

Data Model of Salesforce Forecast

Forecast vs. Pipeline

Pipeline is a comprehensive view of a rep’s open opportunities, no matter what stage they’re in. It includes everything from the newest prospect to that opportunity with a pen in hand, ready to sign.
Forecast is a subset of the pipeline and includes just those deals expected to close in a certain period, like this quarter, for example.

The supported Data Source Objects which Sales Cloud Forecasting is based on

  • Opportunity (API Name: Opportunity)
  • Opportunity Product (API Name: OpportunityLineItem)
  • Opportunity Split (API Name: OpportunityLineItemSplit)
  • Line Item Schedule (API Name: OpportunityLineItemSchedule)

Notes: The forecasting is centered on Opportunity (The source data the forecasting based on is either Opportunity or Opportunity related data ) , so creating a data culture is the critical important for a Company to successfully rolling out the Sales Cloud forecast.

Two types of hierarchy that Sales Cloud Forecasting supports to group

  • User role (role-based forecasts hierarchy is automatically generated based on your Role Hierarchy)
  • Territory (territory-based forecasts hierarchy is relied on the Enterprise Territory Models , need enable Enterprise Territory Management first ).

Notes: For role-based forecasts hierarchy, users must be in the role-based forecasts hierarchy within their respective roles and also a user in the role-based forecasts hierarchy must be selected to act as the forecast manager to be able to view subordinates’ forecasts.

Forecast categories

Notes: Based on forecast period (monthly or quarterly) and Opportunity Stage, Sales Cloud accumulates the forcasts data into Categories: Pipeline, Best Case, Commit, Closed, Omitted.

Forecast Category Opptunity Stage Probablity
Pipeline Prospecting 10%
Pipeline Qualification 10%
Pipeline Needs Analysis 20%
Pipeline Value Proposition 50%
Pipeline Id. Decision Makers 60%
Best Case Perception Analysis 70%
Best Case Proposal/Price Quote 75%
Commit Negotiation/Review 90%
Closed Closed Won 100%
Omitted Closed Lost 0%
  • Forecast Types
    • Object (to select the source data Object which the forecasts are based on )
    • Measure (Options: Amount, Quantity, the measure factor of the forecasts )
    • Date (Fields like CloseDate of Opportunity and Date of OpportunityLineItem, to determine the records that should included based on the Forecasts Date range)
    • Hierarchy (User role or Territory)
  • Enable Adjustments
    • Manager Adjustments
    • Owner Adjustments
  • Manage Forecast Rollups
    • Single category rollups - Show one forecast category per column (Closed, Commit, Best Case, and Pipeline)
    • Cumulative category rollups - Show multiple related forecast categories per column
  • Choose a Default Date Range
    • Forecast Period (Monthly or Quarterly)
    • Starting on
    • Extending for
  • Show Quotas (whether show quotas in the Forecasts page)

Forecasts Report

Notes: Following report is created from the Report type Forecasting Items with Historical Trending Salesforce provided.

Forecasting Type Forecast Category Start Date End Date Forecast Amount Amount Without Adjustments Amount Without Manager Adjustment
OpportunityRevenue Pipeline 2023/9/1 2023/9/30 $1,269,390 $1,269,390 $1,269,390

How to use Forecast Process for the Sales team

sequenceDiagram; SalesRep->>SalesManager: Identify and Create Opportunity in timely manner; SalesManager-->>SalesRep: Inspecting and Mornitoring pipeline; SalesManager->>CSuite: Adding judgment and commits; CSuite-->>SalesManager: Investigate trend and redirect resource;

User license Available in: Professional, Performance, and Developer Editions and in Enterprise and Unlimited Editions with the Sales Cloud. Users of these Salesforce Edition Orgs can use it without needing extra license.

睿睿背英语课文 - 你昨天回来的吗

背诵记录 Reciting record

点击此抖音-背诵记录

学习的问题点 The Problems

  • You are back from China.
    • 意思是:你从中国回来了。(开始错误理解为:你回中国了。)
  • Let’s buy some.
    • Let’s 是 Let us 的简写(意思是让我们),不是Let is.

Campaign Member Status Tracking

Data Model In Salesforce Sales Cloud

graph LR;     Lead-->|JoinAs|CampaignMember;     Contact-->|JoinAs|CampaignMember;     CampaignMember-->|Participate|Campaign;     Campaign-->|Influence|Opportunity;

What is Campaign Member Status

Leads and Contacts can be added as Campaign Members who will participate the Campaign. And in Salesforce there is a field ‘Status’ in CampaignMember Object to track the engagement of the Campaign, say the Campaign member status set to ‘Accepted’ or ‘Attended’ for a Webinar Campaign.

  • The default options of the Campaign Member Status are:
    • Sent
    • Received
    • Responsed
  • Salesforce provides the Campaign Member Statuses standard related list (can be dragged to the page layout if you want to use it. Important: Campaign Member Status options are determined by individual Campaign, not by the picklist values of the Status field. So we should always use the Campaign Member Statuses to maintain the Status Options.) to add or edit the Status options.

Why tracking Campaign Member Status

Campaign member status is one of most important business metrics to measure the engagment and performance of the Campaign, and is one important factor to evaluate the ROI (Return of Inverstment) of the Campaign. Salesforce provide the out-of-the-box Campaigns with Campaign Members report type to create the report to gain insight of the Campaign.

How to tracking Campaign Member Status

Salesforce can let the user to record the Campaign member status individually though User Interface or Manage Campaign Member Statuses in batch though import wizard. But these two ways are done by users in Salesforce Sales Cloud manually, which is not good for the Campaign with huge Campaign Members (for example Email Campaign with lots of senders). In that case, we can automate the tracking process though the integration with other Marketing Automation Platforms.

  • Adobe Marketo
    • Marketo out-of-the-box integration with Salesforce, and can use the Change Program Status flow step of Marketo Smart Campaign to update the Campaign Member Status in Salesforce Sales Cloud automatically.
  • Salesforce Pardot (Salesforce has renamed it to Account Engagement)
    • Pardot out-of-the-box integration with Salesforce, but need enable Enable Campaign Member Sync in Pardot.
  • Salesforce Marketing Cloud
    • Write SSJS in Marketing Cloud to push the records from Marketing Cloud to Salesforce Sales Cloud.

English Reading 1

22nd anniversary ceremony of the 911 attacks

点击喜马拉雅-Reading Record 百度网盘

## Words
poignant  惨痛
terrorist 恐怖分子 tourist 旅行者
rubble 碎石;瓦砾;碎砖
withhold 拒绝给

## Key Sentences

For firefighter and police, the losses on that sunny day in 2001 are particularly poignant.

Monday marked the 22nd anniversary of the 911 attacks.

That was a process that relied on leading-edge DNA sequencing techniques to test body fragments recovered in the rubble.

Once-in-a-lifetime opportunity to watch the comet

点击喜马拉雅-Reading Record 百度网盘

## 2023-09-16

## Words:
Comet 彗星
Dawn 黎明 the time of day when light first appears
Crescent 新月,新月形 a curved shap that is wide in the middle and pointed to each end
diameter 直径
exaggeration 夸张 言过其实
speculate 推测
meteor 流星

## Key Sentences:
According to astronomers, sky-watchers are getting a rare and exciting opportunity to see a comet with their naked eye. This opportunity is being hailed a `once-in-a-lifetime` experience.

This comet could be the source of annual Sigma-Hydrid meteor shower, which lights up skies every December.

Active Listensing is crutial

点击喜马拉雅-Reading Record 百度网盘

## 2023-09-08

## Words:
foster 促进

## Key Sentences:
Active listening can foster collaboration with coworkers and new approaches to explore.

Trump surrendered to the jail in high key

点击喜马拉雅-Reading Record 百度网盘

## 2023-09-06

## Words:
racketeering 敲诈勒索 诈骗
conspiracy  阴谋
spectacle 壮观的景象
indictment 起诉,公诉,腐败现象
mugshot 大头像,监狱头像
crony 密友 好友
conservative 保守的
scheming 密谋 诡计多端的
subvert 颠覆,暗中破坏
desperate 绝望的 不顾一切的
zealous 热情的,充满激情的

## Key Sentences

Previous, Trump was accused of racketeering and conspiracy amid of 2020 president election in the state of Georgia.

Trump is said to be seeking to maximise television ratings to his benefit, 
and coverage of the proceedings could be extended by speaking in front of cameras and reporters.

Turning surrenders in each of his four criminal cases into spectacles has been aimed to discredit the indictments.

Prosecutors accuse the ex-president

点击喜马拉雅-Reading Record 百度网盘

## 2023-09-05

## Words:

meddle 干涉
attorney 代理律师 at turn 指某某请的代理律师,lawyer一般指通用的律师
felony 重罪
incendiary 煽动性的
rally 集会 Trump held an incendiary rally 
jury 陪审团 grand jury
thwart 阻挠 妨碍 thwarting govement efforts to retrieve them
hoard  囤积 accusing him of hoarding classified documents

## Interesting sentences:

Trump held an incendiary rally and incited a mob of supporters to attack the capitol, 
temporarily delaying the process.

The case is part of an onging set of escalating legal troubles for the ex-president,
coming nearly two months after Trump pleaded not guilty to dozens of federal felony counts
accusing him of hoarding classified documents.

睿睿背唐诗

枫桥夜泊 - 张继

点击此抖音-背诵记录

枫桥夜泊 - 张继

月落乌啼霜满天,
江枫渔火对愁眠。
姑苏城外寒山寺,
夜半钟声到客船。   

  2023-09-05     

睿睿学习新概念英语第四十九课 - 在肉店

背诵记录 Reciting record

点击此抖音-背诵记录

新单词 New words

  • butcher 卖肉者
  • mince 肉馅
  • lamb 羔羊肉
  • husband 丈夫
  • steak 牛排
  • either 也(用于否定句); too 也 (用于肯定句)

学习点:短语

  • a pound of something (mince) 一磅的什么(肉馅)

学习的问题点 The Problems

  • 没有把握语境记忆,some 和 a 两个关键的数量词漏掉了

    What about some steak? 读成:What about steak? This is a nice piece. 读成 This is nice piece.

    原文的意思是 What about some steak? -> 来一些牛排吗? This is a nice piece. -> 这一块(牛排)很不错。 也就是原文较好的翻译是:来一些牛排吗?你看看这一块牛排就很不错的。some 和 a 两个数量词对原文非常重要,遗漏这两个词就不能准确传达原来的意思。

睿睿学习新概念英语第四十七课 - 一杯咖啡

背诵记录 Reciting record

点击此抖音-背诵记录

新单词 New words

  • Sugar 糖
  • biscuit 饼干

学习点:疑问句 Do you want / like

  • Do you want something (coffee, a cup, any sugar …) 想要什么东西(咖啡,一杯,一些糖)吗?

  • Do you like someting (biscuits) 想要什么东西(饼干)吗?这里like意思基本同want

学习的问题点 The Problems

  • Do you like biscuits?  背成了 Do you want a biscuit? like惯性思维读成want,因为意思没变问题不大,但复数的discuits搞成 a biscuit,就问题大了。因为最后接着有一句:Do you want one? 您要一块(饼干)吗?导致文字意思就矛盾混乱了。

睿睿学习新概念英语第四十五课 - 老板的信

背诵记录 Reciting record

点击此抖音-背诵记录

新单词 New words

  • minute 分钟
  • ask 请求,要求
  • handwriting 手写
  • terrible 糟糕的,可怕的

学习点:YES的用法 Usage of YES

  • The Boss: Can you come here a minute please, Bob? BOB: YES, sir? 这里的YES意思是“什么事”,是一种疑问的语气词,“YES, sir?” 意思是“先生,什么事?”

  • The Boss: Call she type this letter for me? Ask her please. BOB: YES, Sir. 这里的YES意思是“好的”,“YES, sir.” 意思是“好的,先生.”

  • PAMELA: Bob! BOB: YES? 这里的YES意思是“怎么啦”,是一种疑问的语气词,同第一种用法。

学习的问题点 The Problems

  • Can’t 基本读成了 Can, t的音没有发出来
  • 对话的语调与情绪没有很好表现出来

Subjunctive mood (虚拟语气)

Mood in English (英语的语气)

There are three kinds of mood in English:

  • Indicative mood (陈述语气)
  • Imperative mood(祈使语气)
  • Subjunctive mood(虚拟语气)

SFDC APIs

Salesforce提供的APIs

  • Rest API
  • Soup API
  • Bulk API
  • Metadata API

Salesforce为不同使用场景提供了一整套不同类型的API。 有了这些APIs相当于我们有了撬动地球的杠杆,可以任意撬动Salesforce这个地球。从数据管理到开发到发布都可以搞定。

APIs的授权方式

无论哪一种类型的API,都从不同侧面赋予我们与Salesforce交互的权限,使用前都需要授权。

包含常用的两种授权方式:

  1. Connected App, 使用Oauth2.0工业标准协议授权,安全可控。
  2. Soup login, 使用账号密码换取SessionId。

移动端开发使用的Rest API,包括Salesforce Mobile SDK在内,官方推荐采用Connected App。安全可控,跟Salesforce Mobile SDK集成衔接好,带刷新token机制。

Soup API, Bulk API, Metadata API,这几种一般使用于管理员或开发者,在管理和开发发布时用到。这几种API采用Soup login, 登录超时后要用账号密码再登录。

Rest API

Rest API特别适合移动端和web端使用,使用json进行数据交互,轻量便捷。 Salesforce Mobile SDK完全采用Rest API,并进行了适当封装。

Soup API

Soup API走的webservice,使用xml进行数据交互。适合java, .net这种后端语言开发数据管理工具。

值得一提的是,soup API提供了Salesforce用户密码管理的API,可以用来修改用户密码

Bulk API

Soup API的主要功能是提供数据管理,但适合小量数据管理。如果涉及大批量数据管理,推荐使用Bulk API.

开发时一般也不会直接调用Bulk API。Salesforce提供的工具DataLoader,背后调用的就是Bulk API,我们直接用DataLoader就是

MetaData API

MetaData API主要用于开发的功能或修改的功能的发布。 我们要打包发布,进行发布包管理,最好能熟悉MetaData API。以方便我们配置管理开发的Salesforce工程项目。

我们也一般不会直接调用MetaData API。 Salesforce提供的IDE或第三方开发工具,背后调用的就是MetaData API, 我们直接使用IDE或第三方开发工具会方便更多

javascript常见问题和编程规范

注:本文主要针对Weex开发中的javascript

使用ES5还是ES6?

答:ES6, 具体来讲我们尽量使用ES6的语法及特性。

1. 使用let和const分别定义变量和常量(能够使用const就用const,否则使用let),统一不再使用var。

//var是函数作用域(function scope),let 是块作用域(block scope).
//---猜猜下面这段代码输出什么?---
var x = 0;
function testFunc(isTrue) {
    if(isTrue) {
        var x = 1;
        return x;
    }
    return x;
}
testFunc(false);

2. 使用关键字class而非构造函数来定义类,class只是在写法上带来了许多便利(syntax sugar),本质上javascript的类机制没有变化,即javascript类还是prototype based。

//下面分别用ES5和ES6来实现类的继承

//----ES5----
function A(propertyA) {
   this.propertyA = propertyA;
}
A.prototype.getPropertyA = function() {
   return this.propertyA;
};
A.prototype.setPropertyA = function(pa) {
   this.propertyA = pa;
}

function B(propertyA, propertyB) {
    A.call(this, propertyA);
    this.propertyB = propertyB;
}
B.prototype.getPropertyB = function(){return this.propertyB;};
B.prototype = Object.create(A.prototype);
B.prototype.constructor = B;

//----ES6----
class A {
   constructor(propertyA) {
      this.propertyA = propertyA;
   }

   getPropertyA() {
      return this.propertyA;
   }
   setPropertyA(pa) {
      this.propertyA = pa;
   }
} 

class B extends A {
   constructor(propertyA, propertyB) {
      super(propertyA);
      this.propertyB = propertyB;
    }
    getPropertyB() {
       return this.propertyB;
    }
}

//使用上是一致的,结果页是一样的,但很显然ES6的写法要简单很多。
var b = new B('propertyA', 'propertyB');
console.log('B.propertyB = ', b.propertyB);
console.log("b.hasOwnProperty('propertyB')", b.hasOwnProperty('propertyB'));

console.log('B.propertyA = ', b.propertyA);
console.log("b.hasOwnProperty('propertyA')", b.hasOwnProperty('propertyA'));
console.log('B.pPrototypeA = ', b.pPrototypeA);
console.log("b.hasOwnProperty('pPrototypeA')", b.hasOwnProperty('pPrototypeA'));

console.log('Object.getPrototypeOf(b)  = ', (Object.getPrototypeOf(b) === B.prototype) );
console.log('b instanceof B = ',b instanceof B);
console.log('b instanceof A = ',b instanceof A);
b.setPropertyA('setA');
console.log('b.getPropertyA() = ',b.getPropertyA());
console.log("b.hasOwnProperty('getPropertyA')", b.hasOwnProperty('getPropertyA'));

3. 使用string template拼接字符串。

4. 使用箭头函数。

5. ES6的其他新语法和特性。

函数命名及变量命名规范

javascript中函数(function)有三种角色,分别为:

  1. 类构造函数
  2. 类的成员方法
  3. 一般的普通的函数

我们编程中出了类构造函数的命名使用大写开头,其他两种使用小写开头。 注:我们项目中插件的暴露函数是普通函数,应该小写开头。但考虑到我们现有的插件都使用了大写开头,所以我们还是继续使用大写开头命名插件函数。

函数和变量命名:

  • 使用驼峰法命名
  • 使用英文
  • 达意,可以适当长一点
  • 不能直接看出命名意思的,写好注释

javascript的异步编程规范

javascript是单线程的,为了不被执行时间长的任务卡死,javascript提供了几种异步编程的模式(也就把执行时间长的任务异步执行,执行完成后告知结果)。

1. 回调函数(callBack)

2. 注册事件(Event)

<!----下面这个网页演示了不使用异步等待,UI将会卡死---->
<html>
<body>
<a id="block" href="">Block for 5 seconds</a>
<button>This is a button</button>
<div id="statusMessage"></div>
<script>
  document.getElementById('block').addEventListener('click',onClick);
  function onClick(event) {
     event.preventDefault();
     setStatusMessage('Blocking...');
     // Call setTimeout(), so that browser has time to display
     // status message
     setTimeout(function () {
        sleep(5000);
        setStatusMessage('Done');
     }, 0);
   }
   function setStatusMessage(msg) {
      document.getElementById('statusMessage').textContent = msg;
   }
   function sleep(milliseconds) {
      let start = Date.now();
      while ((Date.now() - start) < milliseconds);
   }
</script>
</body>
</html>

//--- javascript异步编程:回调函数(callBack)例子----
setTimeout( () => {console.log("异步等待结束");}, 500);

//--- javascript异步编程:注册事件(Event)例子----
let req = new XMLHttpRequest();
req.open("GET", "https://exeutest.blob.core.chinacloudapi.cn/app/dtsversion.json");
req.onload = function(){
   if(req.status === 200) {
      console.log(`request success, result = ${req.response}`);
    }
   else {
      console.log(`Error : ${req.statusText}`);
   }
};
req.onerror = function(){
   console.log("request onerror networkError");
}
req.send();

javascript异步编程我们项目中实际使用最多的是回调函数,但回调函数有下面几个缺点:

  • 多个异步任务嵌套容易陷入回调地狱(callback hell),也即一层套一层的回调。
  • 回调函数状态不能保持,回调一次后再不能回调了。

ES6把异步编程的Promise纳入规范,解决了回调函数的几个缺点。Promise有下面几个特点:

  • 回调函数和注册事件的异步函数都可以改造成Promise。
  • Promise其实是回调函数的包装,Promise里的异步任务也只会执行一次。
  • Promise有三种状态:
    1. 未开始(pending)
    2. 已完成(fulfilled)
    3. 已拒绝(rejected)
  • Promise通过扁平的方式实现依次逐个执行异步任务,解决回调函数的回调地狱的问题。
  • Promise一旦完成,它的状态就保持不动,即:Promise是一个装异步任务执行结果的容器。

Promise的使用例子见,项目中的distanceUtil.js。 这个例子演示了回调函数和Promise的混用

import { YtQuerySQL } from "../plugins/DbPlugins"
import { YtGetUserInfo } from "../plugins/UserInfoPlugins"
export class YtDistanceUtil {
    constructor() {
        this.userId = undefined;
        this.profileId = undefined;
        this.orgId = undefined;
        this.distance = 150; //the ditance we want
        this.getDistance();
    }
    getDistance() {
        //console.log(`getDistance -> this.userId -> ${this.userId}`);
        YtGetUserInfo( (err, ret) => {
		    if(err === null || err === undefined) { 
			    //console.log(`get userid=${ret.userId} ; userName=${ret.userName} ; orgId=${ret.orgId}; profileId=${ret.profileId}`);
			    this.userId = ret.userId;
			    this.orgId = ret.orgId;
                this.profileId = ret.profileId;
                console.log(`getDistance -> this.userId -> ${this.userId}`);
            
                step1t2(this.userId)
                .then(result => {

                    if(result !== 0) {
                        console.log(`then0 -> result -> ${result}`);
                        //this.distance = result;
                        return result;
                    }
                    else {
                        console.log(`then0 -> this.then1`);
                        return step1t2(this.profileId);
                    }
                
                 } )
                 .then(result => {
                    //resultFinal = result;
                    if(result !== 0) {
                        console.log(`then1 -> result -> ${result}`);
                        //this.distance = result;
                        return result;
                    }
                    else {
                        console.log(`then1 -> this.then2`);
                        return step3(this.orgId);
                    }
                })
                .then(result => {
                    //resultFinal = result;
                    if(result !== 0) {
                        console.log(`then2 -> result -> ${result}`);
                        this.distance = result;
                        console.log(`then2 -> this.distance -> ${this.distance}`);
                    }
                    else {
                        console.log(`then2 -> 0 -> 150`);
                        this.distance = 150;
                    }

                });
		    }
	    });
    
    }
}

function step1t2(param) {

    return new Promise( (resolve, reject) => {
    
        console.log(`step1t2 -> param -> ${param}`);
        let opt={
            isUserDB:"1",
            tableName:"ONTAP__OnTapSettings__c",
            keyFiled:["ONTAP__checkindistance_threshold__c"],
            whereKey:["SetupOwnerId"],
            whereValue:[param]
        };
        YtQuerySQL(opt, function (ret) {
	    	ret = ret || {};
	    	if (ret.error) {
                console.log(`step1t2 -> ret.error -> ${ret.error}`);
                resolve(0);
            } 
            else {
                console.log(`step1t2 -> ret.success -> ${ret.success}`);
                if( (ret.success !== undefined) && (ret.success.length>0) )  {
                    let item= ret.success[0];
                    resolve(parseInt(item.ONTAP__checkindistance_threshold__c))
                }
                else {
                    resolve(0);
                }
            }
        }); 
    });
}

function step3(param) {

    return new Promise( (resolve, reject) => {

        console.log(`step3 -> param -> ${param}`);
        let opt={
            isUserDB:"1",
            tableName:"ONTAP__OnTapSettings__c",
            keyFiled:["ONTAP__checkindistance_threshold__c"],
            whereKey:["SetupOwnerId"],
            whereValue:[param]
        };
        YtQuerySQL(opt, function (ret) {
		    ret = ret || {};
		    if (ret.error) {
                resolve(0);
            } 
            else {
                if( (ret.success !== undefined) && (ret.success.length>0) ) {
                    let item= ret.success[0];
                    resolve(parseInt(item.ONTAP__checkindistance_threshold__c))
                }
                else {
                    resolve(150);
                }
            }
        }); 
    });
}

vue文件里面javascript逻辑代码编程规范

  1. vue文件里面的javascript代码应该力求简洁。
  2. vue对象的变量力求精简(越少越好,变量要写好注释), 没有初始值的统统赋undefined。
  3. 复杂的javascript尽量封装出去,不要全写在一个vue文件里面。
  4. 需要写成全局的javascript,请提交申请说明到开发组;否则写在子功能模块所在目录。

javascript数据类型

javascript有两类数据类型

  1. 基本数据类型(primitive), 包括:booleans, numbers, strings, null, and undefined.
  2. 类对象(objects), 除去基本数据类型其他的是objects

primitive和objects很大的不同在于比较的不同,primitive比较是用值来比较,而objects是用引用来比较。

enum的使用

javascript没有内建的enum数据类型,但可以使用第三方包Enumify

# --本地安装
npm install enumify

//--导入
import {Enum} from "enumify";
//--使用
class Color extends Enum {}
Color.initEnum(["RED", "GREEN", "BLUE"]);
let color = Color.GREEN;
if(color === Color.GREEN) {
    console.log(`color = ${this.color}  color等于Color.GREEN = ${this.color === Color.GREEN}`);
}

javascript的空数据类型

由于历史的原因,javasript有两种代表空的数据类型:

  1. undefined
  2. null

所以我们判断一个数据变量是否为空,我们统一使用下面这句话判断:

if (x === undefined || x === null) {
    //x为空
}

javascript的逻辑等于或逻辑不等于

javascript逻辑等于和逻辑不等于都有两种写法:

  1. == 或 ===
  2. != 或 !==

其中 == 和 != 为宽松等于和宽松不等于; 其中 === 和 !== 为严格等于和严格不等于。 为了统一我们都使用严格等于和严格不等于。 碰到忽略大小写的比较时,我们做如下处理:

//忽略大小写的比较
if(weex.config.env.platform.toLowerCase() === "ios") {
    //当前系统时iOS。。。
}

string的单引号还是双引号?

答:我们统一使用双引号。

javascript中有单引号和双引号括起来的string基本没有任何区别。 但鉴于json里面的key必须是双引号括起来的string,为了不出问题我们统一使用双引号。

再来谈谈this

ES6的箭头函数(arrow function)与javascript一般的函数(function)最大区别在于: 前者没有自带的this,而后者自带。

所以箭头函数作为类的构造函数,即不能new;而javascript一般的函数可以new。

我们说javascript一般的函数(function)都带一个this,但是this如果离开类对象基本没有用。 我们说一般的函数(function)有三种角色:1.构造函数;2.类的成员方法;3.一般的函数。

  1. 构造函数里的this指向自身
  2. 类的成员方法一般是由类对象调用的,this指向它所在的类对象
  3. 一般的函数基本不会用到this。因为它不是一个类,也不是一个类对象的成员方法,所以压根就不要用this。

vue特别声明某些生命周期钩子函数不能使用箭头函数

箭头函数的this来自于它所在的父作用域,一旦绑定就固化了. 而function的this有可能变化。这也是我们利用箭头函数的一个优点。见下面例子

//--- demo of using this---
let otherClient = {
    x: 100
};

function AModule(){
   this.x = 42;
   this.getX = function(){
   return this.x;
   },
   this.arrowFunc = () => this.x; 
}

let a = new AModule();
let unboundGetX = a.getX;
console.log('unbound getX x = ', unboundGetX());
console.log('normal invoking x = ', a.getX());
console.log('apply:a getX x = ', a.getX.apply(a));
console.log('apply:apply getX x = ', a.getX.apply(otherClient));

console.log('-------arrowFunc------------');
console.log('arrowFunc invoking x = ', a.arrowFunc());
console.log('arrowFunc:apply:a getX x = ', a.arrowFunc.apply(a));
console.log('arrowFunc:apply:otherClient getX x = ', a.arrowFunc.apply(otherClient));

//---- use apply to bind this, and callback can leverage 'this' to get some specific variables from the caller (following code demostrades the node.js sqlite3 library) 

const sqlite3 = require('sqlite3');
const Promise = require('bluebird');

class AppDAO {

    constructor(dbFilePath) {
        this.db = new sqlite3.Database(dbFilePath, (err) => {
            if(err) {
                console.log('ZJC could not connect to database');
            }
            else {
                console.log('ZJC Connected to database');
            }
        });
    }

    run(sql, params = []) {
        return new Promise((resolve, reject) => {
            this.db.run(sql, params, function(err) {
                if(err) {
                    console.log('ZJC Error running sql : ' + sql + ' Error :' + err );
                    reject(err);
                }
                else {
                    resolve({id: this.lastID});
                }
            })
        })
    }

}

import的路径

//导入vue文件,.vue后缀禁止省略。 
import titlec from "../../../tools/titlec.vue";

#如果导入时vue后缀省略了,weex打包/压缩打包命令将失败
weex compile -m src detinationFolder

//导入js文件,.js缀可以省略。如:
import { YtQuerySQL } from "../../plugins/DbPlugins";    

正则表达式的使用

正则表达式的作用

正则表达式用来在字符串中查找符合某种匹配模式的字符串,正则表达式被大多主流计算机语言支持。 本文使用javascript和Objective-C来说明使用正则表达式的两个例子。

使用正则表达式最关键的步骤是定义匹配模式的规则字符串,匹配模式分两种:

  1. 简单匹配模式
  2. 使用特殊字符构造复杂的匹配模式

简单匹配模式很容易,比如你要查找一个字符串中匹配到的”abc”,则匹配模式的规则字符串就使用abc。 但我们一般用得多的还是第二种匹配模式,即:使用特殊字符构造复杂的匹配模式。

案例一,查找字符串中包含的有效Email地址

分析:

Email地址的匹配规则应该是这样的: 这个字符串由一个’@’符号从中分割, ‘@’前半段由有效字符组成, ‘@’后半段由有效字符组成(但其中间要有一个’.’分割)。

/* 
结合使用特殊字符构造复杂的匹配模式。

'@'前半段的有效字符我们规定为:大小写字母,下划线,点号,加号的随机组合。
匹配模式的规则字符串为:
[a-zA-Z0-9_\-\.\+]+

其中[]包括起来的是允许的字符,因为 - . + 在正则表达式里都是特殊字符,必须带个\ ,说明不把这三者作为特色字符看待(即:作为普通字符)。
[]后面带的+号,是特殊字符,意思是前面的任意字符出现1次或以上。

根据以上分析,依次类推,得到整个匹配模式的规则字符串为:
[a-zA-Z0-9_\-\.\+]+@[a-zA-Z0-9_\-\.]+\.[A-Za-z]+
*/

//--- javascript ---

// 1. use the RegExp construtor of RegExp to create a instance. 
let  myReg = new RegExp("[a-zA-Z0-9_\\-\\.\\+]+@[a-zA-Z0-9_\\-\\.]+\\.[A-Za-z]+","g");
// 2. or you can use RegExp literal to create a instance.
myReg = /[a-zA-Z0-9_\-\.\+]+@[a-zA-Z0-9_\-\.]+\.[A-Za-z]+/g;
// find the match string array 
let matchArray = "dajk zhangjiachengwang@163.com afa 547357561@qq.com".match(myReg);
matchArray.forEach( item => {console.log(item)} );

//--- Objective-C ---
NSError *error = nil;
// String to search
NSString *str = @"dajk zhangjiachengwang@163.com afa 547357561@qq.com";
// Regular expression to parse email
NSString *regexAsString = @"[a-zA-Z0-9_\\-\\.\\+]+@[a-zA-Z0-9_\\-\\.]+\\.[A-Za-z]+";
// Create instance of NSRegularExpression
// which is a compiled regular expression pattern
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:regexAsString options:0 error:&error];
// If no errors
if (!error) {
    // Array of matches of regex in string
    NSArray *results = [regex matchesInString:str options:0 range:NSMakeRange(0, str.length)]; 
    // View results to see range and length of matches
    NSLog(@"results: %@", results);
    int count = 1;
    // For each item found...
    for (NSTextCheckingResult *entry in results) {
        // Get email from the str using range
        NSString *text = [str substringWithRange:entry.range];
        NSLog(@"Result %d: - %@", count++, text);
    }
}
else
    NSLog(@"Invalid epxression pattern: %@", error);

案例二,查找字符串中外面包裹着{}的字符串

分析:

外面包裹着{}的字符串的匹配规则应该是这样的: 这个字符串由一个’{‘开始,由一个’}’结束,中间包裹着的是非’{‘和’}’任意字符。

/* 
结合使用特殊字符构造复杂的匹配模式。

经分析得到匹配模式的规则字符串为:
\{[^{}]+\}

其中'{' '}'为特殊字符,需要带前缀'\'转义,
[^{}]+ 代表除'{'和'}'以外的任意字符的组合
*/

//--- javascript ---
let myReg1 = new RegExp("\\{[^{}]+\\}","g");
// or use follw literal create instance of RegExp
myReg1 = /\{[^{}]+\}/g;
let toMatchStr = "{localSearch:zhangjiacheng}xx{remoteSearch:xhu}"
let matchArray = toMatchStr.match(myReg);
matchArray.forEach( item => {console.log(item)} );

//--- Objective-C ---
//跟上例类似。

总结

如上所述,使用正则表达式最关键的步骤为使用特殊字符构造匹配模式的规则字符串。 详细教程见此 感叹:MDN真是一个伟大的网站

Salesforce Object间的几种关联关系

关联Salesforce Object间的几种关系

我们在给Salesforce Object建field的时候,用作Objects间关联关系的field有三种:

  1. Lookup Relationship
  2. Master-Detail Relationship
  3. External Lookup Relationship

但作为Salesfroce自带Object的Account对象,如果不是Personal Account。 (也就是Account有两种:一般的Acccount,和Peronal Account。其实就是我们平常理解的‘企业客户’和‘个人客户’。) 还有另外一种关系,及:父子关系。用作一个大公司下面可能有多个子公司的关联关系。 这个不在我们讨论范围内. 具体见

’Lookup Relationship‘和‘Master-Detail Relationship’用作Salesforce Objects间关系的,而‘External Lookup Relationship’用于与外部系统数据库表间的关系。

Lookup Relationship 与 Master-Detail Relationship 区别

Lookup Relationship 和 Master-Detail Relationship都是用作Salesforce Objects间的关联关系。在字段层面其实就是在建关联关系字段的那个Object上多出一个字段用来存放被关联Object的SalesforceID。 区别在于Lookup Relationship不是强制的,而Master-Detail Relationship关系是强制的。

Lookup Relationship: 比如一个‘Account’下面可能关联多个‘Contact’,我们一般用Lookup Relationship来处理他们间的关系,也即在‘Contact’上建一个Lookup Relationship字段关联‘Account’。但这个关联关系不是强制的,也就是说一个‘Contact’可以独立存在,他可以不关联任何‘Account’。在Salesfroce平台删除了一个‘Account’,与之关联的‘Contact’并不连带删除。

Master-Detail Relationship: 比如一个‘订单Object’关联多个‘订单明细Object’,我们一般用Master-Detail Relationship来处理他们间的关系,也即‘订单明细Object’上建一个Master-Detail Relationship字段关联‘订单Object’。但这个关联关系是强制的,也就是说一个‘订单明细Object’不可以独立存在,他必须关联一个‘订单Object’。在Salesfroce平台删除了一个‘订单Object’,与之关联的‘订单明细Object’也一并连带删除。

关于External Lookup Relationship

External Lookup Relationship,看名字就知道它是用于处理存放在Salesforce平台外的数据库表与Salesforce Objects间关联关系的。

比如:(注:下面说的‘BDR Salesforce系统’代表一个Salesforce系统,‘WCCS系统’代表一个第三方系统

我们当前’BDR Salesforce系统‘的有效售点来自’WCCS系统‘,这些存放在’WCCS系统‘上的售点有自己primary key(‘主键’)体系,而我们知道Salesforce中所有数据都有一个SalesforceID来唯一标示。如何处理两个系统间主键体系的不同,就是通过External Lookup Relationship。

在对应Salesforce的售点Object中建好一个External Lookup Relationship字段来对应’WCCS系统‘中的售点的主键。 ’WCCS系统‘中的售点第一次导入到’BDR Salesforce系统‘,填入’WCCS系统‘的主键。 下次’WCCS系统‘中该售点有更新要同步到Salesforce中,就拿这个External Lookup Relationship字段作为唯一标示来更新。

如何建立Many-to-Many Relationship

如上所述,在Salesforce Object间起关联关系的字段一般为Lookup Relationship和Master-Detail Relationship。但Lookup Relationship和Master-Detail Relationship都是One-to-Many的关系,比如一个Account下挂多个Contact,在一个订单下挂多个订单明细。

那如何建立Many-to-Many Relationship呢?那就是建起中间作用的Object。

比如: 做一个人事聘用系统,需要几个表:

  1. 代表职位的Object,’Position’.
  2. 代表职位发布网站的Object, ‘Employment Website’.

一个’Employment Website’可以发布多个’Position’,一个’Position’可以发布到多个’Employment Website’。 我们就在两者间建一个中间Object,’PositionWebsiteAssciation’.在’PositionWebsiteAssciation’分别建两个Master-Detail Relationship的字段分别关联到’Position’和’Employment Website’。 从而实现’Position’和’Employment Website’间Many-to-Many Relationship。

也就是说我们一般使用中间Object,利用Master-Detail来实现Many-to-Many。本质上说还使用的One-to-Many。

VSTS使用及CI/CD

VSTS代码管理

代码管理主要用git,熟悉git就行了。

VSTS的持续集成CI

VSTS上存放了我们的源代码,下一步就是编译这些源代码。 我们持续提交代码,VSTS自动编译源代码,就完成了持续集成。

编译Xcode工程的配置见此 编译Android工程的配置见此 self-hosted macOS配置

Steps to configue macOS agent:

  1. Download the compress file .tar and uncompress it in your somewhere of your disk;
  2. Drag and drop the config.sh in the root folder to MAC Terminal which uncompressed above to execute, and enter information needed to finish the configurations;
  3. Drag and drop the run.sh in the root folder to MAC Terminal which uncompressed above to execute, to run the agent.

VSTS的持续发布CD

有了持续集成,编译生成的安装包(iOS的ipa,Android的apk),就需要持续发布我们的安装包,这就是持续发布(CD)。

存储服务我们选择Azure。 发布(上传)文件到Azure,持续发布我们选择的task为“AzureBlob File Copy”。 完成AzureBlob File Copy,最重要的步骤是创建类型为“Azure Classic”的”Serveice connection“.

创建Serveice connection“的几个步骤为

  1. 浏览器打开下面链接,去登录。 https://portal.azure.cn/
  2. 浏览器另起一个tab,打开 https://portal.azure.cn/#blade/Microsoft_Azure_ClassicResources/PublishingProfileBlade
  3. 选择订阅
  4. 点击验证
  5. 下载发布设置
  6. 用文本编辑器打开从5步骤下载的证书,复制出证书的字符串,用这个去创建”Serveice connection“。

Weex 开发常见问题

安装Weex失败的问题:

一般归结为node.js版本的问题 可以安装下node.js的版本控制工具 https://github.com/creationix/nvm 这样的话,可以来回切换不同版本的node.js。

Weex压缩打包

# 1.可以直接对着整个目录src目录下面的所有前端文件打包
weex compile -m src destinationJSPath

# 2.打包整个src目录下面的文件耗时太长,也可以选择单个打(比如你只改了单个vue,可以就打包这个vue)
weex compile -m theVueYouWantCompile.vue destinationJS.js

Weex前端代码的调试

使用Chrome调试

建议开发的时候在js里面多写console.log(“XXXX日志XXX”) 在Xcode或Android Studio的输出终端中跟踪这些日志 方便查找问题

npm install 问题:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!! WARNING: You are on OS X 10.11 El Capitan or greater, you may need to add the !!!! WARNING: --unsafe-perm=true flag when running npm install

可以多加个flag:

npm install --unsafe-perm=true

weex插件开发

https://github.com/weexteam/weex-pack/blob/master/doc/plugin-devloping-weexpack.md https://www.darkhandz.com/2017/11/17/weex插件开发(iOS)/

http://weex.apache.org/guide/create-a-plugin.html *

npm install出现”Unexpected end of JSON input while parsing near”错误解决方法

见:https://blog.csdn.net/ITLionWoo/article/details/78632643

npm cache clean --force

Android - Error:(30, 0) Could not set unknown property ‘outputFileName’

Error:(30, 0) Could not set unknown property ‘outputFileName’ for object of type com.android.build.gradle.internal.api.ApplicationVariantImpl. Open File

解决方法:

这个时候需要在Android Studio中把app目录下的build.gradle文件中的variant.outputs.each { output -> def outputFile = output.outputFile if (outputFile != null && outputFile.name.equals(‘app-debug.apk’)) { def fileName = outputFile.name.replace(“app-debug.apk”, “weex-app.apk”) output.outputFile = new File(outputFile.parent, fileName) } }改成variant.outputs.all { output -> def outputFile = output.outputFile if (outputFile != null && outputFile.name.equals(‘app-debug.apk’)) { def fileName = outputFile.name.replace(“app-debug.apk”, “weex-app.apk”) outputFileName = fileName } }

Android Error:Execution failed for task ‘:app:javaPreCompileDebug’

Error:Execution failed for task ‘:app:javaPreCompileDebug’.Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.

  • weexplugin-processor-1.3.jar (com.taobao.android:weexplugin-processor:1.3) Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and will be removed in the future. See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.

解决方法:

在Android Studio的app目录下的build.gradle文件中,在defaultConfig下加入:

javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }

Android Navigator 推入页面不成功

解决方法:

  1. 修改AndroidManifest

  2. 修改原生代码 WXPageActivity

  3. build.gradle修改 targetSdkVersion:22

Weex工程创建,开发:

weex create awesome-app

cd awesome-app
npm install

npm install出现"Unexpected end of JSON input while parsing near"错误,解决方法:
npm cache clean --force

#开发:
The source code is located in src/ folder. You can develop it as normal Vue.js project.

#在浏览器上跑下看看
npm start   

weex platform add ios
weex platform add android

weex run ios
#直接跑不起来(或报错),解决方法:
cd ios 
pod install
open XXX.workspace

weex run android
#直接跑不起来,解决方法:
使用android studio打开android工程

拓展(component, modules, handlers)

Weex SDK provides only rendering capabilities, rather than have other capabilities. There are some internal components, modules and handlers. If you want these features which weexSDK doesn’t provide, you can to extend.

iOS拓展简单的教程: http://weex.apache.org/guide/extend-ios.html

android拓展简单的教程: http://weex.apache.org/guide/extend-android.html

我们要达到的目的是: iOS Android商量好,暴露给javascript相同的接口调用。

JS调用Native可以,使用封装Module来实现。 Native通知JS,则可以通过globalEvent来实现。

//globalEvent的使用,[具体说明见](http://weex.apache.org/references/modules/globalevent.html)
//--1,在原生里面发起通知,如IOS OC:使用WXSDKInstance的 - (void)fireGlobalEvent:(NSString *)eventName params:(NSDictionary *)params;
//在类WXDemoViewController中在viewDidLoad调用[self render]后:
[_instance fireGlobalEvent:@"zjcglobalEvent" params:@{@"key":@"zhangjiacheng"}];

//--2,在JS里面注册接收通知。
var globalEvent = weex.requireModule('globalEvent');
globalEvent.addEventListener("zjcglobalEvent", function (e) {
    console.log("get zjcglobalEvent");
    modal.toast({ message: "zjcglobalEvent value="+e.key});
});

页面间传参

//当我们用navigator push页面的时候想传递参数到下一个页面  
//有两种传递参数的方式
//1, 使用storage,这种方式很简单,也很粗暴。
//2, 使用url加问号的方式,比如:

//Page A -> Page B

//Page A 中:
navigator.push({
          url: bundleUrl +  "factorymanager/FMTabs.js?zjckey="+encodeURIComponent("张家成zhangjiacheng"),
          animated: "true"}, event => {} );

//Page B中(其中GetParamValue为我们定义的一个工具方法):
GetParamValue(weex.config.bundleUrl,"zjckey");

//其中工具方法GetParamValue:
export let  GetParamValue =  function(url, param) {
  param = param.replace(/[\[\]]/g, "\\$&");
  var regex = new RegExp("[?&]" + param + "(=([^&#]*)|&|#|$)"),
        results = regex.exec(url);
  if (!results) return null;
  if (!results[2]) return '';
  return decodeURIComponent(results[2].replace(/\+/g, " "));
}

weex使用字体图片的引用问题,解决见:

http://www.iconfont.cn/help/detail?spm=a313x.7781069.1998910419.15&helptype=code https://segmentfault.com/a/1190000011852209

VS code格式化VUE代码,快捷方式:

https://blog.csdn.net/tangletao/article/details/78799459

文章有个地方对不上 文件->首选项->设置
Code->首选项->设置

Vue

//-------- 环境 -----------

#Vue-cli安装
npm install -g vue-cli

#Vue工程创建 template有webpack,browserify等
vue init [template] [project-name]

# Enter the project rort folder
cd [project-name]

# Run install command
npm install

# Run the Vue app
npm run dev

## Weex插件的开发

  1. 网上有一些开源的插件供使用 http://natjs.com/#/README
  2. 自己开发可以参考开源的插件。写好原生代码部分后,前端部分写好JS调用的定义。

    //———– 开发 ———– http://192.168.1.209:7093/tree/weextraing.git/master/docs;jsessionid=1fi3ccugb5c5oji5kn5fqxlnc //—— 路由介绍文章 //https://scotch.io/tutorials/getting-started-with-vue-router

    //—— /* These are entry points where Vue can mount the configured routes. A route outlet is simply a component

    The important piece though is the tag. The router uses this tag as a container for rendering the different components tied to the different routes. Just think of it as a placeholder. */

    //—— instance of Vue /* Your app needs to instantiate Vue before anything can go on.

    The data function returns an object. Any property in the object can be bound to the view and also accessible via this. Other functions that are available in the Vue instance object like data can access the data properties using this. */

    //——- Vue && Component /* Since components are reusable Vue instances, they accept the same options as new Vue, such as data, computed, watch, methods, and lifecycle hooks. The only exceptions are a few root-specific options like el. */

    //——- Component /* It’s common for an app to be organized into a tree of nested components: for example, you might have components for a header, sidebar, and content area, each typically containing other components for navigation links, blog posts, etc.

    Passing Data to Child Components with Props */

## git .gitignore的使用

工程目录中不需要做版本控制的文件或目录全部声明在根目录下面的.gitignore中。 git官方解决办法 如果有文件已经被git跟踪,后面即使在.gitignore中声明不要再去跟踪,也不能立即起作用。 还需要手动跑句命令告知git不要再跟踪这些文件或目录。

  # 实践证明这样做有问题,导致其他成员代码不能用。

  # 不再跟踪某个文件
  git rm --cached 不要再跟踪的文件

  # 不再跟踪某个目录
  git rm --cached -r 不再跟踪的目录

iOS CocoaPods 找不到包,报连不上github问题:

见 https://stackoverflow.com/questions/38993527/cocoapods-failed-to-connect-to-github-to-update-the-cocoapods-specs-specs-repo

iOS_重新安装cocoapods:

gem install cocoapods -n /usr/local/bin

__(MAC系统)__ANDROID_HOME的配置:

vim  ~/.bash_profile

ANDROID_HOME="你SDK的目录地址,比如/Users/Android/sdk"
export ANDROID_HOME
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools

iOS_重置repository

pod repo remove master
pod setup

iOS Pod install报错:

Installing WeexSDK (0.18.0)

[!] Error installing WeexSDK [!] /usr/bin/git clone https://github.com/apache/incubator-weex.git /var/folders/3w/4d1zf5z52_nfds5hx23c2wg40000gn/T/d20180503-12392-7g4f5x –template= –single-branch –depth 1 –branch 0.18.0

Cloning into ‘/var/folders/3w/4d1zf5z52_nfds5hx23c2wg40000gn/T/d20180503-12392-7g4f5x’… error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed

解决办法: https://stackoverflow.com/questions/38618885/error-rpc-failed-curl-transfer-closed-with-outstanding-read-data-remaining

Wechat公众号重定向菜单配置

微信公众号开发架构

微信(Wechat) < == > 我们开发的服务( Provider ) < == > HTML5

微信公众号的本质是: 微信提供第三方服务网页的接入入口和呈现容器(定制的Webview)。

点击菜单,实现用户信息的获取及页面重定向

整个过程使用OAuth2.0授权协议实现。 具体实现步骤如下:

微信公众号菜单配置

通过自定义菜档创建接口,自定义菜单,菜单类型选择view。

view类型菜单有重要一点需要我们利用: 《 view:跳转URL用户点击view类型按钮后,微信客户端将会打开开发者在按钮中填写的网页URL,可与网页授权获取用户基本信息接口结合,获得用户基本信息。》

url参数如下:

https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect 若提示“该链接无法访问”,请检查参数是否填写错误,是否拥有scope参数对应的授权作用域权限。

参考链接(请在微信客户端中打开此链接体验):

scope为snsapi_base

https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx520c15f417810387&redirect_uri=https%3A%2F%2Fchong.qq.com%2Fphp%2Findex.php%3Fd%3D%26c%3DwxAdapter%26m%3DmobileDeal%26showwxpaytitle%3D1%26vb2ctag%3D4_2030_5_1194_60&response_type=code&scope=snsapi_base&state=123#wechat_redirect

scope为snsapi_userinfo https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf0e81c3bee622d60&redirect_uri=http%3A%2F%2Fnba.bluewebgame.com%2Foauth_response.php&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect

后台服务开发实现用户身份识别和网页重定向

定制号微信公众号菜单后,用户点击菜单,实现用户身份判断,及根据用户身份实现网页的重定向。实现步骤:

  • 第一步:用户同意授权,获取code 用户点击菜单后,微信会生成code,该code会传递到菜单url配置的重定向地址(也就是我们自己开发的服务地址)。

  • 第二步:通过code换取用户的openid
    我们开发的服务接收到code后跑一个接口获取用户的openid: https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code

  • 第三步:获取到用户的openid后,再在我们自己开发的服务中重定向到想要的页面。

Objective-C Thread & RunLoop解析

<1>多线程的硬件背景

In the early days of computing, the maximum amount of work per unit of time that a computer could perform was determined by the clock speed of the CPU. But as technology advanced and processor designs became more compact, heat and other physical constraints started to limit the maximum clock speeds of processors. And so, chip manufacturers looked for other ways to increase the total performance of their chips. The solution they settled on was increasing the number of processor cores on each chip. By increasing the number of cores, a single chip could execute more instructions per second without increasing the CPU speed or changing the chip size or thermal characteristics. The only problem was how to take advantage of the extra cores.

过去的处理器处理速度遇到了瓶颈,芯片设计者的应对这一瓶颈的做法是把处理器设计成多核的。相应的软件要跑得更快,更好地利用多核的处理器,就要采取相应的解决方案,这个方案就是--多线程编程。

<2>什么是线程

Threads are a relatively lightweight way to implement multiple paths of execution inside of an application. At the system level, programs run side by side, with the system doling out execution time to each program based on its needs and the needs of other programs. Inside each program, however, exists one or more threads of execution, which can be used to perform different tasks simultaneously or in a nearly simultaneous manner. The system itself actually manages these threads of execution, scheduling them to run on the available cores and preemptively interrupting them as needed to allow other threads to run. From a technical standpoint, a thread is a combination of the kernel-level and application-level data structures needed to manage the execution of code. The kernel-level structures coordinate the dispatching of events to the thread and the preemptive scheduling of the thread on one of the available cores. The application-level structures include the call stack for storing function calls and the structures the application needs to manage and manipulate the thread’s attributes and state.

多线程是应用内多执行路径的一个轻量级的实现。一个应用中可能存在一个或多个线程,它们可以同时或者基本同时执行各自的任务。系统管理着这些线程的执行,安排它们运行在可用的处理器核上,也可以适时终断它们以允许别的线程运行。

从技术的角度来看,线程就是管理代码执行的的一个处理器核层的数据结构和一个应用层的数据结构的组合。处理器核层的数据结构协调着分发事件给线程,安排线程到一个可用处理器片段上去执行。应用层的数据结构包括存放调用函数的调用堆栈和应用需要用来管理线程属性和状态的数据结构。

<3>关于Run Loops

Run loops are part of the fundamental infrastructure associated with threads. A run loop is an event processing loop that you use to schedule work and coordinate the receipt of incoming events. The purpose of a run loop is to keep your thread busy when there is work to do and put your thread to sleep when there is none.

Run Loops 是关联着线程的一个基本的基础设施。Run loop 是一个用来协调接受事件和安排工作的事件处理环。它的目的是用来在有工作时保持线程忙碌,无工作时使之休眠。

关于Run Loops 的几点:

  • Run loop 不是单独的,它是跟着线程来的,有了线程就有了它。但它不是必须要用到的。

  • iOS 的主线程的Run loop是自动开启的,而除此之外的第二线程都必须手动去开启它。

Objective-C Thread & RunLoop解析代码见此

<4>iOS多线程编程的选择

苹果的系统是基于Unix的,Objective-C又是C的超集,你可以自由选择POSIX的pthread相关API现在多线程编程,苹果的多线程技术应该也是由此而来的吧。

当然,Objective-C作为高级语言当然有它的封装实现,它提供了丰富的API让你去选择实现。

不管你去用以上哪种技术去实现多线程编程都不是那么简单。苹果提供了更好的,更简单的技术供你选择,那就是GCD 和 NSOperation