Total Pageviews

Thursday, 16 July 2026

民调背后的真相:外来文化正在内部颠覆美国


皮尤最新数据,不是偏见,是铁证。近半数美国穆斯林同情哈马斯,与美国主流价值观、国家外交立场、西方文明体系完全背道而驰。这已经不是“文化差异”,而是结构性的价值对立、立场对立、阵营对立

也正因此,德州共和党MAGA众议员布兰登·吉尔直言戳破真相,允许穆斯林移民,是美国最愚蠢的政策错误之一。

他的判断极其清醒,伊斯兰体系不止是宗教,更是一套完整的社会规则、司法体系、价值体系、政治体系

这套体系,与美国宪政逻辑、西方文明底色、世俗法治结构天然不兼容

很多人天真相信“移民融入”,现实是大规模外来族群,从来不是融入本土,而是替换本土。大规模移民带来的,不是融合,是替代、挤占、解构、反向重塑

谁在“利用美国反美国”?

国际主义势力、极端多元思潮、外来宗教激进力量。内部势力拆底线,外部势力拆结构,里应外合,利用美国的包容,埋葬美国的文明。

英国惨烈前车之鉴:人口结构决定文明命运

这方面的例子,可以举英国。

截至2025年,英国穆斯林人口突破400万,占总人口6%2011—2021十年增幅高达44%。更致命的数据是穆斯林贡献了英国同期总人口增长的33%

真正决定国运的,从来不是现有人口,而是新生儿结构。英国穆斯林5岁以下儿童占比10%;2023年穆斯林新生儿占比直接突破15.7%;部分城市学校穆斯林学生占比超50%,部分学校高达90%。

孩子,是一个国家二十年之后的主人,新生儿结构变了,文明底色必然彻底改变。

政治层面已经彻底翻盘,2024年英国11个城市市长选举,9位是穆斯林,囊括伦敦、伯明翰、利兹、牛津等核心城市

司法层面全面渗透,英国本土已有130余个伊斯兰教法法庭、50多个教法委员会。

社会福利层面彻底倒挂,78%穆斯林妇女不就业、63%穆斯林整体无正式工作;家庭平均6—8名子女,全面依托国家福利、住房补贴、教育福利生存

在民主制度下,人数就是权力,选票就是主权。英国已经陷入不可逆的文明替换,基本宣告无药可救。而美国,正在复刻一模一样的进程。

mySQL建立的数据库保存在哪里?

 

1、MySQL数据库的物理文件保存在硬盘上的数据目录中,2、可以通过配置文件(my.cnf或my.ini)查看和设置数据目录路径,3、每个数据库对应一个文件夹,包含表格文件和日志文件等数据,4、数据库备份可以通过导出SQL文件或者使用工具执行。 数据目录的默认路径因操作系统不同而异,例如在Linux系统中通常为/var/lib/mysql/,在Windows系统中通常为C:\ProgramData\MySQL\MySQL Server X.Y\data。举个例子,当你在Linux上安装MySQL并创建数据库时,可以看到数据库的物理文件保存在/var/lib/mysql/目录下,每个数据库对应一个子目录,其中包括表定义文件(.frm)、数据文件(.ibd,适用于InnoDB引擎)、以及其他运行文件和日志文件。通过这些文件,MySQL系统能够管理和恢复数据,为数据库提供健壮且可靠的存储解决方案。

一、MYSQL数据库数据目录和文件结构

