推荐阅读

可以避免一些日常生活中的小陷阱,更加理智的消费
花钱的时候多考虑一下机会成本(具体到某件物品上,否则用处不大)

相对性判断,心理账户,付款之痛(预付款然后享受,快乐程度较高),锚定效应,损失厌恶,禀赋效应,惩罚不公平(雨天卖伞要比晴天贵)
语言和形式的魔力(让我们觉得价有所值),手工制品的价格更高(因为更花功夫,实际上质量未必有机械加工的好)
对一样东西了解的越少越容易依赖锚点(越容易受到锚定效应的干扰)

20220122_143205.png

注释中的 TODO 事项不显示在任务列表中

// TODO whatever

请转到工具->选项->文本编辑器-> C / C ++->格式->其他,然后将枚举注释任务设置为True。

# 如果没有下面的路径就创建一个
/var/spool/cron/crontabs
mkdir -p /var/spool/cron/crontabs

# 编辑任务,默认是 vi 编辑器
crontab -e

# 每隔 1 分钟调用一次脚本
*/1 * * * * /bin/sh /usr/app/monitorApp.sh
阅读全文 »

vue全家桶都有什么

全家桶,对于开发一个完整的中大型单页面应用项目所必须的插件和框架

vue-cli

vue-cli也叫脚手架,官方定义为Vue.js 开发的标准工具

// vue3.0
npm install -g @vue/cli

vueRouter

Vue Router 是 Vue.js 官方的路由管理器。它和 Vue.js 的核心深度集成,让构建单页面应用变得易如反掌
包含的功能有:

阅读全文 »

使用 vs2022 add new item-Resources File,默认是 string
然后可以通过 vs 提供的工具添加 文件,图片等

// 默认读出来的是  byte[] 
string cnf_prefix = System.Text.Encoding.ASCII.GetString(Resource1.server, 0, Resource1.server.Length);


/// <summary>
/// 释放resx里面的普通类型文件
/// </summary>
/// <param name="resource">resx里面的资源</param>
/// <param name="path">释放到的路径</param>
private void ExtractNormalFileInResx(byte[] resource, String path)
{
FileStream file = new FileStream(path, FileMode.Create);
file.Write(resource, 0, resource.Length);
file.Flush();
file.Close();
}

/// <summary>
/// 释放resx文件里面的音频资源文件
/// </summary>
/// <param name="fileInResx">在resx里面的音频文件</param>
/// <param name="path">释放到的路径</param>
private void ExtractAudioFileInResx(Stream fileInResx, String path)
{
Stream input = fileInResx;
FileStream output = new FileStream(path, FileMode.Create);
byte[] data = new byte[1024];
int lengthEachRead;
while ((lengthEachRead = input.Read(data, 0, data.Length)) > 0)
{
output.Write(data, 0, lengthEachRead);
}
output.Flush();
output.Close();
}

/// <summary>
/// 释放resx里的图片资源文件
/// </summary>
/// <param name="image">resx里的图片资源</param>
/// <param name="path">释放到的路径</param>
private void ExtractImageFileInResx(Bitmap image, String path)
{
MemoryStream memoryStream = new MemoryStream();
image.Save(memoryStream, image.RawFormat);
byte[] data = memoryStream.ToArray();
FileStream file = new FileStream(path, FileMode.Create);
file.Write(data, 0, data.Length);
file.Flush();
file.Close();
}

2021年过去了,今天是最后一天,在这个时间作总结和展望还是挺合适的。

非常不幸,国内疫情又起来了,五一,十一两大节日很难保证没事,老婆孩子今年又不能来了。连续两年了哈,这病毒真是害人不浅呀。
今年6月末的时候换了工作,回到了之前呆过的公司,工资少了,时间多了。之所以换工作是因为目前的公司周日已经安排工作了,自己的学习时间不足了。
碰巧之前公司的人找我回去,为了双休和早八晚五我就过去了。

下半年我把大部分精力都放在了股票上,虽然做的也不是很理想,但是在向着好的方向发展。还需要不断地学习和训练自己。
需要更多的实战经验。需要有自己的交易系统。

2021年总结两个字 “萌芽”

2022年的任务很简单:

  1. 健身
  2. 发展股票事业 (今年理想目标200w)
  3. 年终总结的时候能够向一个朋友证明我在投资方面的能力
  4. 作为后半生的养老事业,我给自己三年的时间来成长。如果2025年初,我还不能通过股票来赚钱的话,那只能说明我不适合吃这碗饭,还要另谋他法。

code_len = len(codes)
cpus = os.cpu_count()
per_thread_cnt = int(code_len / cpus)
code_len = len(codes)
cpus = os.cpu_count()
if cpus is None:
cpus = 8
futures = []
with concurrent.futures.ProcessPoolExecutor(max_workers=cpus) as executor:
for i in range(0, cpus):
stop = per_thread_cnt * (i + 1)
if i == cpus - 1:
stop = code_len
code_list = codes[per_thread_cnt * i:stop]
futures.append(executor.submit(screen_stock_work,json_param, code_list))

for future in concurrent.futures.as_completed(futures):
try:
data = future.result()
for it in data:
nngPair.send(bytes(json.dumps({'CmdType': CMD_SCREEN_LIST_RESULT, 'Param': it}), encoding='utf-16')[2:])
except Exception as exc:
print('generated an exception: %s' % ( exc))

msg = {'CmdType': CMD_SCREEN_DONE, 'Param': f'{code_len}'}
nngPair.send(bytes(json.dumps(msg), encoding='utf-16')[2:])
flag &= (~FLAG_SCREEN_LIST_START)
阅读全文 »

定时不准

在配置菜单中有个 高精度定时器 把该选项选中

timer

void timer_Handler(union sigval v)
{
LOG_INFO<<"timer_Handler enter...";
}

int init_timer(timer_t *timerid, struct sigevent *evp, struct itimerspec *it)
{
if ( !evp || !it )
return -1;

memset(evp, 0, sizeof(struct sigevent)); //清零初始化

evp->sigev_value.sival_int = 111; //也是标识定时器的,这和timerid有什么区别?回调函数可以获得
evp->sigev_notify = SIGEV_THREAD; //线程通知的方式,派驻新线程
evp->sigev_notify_function = timer_Handler; //线程函数地址
// evp.sigev_value.sival_ptr = this; //这里传一个参数进去,在timer的callback回调函数里面可以获得它

if (timer_create(CLOCK_REALTIME, evp, timerid) == -1)
{
perror("fail to timer_create");
return -1;;
}

printf("timer_create timerid = %d\n", (int)*timerid);
it->it_interval.tv_sec = 0; // 后续按照该时间间隔
it->it_interval.tv_nsec = 14*1000000; //14ms

it->it_value.tv_sec = 0; // 最初开始时间间隔
it->it_value.tv_nsec = 14*1000000; //14ms

return 0;
}

int start_timer(timer_t *timerid, struct itimerspec *it)
{
if (it == NULL){
return -1;
}
if (timer_settime(*timerid, 0, it, NULL) == -1)
{
perror("fail to timer_settime");
return -1;
}

return 0;
}


timer_t timerid = 0;
struct sigevent evp;
struct itimerspec it;
//memset(&evp, 0x00, sizeof(struct sigevent));
//memset(&it, 0x00, sizeof(struct itimerspec));

int ret = init_timer(&timerid, &evp, &it);
if (ret < 0){
printf("init_timer failed\n");

}
ret = start_timer(&timerid, &it);
if (ret < 0){
printf("start_timer failed\n");

}else
{
printf("start timer ok\n");
}