RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

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

mymedia's questions

Martin Hope
mymedia
Asked: 2022-06-01 23:59:45 +0000 UTC

克隆整个 GitLab 存储库组

  • 0

有一大群来自实体微服务的 GitLab 存储库,它们的母亲。我需要将它们全部下载到我的本地计算机。我想在没有过度紧张的情况下做到这一点。请提出一些解决方案。

gitlab
  • 1 个回答
  • 10 Views
Martin Hope
mymedia
Asked: 2020-08-15 18:34:40 +0000 UTC

安全擦除失败后恢复磁盘

  • 0

今天,我想在重新使用之前简单地擦除外部硬盘驱动器中的所有数据。我想使用高级安全擦除 ATA 来提高可靠性。这就是这个选项在 GUI 中的调用方式。但不幸的是,刚开始这个操作,它就以错误结束,磁盘不再可读。重新连接没有帮助。看来他是被这件事激怒了。😞

mymedia@barberry:~$ sudo fdisk -l /dev/sdb
fdisk: невозможно открыть /dev/sdb: Ошибка ввода/вывода
mymedia@barberry:~$ dmesg 
[186055.457700] usb 1-2: new high-speed USB device number 12 using xhci_hcd
[186055.606620] usb 1-2: New USB device found, idVendor=152d, idProduct=2329, bcdDevice= 1.00
[186055.606629] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=5
[186055.606634] usb 1-2: Product: USB to ATA/ATAPI bridge
[186055.606639] usb 1-2: Manufacturer: JMicron
[186055.606643] usb 1-2: SerialNumber: 17810DA14
[186055.608815] usb-storage 1-2:1.0: USB Mass Storage device detected
[186055.609126] usb-storage 1-2:1.0: Quirks match for vid 152d pid 2329: 8020
[186055.609256] scsi host2: usb-storage 1-2:1.0
[186056.653925] scsi 2:0:0:0: Direct-Access     TOSHIBA  MQ01ABF050       AM00 PQ: 0 ANSI: 2 CCS
[186056.655022] sd 2:0:0:0: Attached scsi generic sg2 type 0
[186056.656467] sd 2:0:0:0: [sdb] 976773168 512-byte logical blocks: (500 GB/466 GiB)
[186056.656827] sd 2:0:0:0: [sdb] Write Protect is off
[186056.656834] sd 2:0:0:0: [sdb] Mode Sense: 28 00 00 00
[186056.657170] sd 2:0:0:0: [sdb] No Caching mode page found
[186056.657181] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[186056.679800] scsi_io_completion_action: 4 callbacks suppressed
[186056.679818] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[186056.679832] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[186056.679842] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[186056.679854] sd 2:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[186056.679859] print_req_error: 4 callbacks suppressed
[186056.679868] blk_update_request: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[186056.679880] buffer_io_error: 3 callbacks suppressed
[186056.679885] Buffer I/O error on dev sdb, logical block 0, async page read
[186056.680552] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[186056.680566] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[186056.680577] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[186056.680588] sd 2:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[186056.680597] blk_update_request: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[186056.680611] Buffer I/O error on dev sdb, logical block 0, async page read
[186056.681272] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[186056.681282] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[186056.681293] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[186056.681303] sd 2:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[186056.681313] blk_update_request: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[186056.681324] Buffer I/O error on dev sdb, logical block 0, async page read
[186056.681355] ldm_validate_partition_table(): Disk read failed.
[186056.682434] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[186056.682446] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[186056.682457] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[186056.682467] sd 2:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[186056.682477] blk_update_request: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[186056.682488] Buffer I/O error on dev sdb, logical block 0, async page read
[186056.683078] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[186056.683089] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[186056.683101] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[186056.683111] sd 2:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[186056.683120] blk_update_request: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[186056.683130] Buffer I/O error on dev sdb, logical block 0, async page read
[186056.683748] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[186056.683756] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[186056.683767] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[186056.683776] sd 2:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[186056.683784] blk_update_request: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[186056.683792] Buffer I/O error on dev sdb, logical block 0, async page read
[186056.684391] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[186056.684400] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[186056.684410] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[186056.684419] sd 2:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[186056.684427] blk_update_request: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[186056.684436] Buffer I/O error on dev sdb, logical block 0, async page read
[186056.684464] Dev sdb: unable to read RDB block 0
[186056.685041] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[186056.685049] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[186056.685059] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[186056.685068] sd 2:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[186056.685075] blk_update_request: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[186056.685084] Buffer I/O error on dev sdb, logical block 0, async page read
[186056.685742] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[186056.685750] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[186056.685759] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[186056.685766] sd 2:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[186056.685773] blk_update_request: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[186056.685780] Buffer I/O error on dev sdb, logical block 0, async page read
[186056.686383] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[186056.686391] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[186056.686399] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[186056.686408] sd 2:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 18 00 00 08 00
[186056.686414] blk_update_request: I/O error, dev sdb, sector 24 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[186056.686422] Buffer I/O error on dev sdb, logical block 3, async page read
[186056.687610]  sdb: unable to read partition table
[186056.689748] sd 2:0:0:0: [sdb] Attached SCSI disk
[186066.365445] scsi_io_completion_action: 4 callbacks suppressed
[186066.365461] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[186066.365467] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[186066.365471] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[186066.365477] sd 2:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[186066.365479] print_req_error: 4 callbacks suppressed
[186066.365483] blk_update_request: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[186066.365490] buffer_io_error: 3 callbacks suppressed
[186066.365493] Buffer I/O error on dev sdb, logical block 0, async page read
[186066.366003] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[186066.366006] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[186066.366011] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[186066.366015] sd 2:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[186066.366019] blk_update_request: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[186066.366023] Buffer I/O error on dev sdb, logical block 0, async page read
[186066.366535] sd 2:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[186066.366537] sd 2:0:0:0: [sdb] tag#0 Sense Key : Not Ready [current] 
[186066.366540] sd 2:0:0:0: [sdb] tag#0 Add. Sense: Medium not present
[186066.366542] sd 2:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
[186066.366545] blk_update_request: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[186066.366547] Buffer I/O error on dev sdb, logical block 0, async page read
mymedia@barberry:~$ sudo smartctl -a /dev/sdb
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-42-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Toshiba 2.5" HDD MQ01ABF...
Device Model:     TOSHIBA MQ01ABF050
Serial Number:    178QPDA1T
LU WWN Device Id: 5 000039 782e02099
Firmware Version: AM001J
User Capacity:    500 107 862 016 bytes [500 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Form Factor:      2.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 1.5 Gb/s)
Local Time is:    Sat Aug 15 11:51:05 2020 MSK
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                    without error or no self-test has ever 
                    been run.
