Jump to content

Sensei

Senior Members
  • Posts

    6474
  • Joined

  • Last visited

  • Days Won

    16

Sensei last won the day on December 16 2021

Sensei had the most liked content!

6 Followers

Profile Information

  • Interests
    Quantum Physics, C/C++/.NET Framework/Java programming.
  • Favorite Area of Science
    Quantum Physics

Recent Profile Visitors

53301 profile views

Sensei's Achievements

Genius

Genius (11/13)

1.1k

Reputation

  1. Where? In a 3D app? In OpenGL/Direct3D? In the Unity/Unreal etc. game engine? In C/C++/C#/Java etc. ? C/C++ code: void moveTo( int x, int y ) { // fill me } void lineTo( int x, int y ) { // fill me } void hexagon( int x, int y, int radius ) { for( int i = 0; i < 6; i++ ) { double angle1 = 2.0 * M_PI * 360.0 * i / 6; double angle2 = 2.0 * M_PI * 360.0 * ( i + 1 ) / 6; moveTo( x + sin( angle1 ) * radius, y + cos( angle1 ) * radius ); lineTo( x + sin( angle2 ) * radius, y + cos( angle2 ) * radius ); } } In the 3D application. I used the Sphere tool, set Z to 0 to have a circle, changed the number of segments to 6, and then used the Array tool:
  2. How many % of these people are obese? https://www.weforum.org/agenda/2020/05/this-is-why-people-with-obesity-are-more-likely-to-die-from-coronavirus
  3. @StringJunky The keyword here are "laptop", "preinstalled OS"/"OEM OS".. https://en.wikipedia.org/wiki/Original_equipment_manufacturer All of the laptops I bought came with Windows OEM pre-installed. The older ones came with a label on the back with a license key. The newer ones have it encoded into the hardware. All of the desktop computers (x86, Macs excluded) that I bought did not have an operating system pre-installed. They were simply separate pieces of hardware...
  4. Aren't you talking about laptops that have the OS preinstalled by default? https://www.google.com/search?q=read+license+key+from+laptop+motherboard
  5. Disk failure (especially HDD which takes more energy than SSD) can be a sign of cable problems or PSU problems.. 1) replace SATA cables. 2) replace PSU. Measure the voltages on the power supply. Without a heavy load and with a heavy load. ps. All my problems with PC for the last year were caused by the PSU giving too low a voltage at random times. Periodic heavy use of the CPU/GPU, plugging in DVD drives and several drives caused them to occur faster. PSU does not have to be permanently damaged. It just can give you 4.5V instead of 5V and 11V or 13V instead of 12V. When there is heavy HDD usage, HDD is shutting down, and cannot start spinning again, until reboot. Data on NTFS is lost and logical errors start appearing on volumes. And OS becomes unstable.
  6. I saw the movie and enjoyed it. Personally, I think real politicians would have fared worse in a similar crisis. Humanity is facing a climate change crisis. All the politicians have done is raise taxes on CO2 emissions, which has only hit ordinary people in the pockets.. Any reason to raise taxes is good for politicians, all kinds of politicians.. People who have less money in their pockets are less likely to buy expensive electric cars, install renewable power generators, upgrade their homes to zero emission, etc. etc. Which causes people to turn away, to become discouraged, to start fighting change because it affects them personally.. If a crisis similar to the one depicted in the movie were to happen for real, we can expect to see taxes raised..
  7. BTW, if anyone is interested in where JW Telescope is, there is an online tracker available: https://www.jwst.nasa.gov/content/webbLaunch/whereIsWebb.html
  8. Configure RAID in mirror mode. https://en.wikipedia.org/wiki/Standard_RAID_levels
  9. As usual in these kinds of questions... Answer them accordingly to your knowledge.... Otherwise it will be a lie! If you don't know the answers to the questions, then you need to read and learn something that is still missing...
  10. Merry Christmas! Dear friends, during Christmas we share gifts, so I did not come empty handed, but I have gifts for you. C# scripts that you can compile yourself on your Windows computers (sorry Linux geeks!). ScreenCapture Compilation: On Windows 7+ it should work without any additional installation. On Vista change the version from v3.5 to v3.0, or install .NET Framework v3.5, if needed. On WinXP install .NET Framework v3.5+, if needed. Start, cmd, cd [the location where you stored ScreenCapture.cs] %SYSTEMROOT%\Microsoft.NET\Framework\v3.5\csc ScreenCapture.cs If you are having problems, you can change from v3.5 to the version you have installed. Verify it by dir %SYSTEMROOT%\Microsoft.NET\Framework\v* Usage: e.g. ScreenCapture -d -v %TEMP%\picture.png ScreenCapture -d D:\screen-shots\picture.jpg ScreenCapture D:\screen-shots\image.bmp It will generate image files e.g. picture_20211226_173530.png picture_20211226_173532.jpg image.bmp with datestamp i timestamp included in the file name (thanks to -d option). File name is unique per second. If you want to add milliseconds, modify the dateformat string in line #115 to e.g. string dateformat = "_yyyyMMdd_HHmmss_fff"; https://docs.microsoft.com/en-us/dotnet/standard/base-types/how-to-display-milliseconds-in-date-and-time-values Assign it to the 3rd mouse button and/or hotkey for quick access and press on demand. Image files will be created in the desired location. Source code: // ScreenCapture v1.0.1 (c) 2021 Sensei // Capture the screen to an image file // // Usage: // ScreenCapture [-d|--datestamp] [-v|--verbose] filename // // Compilation: // %SYSTEMROOT%\Microsoft.NET\Framework\v3.5\csc ScreenCapture.cs // using System; using System.IO; using System.Runtime.InteropServices; using System.Drawing; using System.Drawing.Imaging; using System.Collections.Generic; public class ScreenCapture { private class GDI32 { public const int SRCCOPY = 0x00CC0020; [DllImport("gdi32.dll")] public static extern bool BitBlt( IntPtr hDCDst, int nXDst, int nYDst, int nWidth, int nHeight, IntPtr hDCSrc, int nXSrc, int nYSrc, int dwRop ); [DllImport("gdi32.dll")] public static extern IntPtr CreateCompatibleBitmap( IntPtr hDC, int nWidth, int nHeight ); [DllImport("gdi32.dll")] public static extern IntPtr CreateCompatibleDC( IntPtr hDC ); [DllImport("gdi32.dll")] public static extern bool DeleteDC( IntPtr hDC ); [DllImport("gdi32.dll")] public static extern bool DeleteObject( IntPtr hObject ); [DllImport("gdi32.dll")] public static extern IntPtr SelectObject( IntPtr hDC, IntPtr hObject ); } private class User32 { [StructLayout(LayoutKind.Sequential)] public struct Rect { public int left, top, right, bottom; } [DllImport("user32.dll")] public static extern IntPtr GetDesktopWindow(); [DllImport("user32.dll")] public static extern IntPtr GetWindowDC( IntPtr hWnd ); [DllImport("user32.dll")] public static extern IntPtr GetWindowRect( IntPtr hWnd, ref Rect rect ); [DllImport("user32.dll")] public static extern IntPtr ReleaseDC( IntPtr hWnd, IntPtr hDC ); [DllImport("user32.dll")] public static extern int SetProcessDPIAware(); } public static Image CaptureScreen() { return CaptureWindow( User32.GetDesktopWindow() ); } public static Image CaptureWindow( IntPtr hWnd ) { IntPtr hDCSrc = User32.GetWindowDC( hWnd ); User32.Rect rect = new User32.Rect(); User32.GetWindowRect( hWnd, ref rect ); int width = rect.right - rect.left; int height = rect.bottom - rect.top; IntPtr hDCDst = GDI32.CreateCompatibleDC( hDCSrc ); IntPtr hBitmap = GDI32.CreateCompatibleBitmap( hDCSrc, width, height ); IntPtr hBitmapOld = GDI32.SelectObject( hDCDst, hBitmap ); GDI32.BitBlt( hDCDst, 0, 0, width, height, hDCSrc, 0, 0, GDI32.SRCCOPY ); GDI32.SelectObject( hDCDst, hBitmapOld ); GDI32.DeleteDC( hDCDst ); User32.ReleaseDC( hWnd, hDCSrc ); Image image = Image.FromHbitmap( hBitmap ); GDI32.DeleteObject( hBitmap ); return( image ); } public static void CaptureScreenToFile( string filename ) { string extension = Path.GetExtension( filename ); if( String.IsNullOrEmpty( extension ) ) throw( new Exception( "Missing extension" ) ); ImageFormat format = GetImageFormatByExtension( extension ); Image image = CaptureScreen(); image.Save( filename, format ); } public static ImageFormat GetImageFormatByExtension( string extension ) { Dictionary<String, ImageFormat> formats = new Dictionary<String, ImageFormat>(); formats.Add( "bmp", ImageFormat.Bmp ); formats.Add( "emf", ImageFormat.Emf ); formats.Add( "exif", ImageFormat.Exif ); formats.Add( "jpg", ImageFormat.Jpeg ); formats.Add( "jpeg", ImageFormat.Jpeg ); formats.Add( "gif", ImageFormat.Gif ); formats.Add( "png", ImageFormat.Png ); formats.Add( "tiff", ImageFormat.Tiff ); formats.Add( "wmf", ImageFormat.Wmf ); try { extension = extension.Substring( 1 ); extension = extension.ToLower(); return( formats[ extension ] ); } catch( Exception e ) { throw( new Exception( "Unknown extension " + extension, e ) ); } } public static void Help() { Console.WriteLine( "ScreenCapture v1.0.1 (c) 2021 Sensei" ); Console.WriteLine( "Usage:" ); Console.WriteLine( "ScreenCapture [-d|--datestamp] [-v|--verbose] filename" ); } public static void Main( string [] args ) { if( Environment.OSVersion.Version.Major >= 6 ) { User32.SetProcessDPIAware(); // Added in Vista OS. } if( args.Length > 0 ) { string dateformat = "_yyyyMMdd_HHmmss"; bool datestamp = false; bool verbose = false; for( int i = args.Length - 2; i >= 0; i-- ) { string arg = args[i]; if( arg.Equals( "-d" ) || arg.Equals( "--datestamp" ) ) { datestamp = true; } else if( arg.Equals( "-v" ) || arg.Equals( "--verbose" ) ) { verbose = true; } } string filename = args[ args.Length - 1 ]; if( datestamp ) { string extension = Path.GetExtension( filename ); filename = filename.Substring( 0, filename.Length - extension.Length ); filename = filename + DateTime.Now.ToString( dateformat ) + extension; } try { CaptureScreenToFile( filename ); if( verbose ) Console.WriteLine( "Screen captured to " + filename ); } catch( Exception e ) { Console.WriteLine( e.Message ); } } else { Help(); } } } Please don't hesitate to share your ideas for improvement. ScreenCapture.cs
  11. Tunnel effect or quantum tunneling? https://en.wikipedia.org/wiki/Tunnel_effect https://en.wikipedia.org/wiki/Quantum_tunnelling
  12. ...the science forum warped colors after analyzing your thread...
  13. Keywords for the search engine: binary search, binary tree, quad tree, octree, kd-tree, bsp-tree, hash map/hash table. Read Wikipedia of these space-partitioning algorithms. They work with 1D and/or 2D and/or 3D.
  14. There are ~ 3131 isotopes of 118 elements. The vast majority unstable or extremely unstable. Which one do you want to know? You need to be specific. The vast majority of these isotopes have not been isolated in sufficient quantity to properly test their physical and chemical differences from the most abundant stable isotopes of the element. The differences between the isotopes are used to isolate them. The most noticeable differences are only apparent at the quantum level, i.e., to isolate a single isotope or element, a mass spectrometer can be used. Isotopes/elements with different m/e deflect differently in a strong magnetic field and accelerate differently (due to mass difference) in an electric field. Mass vary significantly from isotope to isotope, from element to element. In the case of Hydrogen-Deuterium-Tritium it is +100% / +200%. In the case of Uranium-235 vs U-238 it is just +1%...
  15. ..these fines are generally senseless.. It is procedure "how to produce domestic terrorists" | "how to produce criminals".. etc. etc. ..restaurants can sell on-line (and should! as long as they are not luxury restaurants they can operate pretty fine with on-line sales, if people can't go any restaurant nor shop, and there is a reliable delivery system) but there are businesses which completely rely on client coming in physically, and 1) unable to freely operate and 2) have to pay debts, office rents, fines (?) and 3) get fined if they are open... An endless loop... Not possible to pay fine, if you don't operate, and can't operate unless breaking the law which prohibits being open.. Complete madness.. Mutually exclusive..
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.