MySQL数据库在硬盘上的存储是通过数据目录来管理的。这些目录和文件包含了数据库本身的结构和内容。数据目录的路径可以在MySQL配置文件(my.cnf或my.ini)中找到,通常带有datadir标识符。例如,在Linux系统中,这个配置项常常定义在/etc/my.cnf文件中,而在Windows系统中则通常定义在C:\ProgramData\MySQL\MySQL Server X.Y\my.ini文件中。

  1. MySQL数据目录:

    • 在Linux系统中,默认的数据目录路径通常为/var/lib/mysql/
    • 而在Windows系统中,默认路径通常为C:\ProgramData\MySQL\MySQL Server X.Y\data
  2. 数据库文件夹:

    • 每个数据库在数据目录中都有一个单独的文件夹。例如,如果创建了一个名为"mydatabase"的数据库,MySQL将在数据目录中创建一个对应的文件夹/var/lib/mysql/mydatabase/
    • 数据库文件夹中包含了表结构文件、数据文件、索引文件以及其他相关文件。
  3. 表文件:

    • 对于使用InnoDB存储引擎的表,每个表将生成一个或多个.ibd文件。其中存储了表格的数据和索引。
    • 而通过MyISAM引擎创建的表将产生.frm.MYD.MYI文件,其中.frm文件包含表的结构定义,.MYD文件存储了表的数据,.MYI文件存储了索引数据。
  4. 日志文件:

    • MySQL还生成多种日志文件用于记录数据库活动,包括错误日志、查询日志、事务日志和慢查询日志等等。
    • 这些文件可以在数据目录或者指定的日志目录中找到,通过它们,数据库管理员可以分析和审计数据库操作。

二、配置文件的作用和设置数据目录路径

MySQL的配置文件是数据库管理系统的重要组成部分,通过该文件,可以设置和查看数据库数据目录路径。MySQL配置文件有不同的版本,如my.cnf(适用于Linux和Unix系统)和my.ini(适用于Windows系统)。

  1. 定位配置文件:

    • 在Linux系统中,配置文件一般放置在/etc/my.cnf/etc/mysql/my.cnf路径下。
    • 在Windows系统中,配置文件通常放置在MySQL安装目录下的C:\ProgramData\MySQL\MySQL Server X.Y目录中。
  2. 查看与修改数据目录路径:

    • 打开配置文件,找到[mysqld]部分,该部分包含MySQL自身的各种设置。
    • [mysqld]部分下,可以找到形如datadir=/var/lib/mysql的行,这就是数据目录路径的配置项。在Windows上可能会配置为datadir="C:/ProgramData/MySQL/MySQL Server X.Y/data"
    • 可以将datadir路径修改为所需的目录,但在修改之前需确保目标目录存在并具备适当的权限。
  3. 保存更改并重启MySQL服务:

    • 修改配置文件后,需要保存更改并重启MySQL服务,以使新配置生效。
    • 在Linux系统中,可以通过命令systemctl restart mysqlservice mysql restart来重启服务。
    • 在Windows系统中,可以通过控制面板或命令行执行net stop mysqlnet start mysql命令来重启服务。

三、数据库备份和恢复策略

备份和恢复是数据库管理中至关重要的部分。MySQL提供多种备份和恢复的方法,以确保数据的安全性和可用性。

  1. 逻辑备份:

    • mysqldump工具:此工具通过生成包含数据库结构和内容的SQL语句文件来创建备份。命令如下:
      mysqldump -u username -p database_name > backup_file.sql

    • 使用这种方式备份的好处是文件可读,易于查看和编辑。然而,随着数据量的增加,备份和恢复的速度可能会降低。
  2. 物理备份:

    • 复制数据目录:直接复制数据目录及其所有子目录和文件。这种方式备份速度较快,尤其是大数据量时,但需要确保在备份期间停止MySQL服务,或使用锁表来保证数据一致性。
    • XtraBackup工具:Percona公司提供的备份工具,可以在线备份InnoDB表,支持增量备份和压缩,使用灵活且不影响数据库性能。
  3. 自动备份和备份计划:

    • 编写脚本并使用操作系统的计划任务功能(如Linux下的cron或Windows下的Task Scheduler)实现自动备份。例如,在Linux系统中创建一个backup.sh脚本,并添加到crontab中:
      crontab -e

      0 2 * * * /path/to/backup.sh

    • 这样每隔一天的凌晨2点将自动运行备份脚本。
  4. 恢复数据库:

    • 逻辑恢复:使用mysql命令导入备份的SQL文件:
      mysql -u username -p < backup_file.sql

    • 物理恢复:停止MySQL服务,删除现有数据目录,将备份的数据目录复制回原位置,然后重新启动MySQL服务。