Total time to complete Offline 
data collection:        (  120) seconds.
Offline data collection
capabilities:            (0x5b) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    Offline surface scan supported.
                    Self-test supported.
                    No Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine 
recommended polling time:    (   2) minutes.
Extended self-test routine
recommended polling time:    ( 124) minutes.
SCT capabilities:          (0x003d) SCT Status supported.
                    SCT Error Recovery Control supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000b   100   100   050    Pre-fail  Always       -       0
  2 Throughput_Performance  0x0005   100   100   050    Pre-fail  Offline      -       0
  3 Spin_Up_Time            0x0027   100   100   001    Pre-fail  Always       -       1380
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       5119
  5 Reallocated_Sector_Ct   0x0033   100   100   050    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000b   100   100   050    Pre-fail  Always       -       0
  8 Seek_Time_Performance   0x0005   100   100   050    Pre-fail  Offline      -       0
  9 Power_On_Hours          0x0032   063   063   000    Old_age   Always       -       15057
 10 Spin_Retry_Count        0x0033   201   100   030    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       1363
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       3396
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       165
193 Load_Cycle_Count        0x0032   081   081   000    Old_age   Always       -       195595
194 Temperature_Celsius     0x0022   100   100   000    Old_age   Always       -       32 (Min/Max 13/57)
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   253   000    Old_age   Always       -       0
220 Disk_Shift              0x0002   100   100   000    Old_age   Always       -       0
222 Loaded_Hours            0x0032   067   067   000    Old_age   Always       -       13360
223 Load_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
224 Load_Friction           0x0022   100   100   000    Old_age   Always       -       0
226 Load-in_Time            0x0026   100   100   000    Old_age   Always       -       192
240 Head_Flying_Hours       0x0001   100   100   001    Pre-fail  Offline      -       0

