Wikipedia:Reference desk/Archives/Computing/2020 August 19
Computing desk | ||
---|---|---|
< August 18 | << Jul | August | Sep >> | August 20 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
August 19
editWhen do we need to explicitly call QWidget::update() or QWidget::repaint() ?
editIf I understand correctly, Qt will automatically generate paint events whenever a widget has some visual changes that need to be repainted. So what's the point of explicitly calling QWidget::update() or QWidget::repaint() while Qt has already done all the repainting jobs for us? - Justin545 (talk) 00:37, 19 August 2020 (UTC)
- If there's some change to the internal state of your app, which you want to be displayed, Qt doesn't know about that, so it can't generate the paint event. For example, if you implemented a network-activity-monitor widget, which drew a graph showing packets sent and received, in real(ish) time, you'd have to periodically ask Qt to schedule a repaint. Or if you were implementing a ray tracer, which did a multi-hour long calculation on another thread, but you wanted to periodically display the progress it had made, you can have that worker thread periodically schedule a repaint (e.g. every time it calculates a new scanline of the final image). -- Finlay McWalter··–·Talk 11:08, 19 August 2020 (UTC)
- Indeed, it's a good point that custom widgets inherit from QWidget may need to call update() or repaint(). Thanks for the answer. By the way ... what is a ray tracer? Is it related to 3D graphics? - Justin545 (talk) 13:17, 19 August 2020 (UTC)
- A program that does Ray tracing (graphics). -- Finlay McWalter··–·Talk 13:19, 19 August 2020 (UTC)
DNS Lookup
editIs there either a web site that will provide a DNS lookup client, or a DNS lookup app that I can run on Windows 10, or a DNS lookup command that I can issue from a DOS box? (We know it isn't a DOS box, but we know what it is and what it is called.) That is, I want to be able to enter a URL, such as en.wiki.x.io or www.google.com, and get back an IP address. It would be really good if it could also provide me with rwhois on the IP address. I am persistently receiving certain spams that "advertise" certain stupid web sites. I would like to look up what IP address the URL resolves to, and then who the IP address is assigned to by ARIN or RIPE. Yes, I do know how to read headers. What is a convenient way to do a DNS lookup? Robert McClenon (talk) 04:42, 19 August 2020 (UTC)
- nslookup is the tool you are looking for under ms dos. ping also does dns lookup as part of its measurement. Regards, Comte0 (talk) 06:41, 19 August 2020 (UTC)
- User:Comte0 - Thank you. But how do I invoke nslookup or ping under Windows 10? I recall that they used to work under earlier versions of Windows, so it may have to do with what directories are being searched. I am getting 'nslookup' is not as an internal or external command, operable program, or batch file. So how do I get it to function as an external command, operable program, or batch file? Robert McClenon (talk) 23:27, 19 August 2020 (UTC)
- Robert McClenon, nslookup.exe lives in %WINDIR%\System32. In the past, I would have thought that the network debug tools were part of an "Optional feature" to be installed through "Settings -> Apps -> Optional features" but there is no corresponding package installed on my system. What edition of Windows 10 do you have? Elizium23 (talk) 00:33, 20 August 2020 (UTC)
- Robert McClenon you may try to set the path to the one given by Elizium23 with the command:
SET PATH=%WINDIR%\System32
- before running e.g.
nslookup en.wiki.x.io
Regards, Comte0 (talk) 02:12, 20 August 2020 (UTC)- User:Comte0 - That worked. Thanks. Robert McClenon (talk) 16:07, 20 August 2020 (UTC)
- By the way,entering an IP address of 89.36.308.122 does not work, but it shouldn't. Robert McClenon (talk) 16:19, 20 August 2020 (UTC)
- Robert McClenon In the dns, the relationship between a name and 89.36.308.122, and the relationship between 89.36.308.122 and a name are two different, distinct things. The relationship between a name and 89.36.308.122 is called an A record, and the relationship between 89.36.308.122 and a name is called a PTR record. You can have an A record without a corresponding PTR record.
- There is no PTR record associated to 122.308.36.89.in-addr.arpa. (yes, it's looked up in reverse order), so nslookup 89.36.308.122 is expected to fail.
- You may want to read rfc 1034 for a deeper understanding of the dns. Regards, Comte0 (talk) 17:24, 20 August 2020 (UTC)
- User:Comte0 - The reason that 89.36.308.122 didn't work on rwhois is both simple and subtle. It looks like an IP address but can't be an IPv4 address because 308 > 255. That was a typo on my part. The IP address that I was trying to look up was really 89.36.208.122. Robert McClenon (talk) 01:48, 24 August 2020 (UTC)
- Ah yes, I didn't notice it. Sorry about that. Regards, Comte0 (talk) 03:02, 24 August 2020 (UTC)
- User:Comte0 - The reason that 89.36.308.122 didn't work on rwhois is both simple and subtle. It looks like an IP address but can't be an IPv4 address because 308 > 255. That was a typo on my part. The IP address that I was trying to look up was really 89.36.208.122. Robert McClenon (talk) 01:48, 24 August 2020 (UTC)
- Robert McClenon, nslookup.exe lives in %WINDIR%\System32. In the past, I would have thought that the network debug tools were part of an "Optional feature" to be installed through "Settings -> Apps -> Optional features" but there is no corresponding package installed on my system. What edition of Windows 10 do you have? Elizium23 (talk) 00:33, 20 August 2020 (UTC)
- User:Comte0 - Thank you. But how do I invoke nslookup or ping under Windows 10? I recall that they used to work under earlier versions of Windows, so it may have to do with what directories are being searched. I am getting 'nslookup' is not as an internal or external command, operable program, or batch file. So how do I get it to function as an external command, operable program, or batch file? Robert McClenon (talk) 23:27, 19 August 2020 (UTC)
- @Robert McClenon: You may also try searching the Web for "online dns lookup". You'll find multiple www services with DNS lookup, ping, traceroute, whois and other functions. --CiaPan (talk) 07:52, 19 August 2020 (UTC)
- The solution is to avoid the fight with a junk email filter. You can't stop the spammers. It is truly impossible. 97.82.165.112 (talk) 15:47, 19 August 2020 (UTC)
- I have an email filter. This one is getting by the filter. Robert McClenon (talk) 23:27, 19 August 2020 (UTC)
- It sounds like you want to script this anyway, so install Python (there is a convenient Windows .msi for that) and use the socket.gethostbyname() function. 2602:24A:DE47:BB20:50DE:F402:42A6:A17D (talk) 21:58, 19 August 2020 (UTC)
Default Path
editNext question: Is there, in Windows 10, a .BAT file that I can request be invoked when I start up a command prompt? This was a feature of DOS, but of course DOS boxes are no longer really DOS. Robert McClenon (talk) 16:07, 20 August 2020 (UTC)
- Do you mean DOSbox or cmd.exe. Despite some confusing comments above, cmd.exe on NT variants of Windows is not DOS nor is it a DOS box. On Windows x32 versions of Windows, cmd.exe could be to interact with NTVDM, but it's still confusing to call it a DOS box and of course NTVDM doesn't exist now that most people are using x64 versions of Windows. Nil Einne (talk) 16:13, 20 August 2020 (UTC)
BTW, I believe you can use the Command Processor\AutoRun registry key to make something run by default when a cmd.exe process is started [1] [2] [3]. (Although those only refer to older versions of Windows, I don't think it has changed.) Depending on how you normally start cmd.exe, you could potentially fool around with the shortcut too. (This would likely work with finding the command prompt in the start menu, and typing cmd.exe into it, but not with launching it from right clicking on the start menu or running it from the run box.) I've never used it myself, but from what I read there, I think you should be able to use it to run a cmd/batch script.
But note if you want to change the default path for cmd.exe in Windows, running a .bat on launch seems a potentially flawed way to go about it. I suggest editing the PATH (variable) in Windows, either system or user. Just type environmental variables into the Start Menu or Settings app or Control Panel should find the tool. But alternatively you could use Control Panel\System and Security\System\Advanced system settings\Environmental variables.
To be fair this will affect everything that uses the path and I'm not aware of any simple way to change the default path for cmd.exe only. So if you really want to change the path for cmd.exe only you may have to do something like that. But you probably should first consider why you only want to change it for cmd.exe only. As our article mentions, system32 is generally in the (user?) path and there's often no good reason to remove it since a lot of useful stuff is in it, including cmd.exe itself.
Also, on Windows 10 (and possibly any version of Windows since Vista), simply typing nslookup into the start menu will probably find nslookup. (Always remember since Windows Vista, the first step to try when looking for a program or tool or system setting tends to be simply typing it into the Start Menu.) Since it's program which accepts user input rather than simply requiring command line options (like ping is), you can probably just run it from there. BTW, AFAIK since at least XP, nslookup has been available by default on an ordinary install of Windows although it's possible some weird OEM installs, and other stuff like XP lite removed it.
- A final comment. On most versions of Windows 10 including I think Windows 10 Home, PowerShell should be available by default. You can use the Resolve-DnsName cmdlet in PowerShell as a DNS resolver. [4] Nil Einne (talk) 17:14, 20 August 2020 (UTC)
- User:Nil Einne - Thank you. I will look into PowerShell. Robert McClenon (talk) 01:43, 24 August 2020 (UTC)