四、数据库文件系统结构和管理

MySQL的数据目录和文件系统结构是数据库管理的基础。这些文件和目录间的关系较为复杂,但合理理解和管理它们对数据库管理员来说是至关重要的。

  1. 表空间和数据文件:

    • InnoDB存储引擎将数据存储在表空间中。默认情况下,InnoDB生成一个共享表空间文件ibdata1,但也可以配置为每个表使用独立的文件形式。
    • 表空间文件通常较大,因为它们包含了整个数据库的表和索引的数据。
  2. 字符集和排序规则文件:

    • MySQL支持多种字符集和排序规则,通过相关文件来管理这些设置。可以在配置文件中设置默认字符集和排序规则。
    • 可以在/usr/share/mysql/charsets/目录中找到这些字符集文件。
  3. 权限和安全文件:

    • MySQL的数据目录下还包含权限表和用户管理的信息,这些文件控制了数据库的访问权限。
    • mysql数据库内包含了用户表、权限表和其他控制信息,通过这些表可以控制用户的访问与操作权限。
  4. 日志文件管理:

    • MySQL生成的不同类型日志文件如错误日志、慢查询日志、事务日志等,都存储在数据目录或指定的日志目录下。合理管理这些日志文件对性能调优和问题排查非常关键。

五、提高数据库目录管理效率的技巧

数据目录和文件管理不仅仅是简单地查看和修改路径,数据库管理员还需要应用多种技巧来提高整体效率和安全性。

  1. 优化存储引擎:

    • 根据不同的需求选择合适的存储引擎(如InnoDB和MyISAM),优化存储效率和操作性能。InnoDB适合事务处理和高并发环境,而MyISAM适合只读查询多的场景。
  2. 分片和分区:

    • 分表和分区技术可以将大表拆分成小表,提高查询和索引效率。例如,分区表按时间、范围、哈希等规则分割数据,便于管理和访问。
  3. 数据压缩:

    • 通过MySQL支持的数据压缩特性,减少数据文件的大小,提高存储利用效率。
  4. 日志和文件轮转:

    • 设定日志文件轮转规则,避免日志文件过大影响性能。例如,配置my.cnf文件中的expire_logs_days参数,定期清理陈旧的日志文件。
  5. 监控和告警:

    • 通过数据库监控工具实时监控数据目录的使用情况和文件系统的健康状态,及时告警并采取行动。

以上是关于MySQL数据库在硬盘上如何保存及其管理的方法和技巧。合理运用这些知识,可以显著提高数据库的安全性和性能。

相关问答FAQs:

1. mySQL建立的数据库保存在哪里?

MySQL建立的数据库保存在服务器的文件系统中。MySQL数据库服务器将数据和表以文件的形式存储在特定的目录中。该目录通常称为数据目录,可以在MySQL的配置文件中进行设置。

2. 数据的物理存储位置是怎样的?

数据目录包含了数据库表的数据文件、索引文件、日志文件以及其他相关的系统文件。这些文件可以存储在任何存储设备上,通常是服务器的本地磁盘,也可以是网络存储设备或云存储服务。

数据文件的物理存储位置可以通过MySQL的配置文件中的datadir参数来指定。默认情况下,datadir参数将数据存储在操作系统的默认数据目录中,但可以通过修改配置文件来更改数据的存储位置。

3. 数据库文件的组织结构是怎样的?

数据目录中的文件按照MySQL的数据库和表的层次结构进行组织。每个数据库都会有一个单独的子目录,该目录下包含了该数据库中所有的表的数据文件、索引文件等。每个表对应于一个或多个文件,包括存储表数据的文件、存储表索引的文件以及存储表结构定义的文件。MySQL还会在数据目录下生成一些系统文件,用于记录数据库服务器的日志、临时文件等。