SMART Error Log Version: 1
ATA Error Count: 4
    CR = Command Register [HEX]
    FR = Features Register [HEX]
    SC = Sector Count Register [HEX]
    SN = Sector Number Register [HEX]
    CL = Cylinder Low Register [HEX]
    CH = Cylinder High Register [HEX]
    DH = Device/Head Register [HEX]
    DC = Device Command Register [HEX]
    ER = Error register [HEX]
    ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 4 occurred at disk power-on lifetime: 15056 hours (627 days + 8 hours)
  When the command that caused the error occurred, the device was in standby mode.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  04 51 00 00 00 00 a0

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  f4 00 01 00 00 00 a0 00      00:07:53.907  SECURITY ERASE UNIT
  f3 00 00 00 00 00 a0 00      00:07:53.906  SECURITY ERASE PREPARE
  ec 00 01 00 00 00 a0 00      00:07:53.901  IDENTIFY DEVICE
  f2 00 01 00 00 00 a0 00      00:07:23.856  SECURITY UNLOCK
  e5 00 00 00 00 00 00 00      00:04:44.769  CHECK POWER MODE

Error 3 occurred at disk power-on lifetime: 15056 hours (627 days + 8 hours)
  When the command that caused the error occurred, the device was in standby mode.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  04 51 00 00 00 00 a0

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  f2 00 01 00 00 00 a0 00      00:07:23.856  SECURITY UNLOCK
  e5 00 00 00 00 00 00 00      00:04:44.769  CHECK POWER MODE
  f2 00 01 00 00 00 a0 00      00:04:28.799  SECURITY UNLOCK
  f2 00 01 00 00 00 a0 00      00:04:17.548  SECURITY UNLOCK
  b0 d1 01 01 4f c2 a0 00      00:03:29.579  SMART READ ATTRIBUTE THRESHOLDS [OBS-4]

