For loops in C ++ – Computer Science Stack Exchange

There was a problem in c ++ when calculating the factorial of a number. And the problem was to solve it with for loops. In the answer, the syntax of the for loop was changed so that only the last value of the for loop and not the other values ​​are displayed (the syntax is attached in the photo). My question is why this "new" syntax works so that only the last value is shown, and how is this new syntax related to the following: for (initialization; condition; increment) instruction;
Enter image description here

Terminology – Does the callback concept of programming have a computer science foundation?

Although I have been serious with computer languages ​​in general since 2010 and as an amateur programmer with programming languages ​​in particular (mainly Bash and JavaScript scripts) since 2015 and codes written by me as distributed in my Code Review SE account across my Stack Exchange accounts are ,
I think I still understand what a call back is;
I have a feeling that the term itself could be misleading because I understand that callback functions do not "recall" anything, but are "recalled" in response to a condition (event).
I understand the alternative term Call for … as significantly controversial between programmers, I stick to "Callback" or its semantic siblings;
Every Stack Exchange session that I read about "callback" contained responses that other programmers considered contradicting or controversial and commented on.

My question

Since the examples that I read about this concept in Bash and JavaScript are not so clearly remembered, I ask:

The callback concept of programming has some basis in the computer
Science?

That is to be asked; There are some within the framework of a computer science theory logical forumla that can simulate all possible "callback functions" (similar to how a Turing machine can simulate all possible functions of a computer) that could facilitate understanding of the purpose of this concept?

Computer architecture -% var% reaches 0 and has to skip a segment

So I need% var% when it reaches 0 to jump to a code segment
I have tried:

Set / a gold =% gold% -500
If% gold% LSS & # 39; 0 & # 39; is go to a

Set / a gold =% gold% -500
If% gold% == & # 39; 0 & # 39; go to a

Set / a gold =% gold% -500
If% gold% NEQ 500, go to a
I am several thousand keystrokes in and want to end my project.

boot – Ubuntu does not start (reinstallation on new computer)

I am working on a new facility for my computer. My procedure for reinstalling the operating system on a 250 GB SSD. First I installed W10 with 200 GB with EFI and secure boot Option activated in BIOS. This works well on my computer. After that I installed Ubuntu on the same SSD (50 GB). The installation worked well and the GRUB2 works well too, as I see both boot options, Ubuntu and Windows (I can still start W10). However, Ubuntu freezes immediately after I start Ubuntu in the GRUB2 menu. After 1 – 2 s my keyboard freezes and there is nothing I can do.

Therefore I removed all partitions and only installed Ubuntu. The installation process works fine here too, but I choose Ubuntu after the Grub2 menu appears, it freezes again.

I am using a TRX40 Pro 10G motherboard with the latest BIOS update. The only thing I can analyze now is that dmsg when starting the live USB stick. Here I get some data that I cannot interpret. You may not need it here, but since I don't know what information might be of interest to correct this problem, I add this information here:

