本文最初发表在今天已经死掉的点点博客。
我的第一个移动读书设备是黑莓8310。在那小小的屏幕上我读完了厚厚的一本《代码大全》。
后来买了吹的牛哄哄的号称读PDF多好多好的歌美S6000。屁,操作之慢让我忍不住想起我那只扔在一边的N73手机,阅读时间短不说,电量指示还超不准。读着读着,不定啥时候突然就没电了。
扔一边了,真可惜了8个G的容量。
然后就买了kindle3。刷了多看系统,这次看PDF真的爽了。更爽的是待机时间,充一次电能看两个礼拜。老早就听说这玩意屏不结实,所以入手大半年来,一直小心着小心着,生怕它那脆弱的小屏坏掉。然而,前几天悲剧还是发生了:要和儿子出去玩,我把kindle装包里,包跨在我胳膊上。我为了帮他找鞋子就趴在地上往沙发底下瞧,鞋子是找到了,可起身才发现包在我膝盖底下。啊呀呀,叫也没用,kindle3屏幕果然坏掉。在等待换屏的日子里,顺理成章儿子的iPAD成了暂时的替代。
原来iPAD也是看书利器。虽然最初沉甸甸地,好象有点受不了。可连着带了几天之后发现竟然有些适应了。反应敏捷,操控一流,彩色,大屏,十几小时的阅读时间,除了一点点反光让人稍微不爽,在习惯了iPAD的重量之后,我竟然有些爱不释手了。
要不要就此让那个kindle3成为往事?嗯,这事儿我看行。
2011/06/20
我想为我的 One Day Telegram 频道找一个合适在头像, 东搜西搜, 发现了这样一句格言:
One day or day one. It is your decision. 或者说 One day or day one. You decide.
这里 One day 指将来某天,暗示一种不确定的等待或者拖延。有一天我会做,等条件成熟了我就做。而 day one 指采取行动的第一天,意味着立即开始,不再等待。
选择权在你,是明日复明日,还是择日不如撞日,今天就开始行动。
愿大家都成为“今天就开始行动”一族。
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT false
RUN apk add --no-cache icu-libs tzdata
Reference
By the way, my devops colleague told me if you can, changing the windows time zone id with its standard equivalent is the more preferred way. He said "its not good to set that environment variable to false"
When working with Postman to automate API testing, you might encounter scenarios where you want to conditionally skip the execution of subsequent requests in a collection. This can be useful if a certain condition isn't met in your API responses. Here's a guide on how to achieve this using Postman's scripting capabilities.
Scenario
Imagine you have a collection where the first request returns a response like this:
{
"content": "True",
"statusCode": 200,
"message": "Global value got from DbConfig!"
}
You want to skip all subsequent requests if the content
field is "False"
.
Step-by-Step Guide
-
Set Up Your Collection: Ensure your collection is organized with the request you want to evaluate placed at the beginning.
-
Write a Post-Request Script: In the test script section of the first request, you'll write a script to check the content
field and decide whether to continue the collection run.
// Parse the response
let response = pm.response.json();
// Check the content value
if (response.content === "False") {
pm.execution.setNextRequest(null); // Skip the remaining requests
}
This script checks if the content
is "False"
. If it is, pm.setNextRequest(null)
stops all subsequent requests from running.
-
Test the Flow: Run your collection to see the logic in action. If the condition is met (i.e., content
is "False"
), the collection run will halt after the first request.
Explanation
pm.response.json()
: This method parses the JSON response from your request.
pm.setNextRequest(null)
: This function is used to stop further requests in the collection run. If the condition isn't met, the collection continues with all remaining requests in their original order.
Benefits
- Efficiency: Avoid unnecessary API calls when certain conditions aren’t met, saving time and resources.
- Control: Gain greater control over your testing workflows by dynamically determining execution paths.
Conclusion
Using pm.execution.setNextRequest(null)
in a test script provides a straightforward way to control the flow of your Postman collection runs based on specific conditions in your API responses. This technique can be a powerful tool in optimizing your automated testing processes.
Feel free to customize the logic to fit your specific needs!
一个朋友说 Gemini最近的进步已经挺大了,于是我就试验了一下。
我问Gemini:你能否用简洁的汉语详细解释一下import { ref, onMounted, watch } from 'vue'
这一语句import的这三个对象?它们是什么,做什么用,好的实践是什么?
Gemini的回答令我非常满意,因此我把它发表在这里。它的回答是:
好的,我来详细解释一下这段代码中导入的三个对象:
import { ref, onMounted, watch } from 'vue'
解释:
-
import:
- 这是 JavaScript 中的导入语句,用于从其他模块(这里就是 Vue.js)中引入需要的功能。
- 想象一下,你在搭建积木,
import
就相当于你从积木盒里拿出特定的积木块。
-
ref, onMounted, watch:
-
这些都是 Vue.js 提供的三个核心功能:
-
ref:
- 作用: 创建一个响应式的引用。
- 比喻: 想象一个盒子,你把一个数据放进去,这个盒子就变成了一个
ref
。当盒子里面的数据发生变化时,Vue 会自动追踪到,并触发相应的更新。
- 使用场景: 用于创建响应式的基本数据,比如一个计数器、一个输入框的值等。
-
onMounted:
- 作用: 在组件挂载到 DOM 后执行一次回调函数。
- 比喻: 就像一个新房子建好了,你就可以搬进去开始装修了。
onMounted
就是在你搬进去之后执行的第一个动作,比如打开窗户通风。
- 使用场景: 用于执行一些初始化操作,比如获取数据、设置定时器等。
-
watch:
- 作用: 监听一个值的改变,并在值改变时执行回调函数。
- 比喻: 就像你设置了一个监控摄像头,一旦监控到有物体移动,就会触发报警。
watch
就是这个监控摄像头,它会持续监控一个值,一旦值发生变化,就会执行你设定的操作。
- 使用场景: 用于实现一些复杂的逻辑,比如根据数据的变化动态更新视图、进行表单验证等。
总结:
ref
用于创建响应式数据。
onMounted
用于在组件挂载后执行初始化操作。
watch
用于监听数据的变化并执行相应的操作。
好的实践:
- 合理使用 ref: 不要过度使用
ref
,只对需要响应式的数据进行包裹。
- 在 onMounted 中进行异步操作: 将获取数据、设置定时器等异步操作放在
onMounted
中,确保组件已经挂载到 DOM 中。
- watch 的使用场景:
watch
更适合监听复杂逻辑或需要深度比较的情况。对于简单的计算属性,可以使用 computed
。
示例:
import { ref, onMounted, watch } from 'vue'
const count = ref(0)
onMounted(() => {
// 在组件挂载后获取数据
fetch('/api/data')
.then(response => response.json())
.then(data => {
// 更新数据
count.value = data.count
})
})
watch(count, (newValue, oldValue) => {
console.log('count has changed:', newValue, oldValue)
})
更深入的学习:
如果你想更深入地了解这些概念,可以参考 Vue.js 的官方文档。
希望这个解释能帮助你更好地理解这三个对象的作用和用法。如果你还有其他问题,欢迎随时提出。
我觉得AI非常善于把概念性的事情用简洁准确的方式说清楚,在这一点上,真可以说它的智慧出于人类而胜于人类了。