Gadget On - Computer Tips
This site stores technical tips/guides for Windows and Linux machines.
Windows 10 Tech Tips
- Custom Install: When setting up Windows 10 on a new PC, choose the Custom install option instead of the default Express install. It allows you to modify important aspects like privacy settings1.
- Remove Old Files: If you don't plan to revert to the previous Windows version, save disk space by getting rid of old OS files. Go to Control Panel > System and Security > Administrative Tools > Disk Clean-up, and toggle the 'Previous Windows installations' box1.
- Sign Out of Windows: To sign in as another user, click your name in the Start menu and choose Sign out1.
- Action Center: Windows 10 has a new Action Center that tracks notifications. Click the text bubble icon in the system tray to access it1.
- Snap Keyboard Shortcuts: Use Win key + Arrow key to snap windows to corners or quadrants without using the mouse1.
- Virtual Desktops: Use Windows key + Tab to open the Task View, where you can create and manage multiple virtual desktops. Organize your work by grouping related apps on separate desktops.
- Quick Access: Customize the Quick Access section in File Explorer. Pin frequently used folders for easy access, and Windows will display them there.
- Night Light: Reduce eye strain at night by enabling Night Light. Go to Settings > System > Display, and toggle it on. It reduces blue light emission, making your screen warmer and easier on the eyes.
- Clipboard History: Press Windows key + V to access your clipboard history. It stores multiple copied items, allowing you to paste them as needed.
- Snip & Sketch: Capture screenshots or annotate existing images using Snip & Sketch. Press Windows key + Shift + S to start snipping.
- Focus Assist: If you need uninterrupted work time, enable Focus Assist. It suppresses notifications during specific hours or when you're presenting. Find it in Settings > System > Focus Assist.
- Taskbar Customization: Right-click the taskbar to access options like Taskbar settings, Toolbars, and Task Manager. You can even pin your favorite apps to the taskbar for quick access.
- Emoji Keyboard: Press Windows key + . (period) to open the emoji picker. Express yourself with a wide range of emojis and symbols.
- Quickly Lock Your PC: Use Windows key + L to lock your computer instantly. It's a handy shortcut when you step away from your desk.
- File Explorer Search: In File Explorer, type your search query directly into the address bar. Windows will show matching files and folders.
- Essential Shortcuts:
- Ctrl + A: Select all content.
- Ctrl + C (or Ctrl + Insert): Copy selected items to clipboard.
- Ctrl + X: Cut selected items to clipboard.
- Ctrl + V (or Shift + Insert): Paste content from clipboard.
- Ctrl + Z: Undo an action (including undelete files, but with limitations).
- Ctrl + Y: Redo an action.
- Ctrl + Shift + N: Create a new folder on the desktop or in File Explorer.
- Alt + F4: Close the active window (if no active window is present, a shutdown box appears).
- Ctrl + D (Del): Delete selected item to the Recycle Bin.
- Shift + Delete: Delete the selected item permanently, bypassing the Recycle Bin.
- F2: Rename the selected item.
- Esc: Close the current task.
- Alt + Tab: Switch between open apps.
- PrtScn: Take a screenshot and store it in the clipboard.
- Windows key + I: Open the Settings app.
- Windows key + E: Open File Explorer.
- Windows key + A: Open the Action Center.
- Windows key + D: Display and hide the desktop.
- Windows key + L: Lock the device.
- Windows key + V: Open the Clipboard bin.
- Windows key + Period (.) or Semicolon (;): Open the emoji panel.
- Windows key + PrtScn: Capture a full screenshot in the "Screenshots" folder.
- Windows key + Shift + S: Capture part of the screen with Snip & Sketch.
- Windows key + Left arrow key: Snap an app or window to the left.
- Windows key + Right arrow key: Snap an app or window to the right.
- Desktop Shortcuts:
- Windows key (or Ctrl + Esc): Open the Start menu.
- Ctrl + Arrow keys: Change Start menu size.
- Ctrl + Shift + Esc: Open Task Manager.
- Ctrl + Shift: Switch keyboard layout.
- Ctrl + F5 (or Ctrl + R): Refresh the current window.
- Ctrl + Alt + Tab: View open apps.
- Ctrl + Arrow keys (to select) + Spacebar: Perform various actions.
- Troubleshoot common Windows 10 issues:
- Issues Updating Windows 10:
- Make sure your device is connected to the internet.
- Manually install updates via Settings > Update & Security > Windows Update.
- Run the Windows Update Troubleshooter from Settings > Troubleshoot12.
- Not Enough Storage Space for Updates:
- Windows 10 updates require storage space. Free up some room by removing unnecessary files or apps.
- Bluetooth Not Working:
- Check if Bluetooth is enabled in Settings > Devices > Bluetooth & other devices.
- Update Bluetooth drivers from the manufacturer's website.
- Cortana Issues:
- If Cortana isn't working, try restarting your PC.
- Check Cortana settings in Settings > Cortana.
- Windows Store Problems:
- If you can't open the Windows Store or download apps, reset the Store cache:
- Open Command Prompt as an administrator.
- Type wsreset.exe and hit Enter.
C++ Tips
- Avoid Including Multiple Libraries:Instead of including individual libraries (e.g., <iostream>, <vector>, <set>) one by one, you can use #include <bits/stdc++.h> to include all standard libraries at once. This is especially helpful in programming competitions where time is limited.
- Globally Define Statements:Define commonly used statements globally using #define. For example, if you frequently print “GFG!” in your code, you can define it as follows:
- #define gfg cout << "GFG!" << endl;
- Then use gfg wherever you need to print "GFG!"
- Use autofor Type Inference: When declaring variables, use auto to let the compiler infer the data type. For example:
- auto x = 42; // Compiler infers x as an int
- Prefer Range-Based forLoops: Use range-based for loops to iterate over containers (e.g., vectors, arrays, maps). They simplify code and prevent off-by-one errors:
- for (const auto& element : myVector) { // Process each element }
- Smart Pointers for Memory Management:Use smart pointers (std::unique_ptr, std::shared_ptr, std::weak_ptr) to manage memory automatically and avoid memory leaks.
- Understand Move Semantics:Learn about move semantics and use move constructors and move assignment operators to optimize performance when transferring ownership of objects.
- Avoid Global Variables:Minimize the use of global variables. Prefer local scope and encapsulation.
- Use constCorrectly: Mark variables and function parameters as const whenever possible to prevent accidental modifications.
- Know the Standard Library Algorithms:Familiarize yourself with standard algorithms (std::sort, std::find, etc.) provided by the C++ Standard Library.
- Learn About RAII (Resource Acquisition Is Initialization):Understand the concept of RAII and use it to manage resources (e.g., file handles, network connections) safely.
- Use emplace_backInstead of push_back: When adding elements to a std::vector, prefer emplace_back over push_back. emplace_back constructs the element in-place, avoiding unnecessary copies or moves:
- std::vector<int> myVector;
- emplace_back(42); // Efficiently adds 42 to the vector
- Avoid Raw Pointers When Possible:Use smart pointers (std::unique_ptr, std::shared_ptr, etc.) instead of raw pointers. Smart pointers manage memory automatically and provide better safety.
- Learn About the Rule of Three (or Five):Understand the Rule of Three (for user-defined copy constructors, copy assignment operators, and destructors) and the Rule of Five (which includes move semantics). These rules guide proper resource management.
- Use std::stringfor String Manipulation: Prefer std::string over C-style strings (char*). It provides safer and more convenient string manipulation methods.
- Know the Difference Between constand constexpr: const indicates immutability, while constexpr means a value can be computed at compile time. Use them appropriately based on your requirements.
- Avoid Global Variables and Singletons:Global variables and singletons can lead to unexpected side effects and make code harder to reason about. Minimize their use.
- Understand the Big O Notation:Learn about algorithmic complexity (Big O notation) to choose the most efficient data structures and algorithms for your tasks.
- Use std::make_uniqueand std::make_shared: When creating smart pointers, prefer std::make_unique and std::make_shared over direct constructor calls. They ensure exception safety.
- Learn About Lambda Expressions:Lambda expressions allow you to create anonymous functions. They’re useful for custom sorting, filtering, and other operations:
- auto customSort = { return a > b; };
- std::sort(myVector.begin(), myVector.end(), customSort);
- Explore the Standard Library Containers:Familiarize yourself with other containers like std::map, std::set, and std::queue. Each has unique features and use cases.
Linux Tech Tips
- Here are some essential Linux commands:
- ls: Displays information about files in the current directory.
- pwd: Shows the current working directory.
- mkdir: Creates a new directory.
- cd: Navigates between different folders.
- cp: Copies files from one directory to another.
- mv: Renames or moves files.
- rm: Deletes files.
- uname: Provides basic information about the operating system.
- cat: Displays file contents in the terminal.
- ps: Lists running processes.
- grep: Searches for patterns in files or output.
- chmod: Changes file permissions (e.g., read, write, execute).
- chown: Changes file ownership.
- df: Displays disk space usage.
- du: Shows the size of directories and files.
- top: Monitors system processes and resource usage.
- htop: An interactive version of top.
- wget: Downloads files from the web.
- tar: Creates or extracts compressed archives.
- history: Lists your command history.
- find: Searches for files and directories based on specific criteria (e.g., name, size, permissions).
- grep: A powerful tool for searching text patterns within files.
- sed: Stream editor for text manipulation (great for search and replace operations).
- awk: A versatile text processing tool for extracting and manipulating data.
- ssh: Securely connects to remote servers via the SSH protocol.
- scp: Securely copies files between local and remote systems.
- rsync: Efficiently synchronizes files and directories between systems.
- ncdu: Analyzes disk usage and provides a detailed summary.
- curl: Transfers data from or to a server using various protocols (HTTP, FTP, etc.).
- watch: Repeatedly runs a command and displays its output in real time.