(    0.020007) smpboot: CPU0: AMD Ryzen Threadripper 3970X 32-Core Processor (family: 0x17, model: 0x31, stepping: 0x0)
(    0.020007) Performance Events: Fam17h core perfctr, AMD PMU driver.
(    0.020007) ... version:                0
(    0.020007) ... bit width:              48
(    0.020007) ... generic registers:      6
(    0.020007) ... value mask:             0000ffffffffffff
(    0.020007) ... max period:             00007fffffffffff
(    0.020007) ... fixed-purpose events:   0
(    0.020007) ... event mask:             000000000000003f
(    0.020007) rcu: Hierarchical SRCU implementation.
(    0.020007) random: crng done (trusting CPU's manufacturer)
(    0.020007) NMI watchdog: Enabled. Permanently consumes one hw-PMU counter.
(    0.020007) smp: Bringing up secondary CPUs ...
(    0.020007) x86: Booting SMP configuration:
(    0.020007) .... node  #0, CPUs:          #1
(    0.000000) WARNING: CPU: 1 PID: 0 at /build/linux-hwe-zHO4ZF/linux-hwe-5.0.0/arch/x86/kernel/cpu/mce/core.c:1490 mcheck_cpu_init+0x1a7/0x4c0
(    0.000000) Modules linked in:
(    0.000000) CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.0.0-23-generic #24~18.04.1-Ubuntu
(    0.000000) Hardware name: Micro-Star International Co., Ltd. MS-7C60/TRX40 PRO 10G (MS-7C60), BIOS 1.20 01/07/2020
(    0.000000) RIP: 0010:mcheck_cpu_init+0x1a7/0x4c0
(    0.000000) Code: 48 03 3d 44 30 1c 4f 45 31 c0 31 c9 ba 00 00 10 00 48 c7 c6 90 ba e4 b0 e8 26 3b 0d 00 e9 97 fe ff ff 39 d0 0f 84 e9 fe ff ff <0f> 0b e9 e2 fe ff ff c7 05 d8 c7 7e 01 89 01 00 00 e9 ff fe ff ff
(    0.000000) RSP: 0000:ffffb37b40207e90 EFLAGS: 00010002
(    0.000000) RAX: 000000000000001c RBX: ffff99da3ce4f040 RCX: 0000000000000179
(    0.000000) RDX: 0000000000000018 RSI: 0000000000000001 RDI: 0000000000000179
(    0.000000) RBP: ffffb37b40207ea8 R08: ffffb37b40207dd0 R09: ffffb37b40207dd4
(    0.000000) R10: 0000000000000c80 R11: ffff99ca7b7bcda8 R12: 0000000000000118
(    0.000000) R13: ffffffffb28fa060 R14: 0000000000000002 R15: 0000000000000000
(    0.000000) FS:  0000000000000000(0000) GS:ffff99da3ce40000(0000) knlGS:0000000000000000
(    0.000000) CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
(    0.000000) CR2: 0000000000000000 CR3: 0000000ac360e000 CR4: 0000000000340ea0
(    0.000000) Call Trace:
(    0.000000)  ? detect_ht+0xf/0xd0
(    0.000000)  identify_cpu+0x3ea/0x580
(    0.000000)  identify_secondary_cpu+0x18/0x90
(    0.000000)  smp_store_cpu_info+0x49/0x60
(    0.000000)  start_secondary+0xa6/0x200
(    0.000000)  secondary_startup_64+0xa4/0xb0
(    0.000000) ---( end trace 3ca88aad3131db8a )---
(    0.020069)    #2   #3   #4

I also get errors for ACPI errors. But I don't think the problem lies here either:

(    0.096076) ACPI: bus type PCI registered
(    0.096076) acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
(    0.096143) PCI: MMCONFIG for domain 0000 (bus 00-7f) at (mem 0xf0000000-0xf7ffffff) (base 0xf0000000)
(    0.096151) PCI: not using MMCONFIG
(    0.096151) PCI: Using configuration type 1 for base access
(    0.096151) PCI: Using configuration type 1 for extended access
(    0.097501) HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
(    0.097501) HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
(    0.100008) ACPI: Added _OSI(Module Device)
(    0.100008) ACPI: Added _OSI(Processor Device)
(    0.100008) ACPI: Added _OSI(3.0 _SCP Extensions)
(    0.100008) ACPI: Added _OSI(Processor Aggregator Device)
(    0.100008) ACPI: Added _OSI(Linux-Dell-Video)
(    0.100008) ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
(    0.100008) ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
(    0.117104) ACPI BIOS Error (bug): Failure creating (_SB.I2CA.WT1A), AE_ALREADY_EXISTS (20181213/dswload2-324)
(    0.117110) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20181213/psobject-221)
(    0.117112) ACPI: Skipping parse of AML opcode: Device (0x5B82)
(    0.117113) ACPI BIOS Error (bug): Failure creating (_SB.I2CA.MT1A), AE_ALREADY_EXISTS (20181213/dswload2-324)
(    0.117116) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20181213/psobject-221)
(    0.117117) ACPI: Skipping parse of AML opcode: Device (0x5B82)
(    0.117118) ACPI BIOS Error (bug): Failure creating (_SB.I2CA.WT2A), AE_ALREADY_EXISTS (20181213/dswload2-324)
(    0.117120) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20181213/psobject-221)
(    0.117122) ACPI: Skipping parse of AML opcode: Device (0x5B82)
(    0.117123) ACPI BIOS Error (bug): Failure creating (_SB.I2CA.MT2A), AE_ALREADY_EXISTS (20181213/dswload2-324)
(    0.117125) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20181213/psobject-221)
(    0.117126) ACPI: Skipping parse of AML opcode: Device (0x5B82)
(    0.117127) ACPI BIOS Error (bug): Failure creating (_SB.I2CA.WT3A), AE_ALREADY_EXISTS (20181213/dswload2-324)
(    0.117129) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20181213/psobject-221)
(    0.117130) ACPI: Skipping parse of AML opcode: Device (0x5B82)
(    0.117131) ACPI BIOS Error (bug): Failure creating (_SB.I2CA.MT3A), AE_ALREADY_EXISTS (20181213/dswload2-324)
(    0.117133) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20181213/psobject-221)
(    0.117135) ACPI: Skipping parse of AML opcode: Device (0x5B82)
(    0.117136) ACPI BIOS Error (bug): Failure creating (_SB.I2CA.WT4A), AE_ALREADY_EXISTS (20181213/dswload2-324)
(    0.117138) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20181213/psobject-221)
(    0.117140) ACPI: Skipping parse of AML opcode: Device (0x5B82)
(    0.117141) ACPI BIOS Error (bug): Failure creating (_SB.I2CA.MT4A), AE_ALREADY_EXISTS (20181213/dswload2-324)
(    0.117143) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20181213/psobject-221)
(    0.117145) ACPI: Skipping parse of AML opcode: Device (0x5B82)
(    0.117146) ACPI BIOS Error (bug): Failure creating (_SB.I2CA.MT5A), AE_ALREADY_EXISTS (20181213/dswload2-324)
(    0.117148) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20181213/psobject-221)
(    0.117150) ACPI: Skipping parse of AML opcode: Device (0x5B82)
(    0.117152) ACPI BIOS Error (bug): Failure creating (_SB.I2CB.WT1B), AE_ALREADY_EXISTS (20181213/dswload2-324)
(    0.117155) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20181213/psobject-221)
(    0.117156) ACPI: Skipping parse of AML opcode: Device (0x5B82)
(    0.117157) ACPI BIOS Error (bug): Failure creating (_SB.I2CB.MT1B), AE_ALREADY_EXISTS (20181213/dswload2-324)
(    0.117160) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20181213/psobject-221)
(    0.117161) ACPI: Skipping parse of AML opcode: Device (0x5B82)
(    0.117162) ACPI BIOS Error (bug): Failure creating (_SB.I2CB.WT2B), AE_ALREADY_EXISTS (20181213/dswload2-324)
(    0.117165) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20181213/psobject-221)
(    0.117166) ACPI: Skipping parse of AML opcode: Device (0x5B82)
(    0.117167) ACPI BIOS Error (bug): Failure creating (_SB.I2CB.MT2B), AE_ALREADY_EXISTS (20181213/dswload2-324)
(    0.117170) ACPI Error: AE_ALREADY_EXISTS, During name lookup/catalog (20181213/psobject-221)
(    0.117171) ACPI: Skipping parse of AML opcode: Device (0x5B82)

