Skip to main content

Posts

Recover lost files on Windows, free and effective

 Windows File Recovery If necessary, download and launch the app from Microsoft Store. Press the Windows key, enter Windows File Recovery in the search box, and then select Windows File Recovery. When you are prompted to allow the app to make changes to your device, select Yes. In the Command Prompt window, enter the command in the following format:  winfr source-drive: destination-drive: [/mode] [/switches] There are 2 basic modes you can use to recover files: Regular and Extensive.  Regular mode examples Recover your Documents folder from your C: drive to the recovery folder on an E: drive. Don’t forget the backslash (\) at the end of the folder.   winfr C: E: /regular /n \Users\<username>\Documents\  Recover PDF and Word files from your C: drive to the recovery folder on an E: drive.  winfr C: E: /regular /n *.pdf /n *.docx  Extensive mode examples   winfr E: C: /extensive /n *invoice*  Recover jpeg and png photos from your...

Archiving all messages on LinkedIn

Open https://www.linkedin.com/ in a web browser, got to developer option and then paste the script in Console window and clink enter. timer = setInterval(() => { // select all messages items = document.querySelectorAll('div.msg-selectable-entity__checkbox-container > input'); for (let i = 0; i < items.length; i++) { items[i].click(); } setTimeout(() => { // click archive button buttons = document.querySelectorAll('div.display-flex.mvA > button[title="Archive"]'); if (buttons.length == 1) { buttons[0].click(); } }, 1000); }, 5000) Credit to Gaidar Magdanurov

Git: create a patch of the last two commits

 To merge two patch files into a single patch file or create a patch of the last two commits, you can use the `git diff` and `git apply` commands. Here are the steps for each scenario: ### Merge Two Patch Files into a Single Patch File: 1. Suppose you have two patch files named `patch1.patch` and `patch2.patch`. 2. To merge them into a single patch file, you can use the `cat` command:    ```bash    cat patch1.patch patch2.patch > combined.patch    ```    This command concatenates the contents of both patch files into a new file named `combined.patch`. ### Create a Patch of the Last Two Commits: 1. Generate a patch file for the last two commits using the `git diff` command:    ```bash    git diff HEAD~2..HEAD > last_two_commits.patch    ```    This command creates a patch file (`last_two_commits.patch`) that represents the changes introduced in the last two commits. 2. Apply the generated patch fil...

Find files that contain the word 'xxx' but do not contain the word 'yyy' in the same file

  Find files that contain the word 'xxx' but do not contain the word 'yyy' in the same file ```bash grep -rl 'xxx' /path/to/search/* | xargs grep -L 'yyy' ``` This command first searches for files containing 'xxx' using the `-r` (recursive) and `-l` (only file names) options. Then, it pipes the results to `xargs` to search for files that do not contain 'yyy' using the `-L` option. Make sure to replace `/path/to/search/*` with the actual path or file pattern you want to search.

Jackson vs Gson

Jackson vs Gson Choosing between Jackson and GSON depends on your specific needs and priorities. Both are excellent libraries, but they excel in different areas: Jackson: Strengths:     Performance: Generally outperforms GSON, especially for large and complex data sets and when using streaming APIs or annotations.     Flexibility: Offers extensive annotation support for customization, including support for inheritance and advanced features like "mix-in" annotations.     Advanced features: Provides a streaming API for incremental processing, tree model access, and support for data binding with other formats like XML. Weaknesses:     Steeper learning curve: Requires more knowledge of JSON processing mechanisms compared to GSON.     Complexity : Can be more complex to work with for simple tasks due to its rich feature set. GSON: Strengths:     Simplicity : Easier to learn and use, especially for basic JSON parsing and generati...

JavaHiddenGems

Johanjanssen JavaHiddenGems Make sure to start the Docker-webserver-cache container before running the OWASP dependency check or the Old GroupIds Alerter.  Github Examples Apache PDFBox  Create and change PDF files or extract content from PDF files https://pdfbox.apache.org/ Apache POI  Create, change and read files based on the Office Open XML standards (OOXML) such as Word and Excel files. https://poi.apache.org/ ArchUnit Verify the Java code's architecture with unit tests. https://www.archunit.org/ AssertJ Test code with assertions. https://assertj.github.io/doc/ AutoService Generator for ServiceLoader service providers. https://github.com/google/auto AutoValue Generate immutable value classes. https://github.com/google/auto Awaitility Test asynchronous applications with a DSL. https://github.com/awaitility/awaitility Buildpacks Create (Docker) images. https://buildpacks.io/ ClassGraph Classpath and module scanner for Java and other JVM languages. https://github.com/c...

Apache Spark main components

 Apache Spark has several main components that work together to enable distributed data processing. Here are the key components of Apache Spark: 1. **Driver Program:**    - The driver program is the main program that controls the execution of a Spark application. It defines the high-level control flow, creates SparkContext, and coordinates the distribution of tasks across the cluster. 2. **SparkContext:**    - SparkContext is the entry point for any Spark functionality. It coordinates the execution of Spark jobs and manages the distribution of tasks across the worker nodes. The driver program communicates with SparkContext to execute operations on the Spark cluster. 3. **Cluster Manager:**    - Spark supports various cluster managers for resource management, including Apache Mesos, Apache Hadoop YARN, and standalone mode. The cluster manager allocates resources and schedules tasks across worker nodes in the cluster. 4. **Executor:**    - Exec...