Error 2 occurred at disk power-on lifetime: 15056 hours (627 days + 8 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  04 51 00 00 00 00 a0

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  f2 00 01 00 00 00 a0 00      00:04:28.799  SECURITY UNLOCK
  f2 00 01 00 00 00 a0 00      00:04:17.548  SECURITY UNLOCK
  b0 d1 01 01 4f c2 a0 00      00:03:29.579  SMART READ ATTRIBUTE THRESHOLDS [OBS-4]
  b0 d0 01 00 4f c2 a0 00      00:03:27.838  SMART READ DATA
  ec 00 01 00 00 00 a0 00      00:03:27.824  IDENTIFY DEVICE

Error 1 occurred at disk power-on lifetime: 15056 hours (627 days + 8 hours)
  When the command that caused the error occurred, the device was in standby mode.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  04 51 00 00 00 00 a0

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  f2 00 01 00 00 00 a0 00      00:04:17.548  SECURITY UNLOCK
  b0 d1 01 01 4f c2 a0 00      00:03:29.579  SMART READ ATTRIBUTE THRESHOLDS [OBS-4]
  b0 d0 01 00 4f c2 a0 00      00:03:27.838  SMART READ DATA
  ec 00 01 00 00 00 a0 00      00:03:27.824  IDENTIFY DEVICE
  ec 00 01 00 00 00 a0 00      00:02:12.694  IDENTIFY DEVICE

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%     15057         -
# 2  Short captive       Completed without error       00%     15057         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

如何恢复这个?是否有可能?

диск
  • 1 个回答
  • 10 Views
Martin Hope
mymedia
Asked: 2020-02-02 16:02:37 +0000 UTC

如何在 Perl 中定义逻辑上下文?

  • 0

我知道 Perl 提供了三种基本上下文:标量、列表和空。在函数内部,您可以像这样使用wantarray定义要调用的代码的上下文。

return unless defined wantarray; # don't bother doing more
my @a = complex_calculation();
return wantarray ? @a : "@a";

此外,还有一个标量上下文的特殊亚种——逻辑(在if或grep条件中找到)。以及如何确定我的函数是在这样的逻辑上下文中调用的?在这种情况下,我可以优化计算。

这是一个很好的例子。有一种方法可以从数据库中计算表中的行数。它可以简单地用于查看该表中是否有任何行。很明显,如果这样调用该方法,那么扫描整个表是没有意义的,可以停在第一个合适的行。

unless (логический контекст) {
    sql("SELECT count(*) FROM test_table WHERE some_colum > 42");
} else {
    sql("SELECT EXISTS (SELECT 1 FROM test_table WHERE some_colum > 42)");
}
perl
  • 1 个回答
  • 10 Views
Martin Hope
mymedia
Asked: 2020-03-21 03:32:15 +0000 UTC

构造任意正则表达式的否定

  • 1

前言

编程中的正则表达式通常用于验证字符串。找出给定字符串是否满足给定表达式的任务在编写程序时经常发生。正则表达式在所有配置文件和设置中也很常见。但是,如果您可以在程序文本中使用编程语言中通常的否定运算符,那么在配置中情况可能会更加复杂。假设只有当带有条件的字符串不以某些子字符串开头时,您才需要应用一些配置部分,尽管配置语法只允许进行肯定检查(字符串是否满足正则表达式)。

所以,由于这样的问题经常把我带入死胡同,我决定用更一般的形式来表述它。

问题的形成

给定一个正则表达式,R其中包含任何、任意、以前未知的标记组合,在语法上对于PCRE引擎是正确的。你想找到一个正则表达式!R,它的语言是语言的补码R。也就是说,任何匹配的字符串R都不匹配!R,反之亦然。

有没有通用的解决方案?如果是这样,那么最好包括R作为子表达式。

регулярные-выражения
  • 2 个回答
  • 10 Views
Martin Hope
mymedia
Asked: 2020-01-30 04:09:46 +0000 UTC

如何在表中生成一千/百万/十亿条记录?

  • 3

为了评估我的应用程序的性能,我需要用大量的测试数据填充数据库。任务是用自动生成的数据填充现有表。想用一个或多个 SQL 查询来做到这一点。但是,我遇到了循环的困难——似乎它们不允许生成任意序列。也许有一个选项可以通过调用一些内置函数来构建一个具有无限行数的临时表?

例如,您可以指定问题:如何用以下数据自动填充表格?

|col1|col2|col3|col4|
|----|----|----|----|
|   0|   1|   0|    |
|   1|   2|   1|    |
|   2|   3|   0|    |
|   4|   4|   1|    |
|   8|   5|   0|    |
|  16|   6|   1|    |
    .   .   .   .
| 2^N| N+1| N%2|  * |

*您选择的任何公式

sql
  • 1 个回答
  • 10 Views
Martin Hope
mymedia
Asked: 2020-08-11 19:21:34 +0000 UTC

如何获取所有已定义宏的列表?

  • 3

如何找出在一个特定的翻译单元中定义了哪些宏?有没有办法打印这样的名单?

c++
  • 1 个回答
  • 10 Views
Martin Hope
mymedia
Asked: 2020-06-05 02:40:22 +0000 UTC

声音不适用于在 chroot 中运行的应用程序

  • 1

您需要在干净的环境中测试一个应用程序的性能。我为此使用 chroot。但是声音没有播放:(

PulseAudio 在主机上正常运行,如何在 chroot 环境中转发它?在阅读了FAQ的建议并了解了一点之后,我尝试这样做(目标目录表示为 $new_root_path,在那里执行chroot,并在那里部署Debian Unstable):

mkdir $new_root_path/tmp/myrundir
chmod 700 $new_root_path/tmp/myrundir
sudo mount --bind /var/lib/dbus $new_root_path/var/lib/dbus
sudo mount --bind $XDG_RUNTIME_DIR $new_root_path/tmp/myrundir
sudo mount --bind /dev/shm $new_root_path/dev/shm
sudo chroot $new_root_path su guest_user
export XDG_RUNTIME_DIR=/tmp/myrundir
mplayer ...

chroot 内的用户 UID 与我在环境外的 UID 相同。在 chroot 内部有包pulseaudio==10.0-1和dbus==1.10.18-1,在外部 - pulseaudio==8.0-0ubuntu3.2和dbus==1.10.6-1ubuntu3.3,它们的设置没有改变。

那么,如何在测试环境中运行我的应用程序(在 MPlayer 示例中)以便它可以播放声音?同时,我不想在 chroot 笼内连续转发所有目录,尤其是 home 和临时文件。


目录/var/lib/dbus中只有一个链接machine-id指向 /etc/machine-id. 在 chroot 内部,它将引用一个具有不同内容的文件。老实说,这让我很困惑,但是常见问题解答并没有对此做出任何澄清……怎么办?

linux
  • 1 个回答
  • 10 Views
Martin Hope
mymedia
Asked: 2020-04-12 04:37:14 +0000 UTC

如何删除 Vim 中匹配给定模式的行?

  • 1

如何删除 vim 中与模式匹配的行?

:%s/pattern//g只需将其替换为空字符串即可。
以及如何在不留空行的情况下进行删除?

基于“ vim:查找和删除行”

vim
  • 1 个回答
  • 10 Views
Martin Hope
mymedia
Asked: 2020-03-25 19:09:05 +0000 UTC

什么是 Firefox 的 Ubuntu 修改扩展?

  • 0

与OC一起安装的Firefox浏览器的Ubuntu Modifications扩展有什么作用?

在扩展列表中,它没有任何可理解的描述。这是另一个来自宇航员的间谍活动吗?

ubuntu
  • 1 个回答
  • 10 Views
Martin Hope
mymedia
Asked: 2020-02-26 02:14:24 +0000 UTC

处理文本文件中的特定行

  • 1
  1. 在所有偶数行的其中一个文本文件中,将行的第一个单词移动到行尾。只包含一个词的行不会被修改。

  2. -在其中一个文本文件中,删除以减号结尾的第二行。

使用 awk 以外的 head、tail、sed、pr 等命令。不要使用多个帮助文件。作为最后的手段,您可以使用 justification justification for、while 等结构。

linux
  • 1 个回答
  • 10 Views
Martin Hope
mymedia
Asked: 2020-02-24 08:50:50 +0000 UTC

如何在 zswap 模块中配置 lz4 压缩使用?

  • 2

我正在尝试配置zswap模块,以便从系统启动的一开始就启用交换空间压缩。为此,请在文件中 /etc/default/grub设置内核引导参数:

GRUB_CMDLINE_LINUX="zswap.enabled=1 zswap.zpool=zsmalloc zswap.compressor=lz4"

如果 lz4 压缩在启动时自动打开(或者紧接着,最重要的是,不是手动),一切都会好起来的。但是,使用默认值 lzo。

目录中的文件内容为/sys/modules/zswap/parameters:

/sys/module/zswap/parameters/compressor:lzo
/sys/module/zswap/parameters/enabled:Y
/sys/module/zswap/parameters/max_pool_percent:20
/sys/module/zswap/parameters/zpool:zsmalloc

这是与zswap相关的dmesg的输出:

[    1.140971] zswap: compressor lz4 not available, using default lzo
[    1.141064] zswap: loaded using pool lzo/zsmalloc

此外,如果您在登录后手动设置压缩方法,则安装不会出现问题 - 文件内容发生变化,dmesg报告成功,这样的命令无误地完成:

echo lz4 | sudo tee /sys/module/zswap/parameters/compressor

但是每次开机都要输入这样的命令让我很烦。我如何强制此内核模块自动使用 lz4 压缩,而无需额外的手动操作?

系统:Ubuntu 16.04

linux
  • 1 个回答
  • 10 Views
Martin Hope
mymedia
Asked: 2020-10-01 22:52:58 +0000 UTC

HTTPS 请求的持久连接

  • 2

在网上,我找到了几个如何发出 HTTPS 请求的示例。然而,它们都有一个非常严重的缺点:它们在从服务器接收到所有数据后立即关闭 TCP 连接。这不好。

这是一个例子

https = require('ssl.https')
local data, code = https.request('https://httpbin.org/get')

如何以最小的痛苦来补充它,以便连接不会关闭?

lua
  • 2 个回答
  • 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