Any hint is welcome.
I also add missing information (I suspect a lot is missing here). Please note that the system also freezes from the recovery mode.

Network – Ethernet Disconnects the connection for a specific computer AND a specific socket frequently and temporarily

I have a specific problem with a specific desktop computer and a specific Ethernet wall socket. I've tried different approaches to fix the problem. Please read this post carefully as I describe it.

I have connected a desktop computer (details at the end of this article) to an Ethernet wall socket in my apartment. A few days ago I noticed that the internet was going to be interrupted for a short time. This was noticeable for the first time in a loss of video quality during streaming, but was also reflected in longer initial connection times when the computer was first switched on, regular changes to the network status icon and a disconnection from online gaming.

Of course, my first approach was to replace the Ethernet cable with another one. This did not solve the problem.

Next, I made sure that all WiFi connections in my device, such as B. on my mobile devices, work normally. There are no problems with the WiFi.

Next I tried to connect my work laptop to the same socket that the desktop computer used. I disabled the WiFi connection to the laptop to prevent switching if the signal fails. However, there were no problems using the laptop in the same socket that the desktop computer used.

I have a second wall outlet in my home office area, so I tried to take the desktop I was working on and connect to it. It gets interesting here. The desktop computer had no problems with this connector. In fact, I have been able to play an online game without interruption for a significant amount of time. Granted, the monitor in my home office is not in HD, so the download bandwidth requirements may be lower. However, they would still have been important and when I put them in the first socket there were still problems, even if no user programs were active.

