Finalx's Space


  • 首页

  • 关于

  • 标签

  • 分类

  • 归档

  • 日程表

C++ typename的起源与用法

发表于 2020-07-21 | 分类于 Programing , C++ |

侯捷在Effective C++的中文版译序中提到:

C++的难学,还在于它提供了四种不同(但相辅相成)的程序设计思维模式:procedural-based, object-based, object-oriented, generics

对于较少使用最后一种泛型编程的我来说,程序设计基本上停留在前三种思维模式当中。虽说不得窥见高深又现代的泛型技术,但前三种思维模式已几乎满足我所遇到的所有需求,因此一直未曾深入去了解泛型编程。

阅读全文 »

Secure Tomcat Hosting: Restrict Access to Your Web Application

发表于 2019-08-28 |

Is it possible to have too much security while running your own app? Nowadays, applications are a common target of potential attacks and vulnerabilities. As a result, having the ability to restrict access to your application is critical for your business.

In this article we will guide how to protect your application running on a Tomcat server in Jelastic. We recommend two possible solutions on how to restrict access to your application (you can choose one of them or use both):

阅读全文 »

CPP中多线程与Singleton的那些事儿

发表于 2019-08-14 | 分类于 Programing , C++ |

前言

前段时间在网上看到了个的面试题,大概意思是如何在不使用锁和C++11的情况下,用C++实现线程安全的Singleton。

看到这个题目后,第一个想法就是用Scott Meyer在《Effective C++》中提到的,在static成员函数中构造local static变量的方法来实现,但是经过一番查找、思考,才明白这种实现在某些情况下是有问题的。本文主要将从最基本的单线程中的Singleton开始,慢慢讲述多线程与Singleton的那些事。

阅读全文 »

Aomono-yokocho

发表于 2019-08-09 | 分类于 MISC |

        
1
npm install --save hexo-tag-aplayer

当析构函数遇到多线程──C++ 中线程安全的对象回调

发表于 2019-04-20 | 分类于 Programing |

by: 陈硕 (giantchen_AT_gmail) https://blog.csdn.net/Solstice/article/details/5238671


摘要

编写线程安全的类不是难事,用同步原语保护内部状态即可。但是对象的生与死不能由对象自身拥有的互斥器来保护。如何保证即将析构对象 x 的时候,不会有另一个线程正在调用 x 的成员函数?或者说,如何保证在执行 x 的成员函数期间,对象 x 不会在另一个线程被析构?如何避免这种竞态条件是 C++ 多线程编程面临的基本问题,可以借助 boost 的 shared_ptr 和 weak_ptr 完美解决。这也是实现线程安全的 Observer 模式的必备技术。

阅读全文 »

vsftpd匿名服务器

发表于 2019-01-10 |
  • 匿名用户就是ftp,想要匿名用户写入,必须文件夹的权限为ftp可写。
  • 匿名用户的根目录不允许写,所以根目录的权限绝对不能是ftp可写和其他用户可写,如果根目录所有者为ftp的话,所有者的权限也不能写。

所以解决方法是建个单独的public文件夹用于上传文件,设置其为ftp可写或”其他用户可写“

还可建个download文件夹只用于下载,设置其他用户没有写权限便可。

阅读全文 »

GDB on android

发表于 2019-01-04 | 分类于 Programing , C++ |

GNU 项目调试程序 (GDB) 是常用的 Unix 调试程序。本页详细介绍了如何使用 gdb 调试 Android 应用和进程(面向平台开发者)。对于第三方应用开发,请参阅调试您的应用

阅读全文 »

Android中开启DM-VERITY

发表于 2018-09-17 | 分类于 Android , Security |

概述

Android 4.4 及更高版本支持通过可选的 device-mapper-verity (dm-verity) 内核功能进行的验证启动,以便对块设备进行透明的完整性检查。

验证启动要求在使用前以加密形式验证要启动的 Android 版本包含的所有可执行代码和数据,其中包括内核(从 boot 分区加载)、设备树(从 dtbo 分区加载)、system 分区和 vendor 分区等。

阅读全文 »

Rename By Metadata of Photos/Videos Files

发表于 2018-07-18 | 分类于 Programing , Python |

Prepare

windows

  • pip install certifi
  • 下载 mediainfo dll: https://mediaarea.net/en/MediaInfo/Download/Windows
    (required by pymediainfo)

linux

apt install mediainfo

windows && linux

1
2
pip{3} install exifread
pip{3} install pymediainfo
阅读全文 »

Illegal instruction... g++ && clang++

发表于 2018-06-06 | 分类于 Programing , C++ |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0  |pateo@17:39:08 /tmp>$ clang++-3.9 -Wall  /tmp/pthread.cc -lpthread
/tmp/pthread.cc:20:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
1 warning generated.
0 |pateo@17:39:11 /tmp>$ ./a.out
here #9
Illegal instruction (core dumped)
132|pateo@17:39:13 /tmp>$ g++ -Wall /tmp/pthread.cc -lpthread
/tmp/pthread.cc: In function ‘int startCloudThread()’:
/tmp/pthread.cc:20:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
0 |pateo@17:39:23 /tmp>$ ./a.out
here #9

CODE

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
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>

void *testThread(void *arg) {
printf("here #%d\n", __LINE__);
return NULL;
}

int startCloudThread() {
pthread_t aa;
if (pthread_create(&aa, NULL, testThread, NULL)) {
printf("pthread_create (%s)", strerror(errno));
return -1;
}
pthread_join(aa, NULL);
}

int main() {
startCloudThread();

return 0;
}

12
finalx

finalx

18 日志
8 分类
23 标签
© 2020 finalx
主题 — NexT.Gemini v5.1.4