RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-198374

mocart's questions

Martin Hope
mocart
Asked: 2022-06-10 09:19:27 +0000 UTC

从单击按钮的父项的部分标题获取文本

  • 0

有 2 个部分有 2 个按钮,当您单击每个部分时,您需要将其写入一个变量,以便按钮 1 从部分 1 中获取标题,依此类推。

<section>
<h1 class="sect__title">Заголовок раздела1</h1>
<p>
<ol>
<li>Элемент 1</li>
<li>Элемент 2</li>
<li>Элемент 3</li>
</ol>
<b>Стоимость <span class="price" id="price1">1000</span>руб.</b><br>
<div class="col-md-12 text-center">tests
<button id="button1" type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">Перейти</button>
</div>
</p>
</section>
<section>
    <h1 class="sect__title">Заголовок раздела2</h1>
    <p>
    <ol>
        <li>Элемент 4</li>
        <li>Элемент 5</li>
        <li>Элемент 6</li>
    </ol>
    <b>Стоимость <span class="price" id="price2">2000</span>руб.</b><br>
    <div class="col-md-12 text-center">tests
        <button id="button2" type="button" class="btn btn-primary" data-bs-toggle="modal"   data-bs-target="#exampleModal">Перейти</button>
    </div>
    </p>
</section>

我试图这样做,但它对我不起作用:

var exampleModal = document.getElementById('exampleModal')
exampleModal.addEventListener('show.bs.modal', function (event) {

var button = event.relatedTarget
var test = $(button).closest('.sect__title').text()
console.log(test)

并且还尝试了这个:

var test = $(button).parents().find('h1').text();
console.log(test)
javascript
  • 1 个回答
  • 10 Views
Martin Hope
mocart
Asked: 2020-09-21 06:22:55 +0000 UTC

Apache Web 服务器设置

  • 2

必须由 resize.php 脚本处理所有对http://myserver.ru/image/x/y形式的 Apache 的请求,其中 x 和 y 是任意整数,并且地址中的第一个数字得到进入脚本作为 GET 参数 width ,第二个作为 height 。为此需要在 Apache 中进行哪些配置?谢谢!

apache
  • 1 个回答
  • 10 Views
Martin Hope
mocart
Asked: 2020-12-16 15:49:29 +0000 UTC

复制文件,跳过未修改的文件(linux)

  • -1

有一个文件夹包含文件dir2的副本(很多文件),还有一个文件夹包含这些文件的原件dir1。有时会更改位于dir1文件夹中的文件,这些文件会显示在文件属性中(例如:更改于 12/16/2016 16:40)。有时,会制作从dir1到dir2的所有文件的副本,这需要很长时间。如何编写一个 bash 脚本来检查dir1中的原始文件是否已更改并在dir2中覆盖它并跳过未更改的文件?真的可以通过通常的cp实现吗?我没有在其中找到跳过键,以防找到相同的“BY DATE OF CHANGE”文件。谢谢你。

bash
  • 2 个回答
  • 10 Views
Martin Hope
mocart
Asked: 2020-11-07 12:35:09 +0000 UTC

仅开放对特定 iptables 资源的访问

  • 0

有一个可以上网的网关(192.168.0.1 eth1),有一个可以上网的网络192.168.0.0/24

#Разрешаем всем доступ в Интернет
sudo iptables -v -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE

在某个时间(14:00)我阻止所有人访问互联网,除了某些用户:

#очищаем все правила iptables
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -t nat -F POSTROUTING
#разрешаем 10-11-12 
sudo iptables -v -t nat -A POSTROUTING -s 192.168.0.10/32 -j MASQUERADE
sudo iptables -v -t nat -A POSTROUTING -s 192.168.0.11/32 -j MASQUERADE
sudo iptables -v -t nat -A POSTROUTING -s 192.168.0.12/32 -j MASQUERADE

在上面定义的地址 192.168.0 处。在 10/11/12 等日,整个 Internet 正常,其余被阻止的都没有。如何只打开对特定资源 ( rambler.ru ) 的访问,其他用户的 Internet 被阻止?试图这样做:

iptables -A OUTPUT -d rambler.ru  -j ACCEPT
iptables -A INPUT -d rambler.ru  -j ACCEPT
iptables -A FORWARD -d rambler.ru  -j ACCEPT

iptables -L -n -v 的输出:

Chain INPUT (policy ACCEPT 19 packets, 1675 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            81.19.82.8
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            81.19.82.9
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            81.19.82.10
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            81.19.82.11

Chain FORWARD (policy ACCEPT 220 packets, 121K bytes)
 pkts bytes target     prot opt in     out     source               destination
    9   512 ACCEPT     all  --  *      *       192.168.0.0/24       10.0.0.0/8
    6   246 ACCEPT     all  --  *      *       10.0.0.0/8           192.168.0.0/24
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            81.19.82.9
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            81.19.82.10
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            81.19.82.11
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            81.19.82.8

Chain OUTPUT (policy ACCEPT 18 packets, 2340 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            81.19.82.8
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            81.19.82.9
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            81.19.82.10
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            81.19.82.11

iptables -nvL -t nat 的输出:

root@gate:~# iptables -nvL -t nat
Chain PREROUTING (policy ACCEPT 1706 packets, 197K bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain INPUT (policy ACCEPT 211 packets, 20402 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 180 packets, 10525 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain POSTROUTING (policy ACCEPT 589 packets, 39909 bytes)
 pkts bytes target     prot opt in     out     source               destination
    8   416 MASQUERADE  all  --  *      *       192.168.0.11        0.0.0.0/0
    0     0 MASQUERADE  all  --  *      *       192.168.0.12         0.0.0.0/0
    6   312 MASQUERADE  all  --  *      *       192.168.0.13         0.0.0.0/0

但是,被阻止的客户端无权访问此资源。

iptables
  • 1 个回答
  • 10 Views
Martin Hope
mocart
Asked: 2020-10-13 08:21:39 +0000 UTC

只保留小数中的整数

  • 5

有来自温度传感器的数据(arduino + ds18b20 + dallas temp library),

float temp = 26.23;

只需要将整数部分写入变量,即26,我可以输出它:Serial.println (temp,0);但我不能将它写入变量。

arduino
  • 4 个回答
  • 10 Views
Martin Hope
mocart
Asked: 2020-09-27 17:05:18 +0000 UTC

解压带子目录的提取物

  • 1

当尝试使用unzip在 ubuntu 中提取 zip 文件时,每个文件都用一个子目录(一堆文件)单独提取:

sudo unzip arch.zip -d /var/www/test

ls /var/www/gs/

drwxr-xr-x  2 root root 4096 дек.  28  2015 protected\views\rent
drwxr-xr-x  2 root root 4096 дек.  28  2015 protected\views\security
drwxr-xr-x  2 root root 4096 дек.  28  2015 protected\views\site
drwxr-xr-x  2 root root 4096 дек.  28  2015 protected\views\smev
drwxr-xr-x  2 root root 4096 дек.  28  2015 protected\views\source
drwxr-xr-x  2 root root 4096 дек.  28  2015 protected\views\statement
drwxr-xr-x  2 root root 4096 дек.  28  2015 protected\views\stock
drwxr-xr-x  2 root root 4096 дек.  28  2015 protected\views\vehicle
drwxr-xr-x  2 root root 4096 дек.  28  2015 protected\views\xmlparsing
drwxr-xr-x  7 root root 4096 сент. 27 18:01 public
drwxr-xr-x  2 root root 4096 дек.  28  2015 public\css
drwxr-xr-x  2 root root 4096 дек.  28  2015 public\css\images
drwxr-xr-x  2 root root 4096 дек.  28  2015 public\fonts
drwxr-xr-x  2 root root 4096 дек.  28  2015 public\img
drwxr-xr-x  2 root root 4096 дек.  28  2015 public\img\_temp

但是必须要有公共保护的文件夹等等,怎么办呢?存档的结构是正常的。

ubuntu
  • 1 个回答
  • 10 Views
Martin Hope
mocart
Asked: 2020-09-22 13:53:43 +0000 UTC

在 Ubuntu 服务器上通过 psql 运行脚本

  • 1

有一个包含一百万个条目的大脚本,script123.sql它通过 winscp 从 Windows 机器上传到运行postgresql 9.4的Ubuntu 14.04服务器。当从 Windows 机器(它是 PGAdmin III 的一部分)启动 psql 时,当尝试通过命令加载脚本时,会显示有关缺少文件的错误:,无论是在指定相对路径还是直接路径时:\i script123.sqlscript123.sql No such file or directory

\i /home/user/script123.sql
/home/user/script123.sql No such file or directory

\i ../script123.sql
/home/user/script123.sql No such file or directory

我应该在哪里复制这个脚本,以便它可以从 psql (windows) 运行?在 Windows 上,只需将脚本复制到: C:\Program Files\PostgreSQL\9.4\data 。尝试“通过类比”复制到/var/lib/postgresql/9.4/main和/etc/postgresql/9.4/main/ - 没有帮助......

postgresql
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5