I tried running the laptop on the first socket and the desktop on the second socket to see if the Windows Event Viewer detected disconnections but none were received on both computers.

Finally, I tried to connect the laptop to the first socket and to power it via the same power strip as the desktop computer with the desktop computer and its peripheral devices (speakers, external sound) (amplifier, monitor) all run at the same time. However, the event viewer did not find any connection problems with the laptop via the first socket, nor was it switched to battery power.

To summarize this problem JUST occurs with the desktop computer, and JUST occurs with this one particular jack.

That puts me in a kind of catch-22. I can't bring the desktop to the store (there is still a guarantee) and claim that there is something wrong with the ethernet card as it indicates that it is working properly in another socket. I cannot call my ISP because they indicate that the WiFi works, as well as the first socket with a laptop and the second socket with both computers. I can't get my building to look at it because they indicate that the jack with the laptop is working properly.

Any suggestions would be appreciated. Follow directions.

Desktop computer

Aeon 1080 Gaming Tower, Intel Core i7-7700, 3.6 GHz Quad-Core, 8 GB DDR4, 1 SSD with 240 GB and 1 hard disk with 1 TB, RealTek PCIe GbE family controller, Windows 10 Home 64 bit

Laptop

Lenovo ThinkPad, Intel Core i5-8250U 1.60 GHz, 8 GB RAM, 256 GB SSD, RealTek PCIe GbE controller, Windows 10 Pro 64 bit

Is Google Search Personalized? – Computer Science Stack Exchange

Thank you for sending an answer to Computer Science Stack Exchange!

  • Please be sure to answer the question, Provide details and share your research!

But avoid

  • Ask for help, clarify, or respond to other answers.
  • Make statements based on opinions; Provide them with references or personal experience.

Use MathJax to format equations. Mathjax reference.

For more information, see our tips on writing great answers.

gameserver – I made a server-client-TCP connection, but this only works if the server and client are on the same computer. Any ideas?

So I want to start by being an absolute beginner in networking.

I create a game in C ++ and use SFML for networking (both the server and the client are in C ++, SFML). And I successfully created a server-client connection so I can send packets from one to the other. However, this only works if the server and the client are on the same computer (or on the same Internet connection (router)).

What I want to achieve is a server on my computer that can connect to my friends (who are not on the same router) after starting.

I tried to forward the port I'm using from the PC the server is running on, but it doesn't seem to work.

Any ideas?

Lexicographically minimal string rotation – Computer Science Stack Exchange

Thank you for sending an answer to Computer Science Stack Exchange!

  • Please be sure to answer the question, Provide details and share your research!

But avoid

  • Ask for help, clarify, or respond to other answers.
  • Make statements based on opinions; Provide them with references or personal experience.

Use MathJax to format equations. Mathjax reference.

For more information, see our tips on writing great answers.