总而言之,MySQL数据库保存在服务器的文件系统中的特定目录中,这些文件包含了数据库表的数据文件、索引文件、日志文件等。数据库文件的物理存储位置可以通过MySQL的配置文件来指定,而数据库文件的组织结构按照数据库和表的层次结构进行组织。

 

Using Redis as a primary database

 

When we think of a structured databases, we think about rows, columns, tables, and the relationships between different tables. And we are correct about this. Most applications we use/develop use some sort of relational database, such as PostgreSQL, MySQL, and MariaDB. Then, we have applications that use NoSQL databases, like MongoDB.

Redis is popularly known for being used as a cache store alongside Relational Database Management System (RDBMS). As it is an in-memory data store, the read/write speed is higher than traditional RDBMS, which stores data on the disk. However, there are downsides to this database as well. For instance, there are memory limitations as all the data is stored in memory (or RAM), and a large amount of RAM can significantly increase the cost of the server on the cloud.

Using Redis as a Cache

Image credit: backendless.com

Redis can be viewed as an intermediate data store or cache that temporarily stores frequently requested data from the database so that database operations are reduced. When the data is not present in the cache, it is retrieved from the persistent database and cached to Redis for further retrieval.

Redis as a Primary database

When we think of using Redis as a primary database, we need to figure out how to store all of our application’s data on Redis, i.e., user data, login credentials, relationships, indexes, etc. Redis has grown from simply storing key-value pairs to storing multiple data structures like Sets, Bitmaps, Hyperloglogs, and others.

Database design of Shortomega

As key-value stores like Redis don’t have rows, columns, tables, or relationships, I need to devise a solution.

Let’s start with a simple data — user’s email and password:

Each user has a unique email and corresponding password to log in. We typically store the hashed value of the password using a hashing algorithm like SHA-1 or SHA-256 to protect the plain password from attackers.

We can store email ID with the corresponding user ID by adding the prefix “email” to the key:

email:<userid> -> <email address>

        
        
      

And the hashed password using:

password:<password> -> password

        
        
      

However, there are some issues with this approach. Whenever we need to add new attributes to the same user, we must add a new hash with a new prefix every time. This will significantly increase the memory space needed to store each user's attributes. Moreover, we usually need to set and retrieve email and password together and for that, we have to perform 2 database operations.

Redis has a built-in structure called hashes which is a collection of field-value pairs. We use the HSET command to add fields to the hash. HSET syntax looks something like this:

HSET key field value [field value ...]

        
        
      

Now we have only one hash for each user data and can store data in this way:

HSET user:<userid> email mail@test.com password <hashed-password> [...other fields and value]

        
        
      

We can easily retrieve all fields using HGETALL command:

Now that we have successfully stored user data efficiently, I will explain how I am building a URL shortener application — Shortomega using Redis as the primary database. I am storing the user login credentials similarly as explained before.

To store short URLs and their corresponding long URL, I am simply storing them in key-value pairs to query them in O(1) time.

short:<short-url> -> <long-url>

        
        
      

In order to associate a short URL to a user, I created a set of short URLs for each user as shown below so that I can retrieve all the created short URLs in a single Redis query.

user:<userid>:urls -> [set]

        
        
      

Challenges

Using sets to store short URLs created by a particular user, I need to perform additional N queries to retrieve corresponding long URLs. This is similar to the N+1 query problem in databases. To address this, I needed to choose between these 2 options:

  1. Store the long URL along with the short URL for a particular user. This will result in redundancy. Managing and updating the URLs at the two places would be cumbersome.

  2. Another option is to write a custom Lua script that runs on the Redis instance and returns the pairs of short and corresponding long URLs. This solves the N+1 query problem and gives the result in a single query. I chose to use this method. The script looks something like this:

local urls = redis.call('SMEMBERS', KEYS[1])
local result = {}
for i, url in ipairs(urls) do
    local longUrl = redis.call('GET', 'short:'..url)
    if longUrl then
        table.insert(result, url)
        table.insert(result, longUrl)
    end
end
return result

        
        
      

In the above Lua script, I am fetching all the short URLs based on the user ID passed from the NestJS backend. By looping over each URL, I get the corresponding long URL that is simply stored in a key-value pair. Lastly, I insert the pair in a table which I return to the back-end for further processing.

To benchmark the performance of retrieving the data in a single database query, I ran a Python script where I first stored and retrieved the data using N+1 queries and I executed Lua script on the Redis instance to retrieve the data in one single query. I plotted the graph as shown below:

In the above plot diagram, we can see the execution time difference between N+1 queries and the Lua script. A user with around 5000 URLs can fetch all the URLs in under 50 ms instead of 300 ms.

Analytics

Analytics include counting of total and unique visitors for each short URLs. This helps the user to track the engagements of created short links across different regions.

The count of total visits can easily be stored in a key-value pair. The value is incremented each time someone clicks on the link. But what about unique visitors? I can store unique IP addresses of visitors in a set and then count the elements in the set to get the unique visitors. However, it will take O(N*M) space in the database to store all the N IP addresses of M links, consuming the memory of the server. As mentioned before, increasing the RAM of a server instance on the cloud is more expensive than adding more disk space. It turns out that there is one special built-in data structure in Redis that can solve this problem. I am talking about HyperLogLog.

HyperLogLog is a probabilistic data structure that estimates the cardinality of a set. Basically, it estimates the number of unique elements in a set without the need for actual storage of elements in a set. It uses up to 12 KB of memory irrespective of count of elements in the set and provides a standard error of 0.81%.

We can add and count elements using following syntax:

PFADD key [element [element ...]]
PFCOUNT key [key ...]

        
        
      

I can now add the IP addresses to the HyperLogLog and count the unique IP addresses.

PFADD short:<hash>:ips [IP addresses ...]
PFCOUNT short:<hash>:ips

        
        
      

Lastly

There are endless possibilities of how we can use Redis as a cache and even as a primary database. The fast operations and in-memory operations of Redis make it an ideal choice for high-performance and real-time applications.

The URL shortener application — Shortomega is work in progress and I will add further development and details here or in another blog.

Enjoy Building!

from  https://tech.ninadnaik.me/using-redis-as-a-primary-database

基于java的密码管理器程序PassVault

 A Password Manager built using Java Swing and SQLite。

Setup

  • Download the zip file from the releases page.
  • Unzip it and run the jar file.

For developer setup, check out CONTRIBUTING.md.

  from https://github.com/ninadnaik10/PassVault

----------

 

Developer Setup

Softwares needed:

  • Apache Netbeans
  • Java Runtime Environment
  • SQLite Studio

Additional Files needed:

Steps:

  • Fork this repository
  • Clone the forked repository or download the zip file.
  • Open the project file in Netbeans and add the jar files in project properties -> libraries -> classpath
  • Open the userid.db in SQLite Studio

来自 https://github.com/ninadnaik10/passvault/blob/main/CONTRIBUTING.md

compressor.io,在线压缩图片

 We are required to send assignments online but at times the images are bigger than the permitted size. To compress and reduce the size of the images, there is a great tool called compressor.io. You can almost compress images to 90% of the original size, bulk upload and download them as a single zip file.

 https://compressor.io

supercook.com

 Ever wondered what to cook for breakfast/lunch/dinner? Supercook is there to help you. It suggests recipes based on ingredients you have. It shows step-to-step procedure along with the ingredients you don't have for your desired recipe. You can type the ingredients, speak to the mic or choose from a dozen of categories。

 https://www.supercook.com/#/recipes

canva.com

 Canva is an amazing tool to design posts, logos, videos and presentations for social media. There are tons of templates and variety of posts sizes for Instagram and YouTube. Adobe Spark open_in_new is similar to Canva. Another useful tool is Canva Color Wheel open_in_new . It displays color and its complementary color with hex codes. Other combinations are monochromatic, analogous, triadic and tetradic. 

 https://www.canva.com/