### Install Build Dependencies on Ubuntu/Debian Source: https://github.com/chromium/dom-distiller/blob/main/README.md This script installs all necessary system-level build dependencies for DOM Distiller development on Ubuntu and Debian distributions. It must be executed from within the 'dom-distiller' project directory and requires superuser privileges to install packages. ```bash sudo ./install-build-deps.sh ``` -------------------------------- ### Install pip Python Package Manager on macOS Source: https://github.com/chromium/dom-distiller/blob/main/README.md This command installs 'pip', the standard package installer for Python, using 'easy_install'. Pip is essential for managing Python libraries, such as Selenium, which are dependencies for certain aspects of DOM Distiller development on macOS. ```bash sudo easy_install pip ``` -------------------------------- ### Start Data Labeling Web Server with server.py Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/README.md This command initiates the `server.py` script to host a web interface for human data labeling. It serves the collected data from the specified output directory, allowing users to manually label entries efficiently. ```bash ./server.py --data-dir out_dir ``` -------------------------------- ### Nexus 4 User-Agent String Example Source: https://github.com/chromium/dom-distiller/blob/main/README.md An example User-Agent string for a Nexus 4 device, suitable for use with the --user-agent command-line flag to simulate mobile browsing behavior. ```Shell --user-agent="Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 4 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19" ``` -------------------------------- ### Launch and Access Vagrant VM for DOM Distiller Development Source: https://github.com/chromium/dom-distiller/blob/main/README.md These commands are used to initialize and access the Vagrant virtual machine recommended for DOM Distiller development, especially on unsupported operating systems like Windows or Red Hat Linux. `vagrant up` starts the VM, and `vagrant ssh` provides command-line access to it. ```bash vagrant up ``` ```bash vagrant ssh ``` -------------------------------- ### Install Ant and Python via Homebrew on macOS Source: https://github.com/chromium/dom-distiller/blob/main/README.md This Homebrew command installs 'ant' and 'python', which are fundamental build tools required for developing DOM Distiller on macOS. Ensure Homebrew is properly installed and configured on your system before running this command. ```bash brew install ant python ``` -------------------------------- ### Install Git Hooks for DOM Distiller Development Source: https://github.com/chromium/dom-distiller/blob/main/README.md This command sets up symbolic links for Git hooks within the DOM Distiller project. These hooks automate pre-commit and post-merge checks, ensuring code quality and adherence to project standards before changes are committed or integrated. ```bash ./create-hook-symlinks ``` -------------------------------- ### Install Protobuf Compiler with Python Bindings on macOS Source: https://github.com/chromium/dom-distiller/blob/main/README.md This Homebrew command installs the Protocol Buffer compiler along with its Python bindings. This is a critical dependency for handling data serialization and communication within the DOM Distiller project on macOS development environments. ```bash brew install protobuf --with-python ``` -------------------------------- ### Install Selenium Python Library via pip on macOS Source: https://github.com/chromium/dom-distiller/blob/main/README.md This command installs the 'selenium' Python library using 'pip'. Selenium is commonly used for automated web browser testing and is a required dependency for specific development tasks within the DOM Distiller project on macOS. The '--user' flag ensures installation into the user's local site-packages. ```bash pip install --user selenium ``` -------------------------------- ### Use Bash Function for Content Extraction Source: https://github.com/chromium/dom-distiller/blob/main/README.md Example usage of the `distill` bash function, demonstrating how to pass a URL as an argument to extract its content. ```bash distill http://example.com/article.html ``` -------------------------------- ### Run get_screenshots.py for Initial Feature Extraction Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/README.md This command executes the `get_screenshots.py` script to generate screenshots and extract features from web pages. It requires an output directory (`out_dir`) and a file (`urls.txt`) containing the list of URLs to process. ```bash ./get_screenshots.py --out out_dir --urls-file urls.txt ``` -------------------------------- ### Run get_screenshots.py with XVFB for Consistent Screenshots Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/README.md To ensure consistent screenshot sizes and prevent GUI interruptions, this command runs `get_screenshots.py` within `xvfb-run`. It specifies a screen resolution and uses the same output and URL file parameters for data collection. ```bash xvfb-run -a -s "-screen 0 1600x5000x24" ./get_screenshots.py --out out_dir --urls-file urls.txt ``` -------------------------------- ### Export Data Index for Next Stage with get_screenshots.py Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/README.md After collecting sufficient data, this command uses `get_screenshots.py` with the `--write-index` option to export the collected data. This prepares the data for the subsequent labeling stage, ensuring proper organization for further processing. ```bash ./get_screenshots.py --out out_dir --urls-file urls.txt --write-index ``` -------------------------------- ### Execute Chromium Components Browser Tests Source: https://github.com/chromium/dom-distiller/blob/main/README.md This command runs the compiled `components_browsertests` binary to execute all automated tests. It's the basic way to trigger the test suite. ```bash out/Debug/components_browsertests ``` -------------------------------- ### Generate Ninja Build Files for Chrome with GN Source: https://github.com/chromium/dom-distiller/blob/main/README.md This command uses `gn args` to configure the Ninja build files for Chrome, specifically for the `out/Debug` directory. It's a prerequisite for building Chrome and ensures that the build system is set up correctly to include DOM Distiller support. ```bash gn args out/Debug ``` -------------------------------- ### Makefile for Concurrent Data Scrawling with get_screenshots.py Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/README.md This Makefile defines a target to run `get_screenshots.py` concurrently for a large number of URLs. It leverages `xvfb-run` and the `--resume` option, enabling parallel execution using `make -jN` for improved throughput. ```make ALL=$(addsuffix .target,$(shell seq 1000)) all: $(ALL) %.target : xvfb-run -a -s "-screen 0 1600x5000x24" ./get_screenshots.py --out out_dir --urls-file urls.txt --resume ``` -------------------------------- ### Run Chromium Browser Tests with Xvfb Source: https://github.com/chromium/dom-distiller/blob/main/README.md Prefixing the test command with `xvfb-run` allows executing Chromium browser tests without a graphical display, preventing pop-up windows. This is useful for automated environments or headless testing. ```bash xvfb-run out/Debug/components_browsertests ``` -------------------------------- ### Upload Changes to Chromium Gerrit for Review Source: https://github.com/chromium/dom-distiller/blob/main/README.md This command uploads local changes from the current branch to Chromium Gerrit, creating a new change list (CL) for code review. It requires a `@chromium.org` account and a password obtained from GoogleCode.com settings, which should be stored in `~/.netrc`. ```bash git cl upload ``` -------------------------------- ### Ant Build and Test Targets for DOM Distiller Project Source: https://github.com/chromium/dom-distiller/blob/main/README.md These `ant` commands are essential for building, testing, and packaging the DOM Distiller project. They allow developers to list available targets, run all tests or a subset, compile Java/GWT to JavaScript, extract standalone JavaScript files, and package final build artifacts. ```ant ant -p ant test ant test -Dtest.filter=$FILTER_PATTERN ant gwtc ant gwtc.jstests ant extractjs ant extractjs.jstests ant package ``` -------------------------------- ### Build and Run Chrome with DOM Distiller Enabled Source: https://github.com/chromium/dom-distiller/blob/main/README.md This command first builds the Chrome browser with the `chrome` target in the `out/Debug` directory using `autoninja`. Upon successful compilation, it launches the Chrome browser with the `--enable-dom-distiller` flag, allowing developers to test DOM Distiller functionality directly within Chrome. ```bash autoninja -C out/Debug chrome && out/Debug/chrome --enable-dom-distiller ``` -------------------------------- ### Format DOM Distiller Code with git cl format Source: https://github.com/chromium/dom-distiller/blob/main/README.md This command automatically formats the code according to DOM Distiller's guidelines. It requires specific symbolic links to `clang_format` and platform-specific `buildtools` directories to function correctly, ensuring consistent code style before uploading changes. ```bash git cl format ``` -------------------------------- ### Generate Training Output CSV for Distillability Model Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/README.md Combines derived features with the label to create CSV files for training the distillability model. It uses the most recently archived data as input for marking. ```bash ./write_features_csv.py --marked $(ls -rt out_dir/archive/*|tail -n1) --features out_dir/feature-derived --out labelled ``` -------------------------------- ### Basic CSS Styling for GWT Release Notes Page Source: https://github.com/chromium/dom-distiller/blob/main/third_party/gwt-2.7.0/release_notes.html This CSS snippet defines the foundational visual styles for the Google Web Toolkit release notes web page. It configures the body's background and text colors, font family, and size, while also applying specific styling to hyperlinks to enhance readability and user experience. ```CSS body { background-color: white; color: black; font-family: Arial, sans-serif; font-size: large; margin: 20px; } a { color: blue; font-weight: bold; } ``` -------------------------------- ### Restart Chrome with Mobile Emulation Flags Source: https://github.com/chromium/dom-distiller/blob/main/README.md Command to restart Google Chrome, enabling DOM Distiller and setting a custom User-Agent string for mobile device emulation. Replace "$USER_AGENT_FROM_CLIPBOARD" with the desired User-Agent string obtained from Developer Tools. ```Shell chrome --user-agent="$USER_AGENT_FROM_CLIPBOARD" --enable-dom-distiller ``` -------------------------------- ### Compare Distilled Content (Original vs. MHTML) Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/README.md Compares the distilled content generated from the original page with that generated from its MHTML archive. These two outputs are expected to be identical, with exceptions for cases like next page stitching or MHTML distillation failures. ```bash ./check_distilled_mhtml.py --dir out_dir ``` -------------------------------- ### Set Environment Variables for Chrome Desktop Integration Source: https://github.com/chromium/dom-distiller/blob/main/README.md These environment variables are crucial for integrating DOM Distiller with a Chrome desktop build. `CHROME_SRC` points to the Chromium source directory, and `DOM_DISTILLER_DIR` points to the DOM Distiller project root, enabling scripts to locate necessary files. ```bash export CHROME_SRC=/path/to/chromium/src export DOM_DISTILLER_DIR=/path/to/dom-distiller ``` -------------------------------- ### Run Chromium Browser Tests as Isolates via Swarming Source: https://github.com/chromium/dom-distiller/blob/main/README.md This sequence of commands builds the `components_browsertests_run` target and then executes the tests as isolates using the `swarming` tool. This method is suitable for distributed testing environments. ```bash autoninja -C out/Debug components_browsertests_run python tools/swarming_client/isolate.py run -s out/Debug/components_browsertests.isolated ``` -------------------------------- ### Resume Interrupted get_screenshots.py Execution Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/README.md If the data crawling process is interrupted, this command allows resuming the `get_screenshots.py` script from where it left off. It's used with `xvfb-run` to maintain consistency and avoid re-processing already completed entries, saving time. ```bash xvfb-run -a -s "-screen 0 1600x5000x24" ./get_screenshots.py --out out_dir --urls-file urls.txt --resume ``` -------------------------------- ### Build Chromium Components Browser Tests Source: https://github.com/chromium/dom-distiller/blob/main/README.md This command builds the `components_browsertests` target using `autoninja`, which is necessary before running automated tests in Chromium. It compiles the necessary components for browser testing. ```bash autoninja -C out/Debug components_browsertests ``` -------------------------------- ### Clone DOM Distiller Source Code Repository Source: https://github.com/chromium/dom-distiller/blob/main/README.md This command clones the entire DOM Distiller source code from the official Chromium Git repository. It creates a new 'dom-distiller' directory containing all project files. It's crucial to execute this command in the desired parent directory, outside of a main Chromium checkout. ```bash git clone https://chromium.googlesource.com/chromium/dom-distiller ``` -------------------------------- ### Automate DOM Distiller Build and Chrome Integration Source: https://github.com/chromium/dom-distiller/blob/main/README.md This bash function automates the process of building DOM Distiller and copying its generated artifacts into the Chrome source tree. It ensures that the latest compiled DOM Distiller code is available for Chrome to use, simplifying the development and testing workflow. ```bash roll-distiller () { ( (cd $DOM_DISTILLER_DIR && ant package) && \ rm -rf $CHROME_SRC/third_party/dom_distiller_js/dist/* && \ cp -rf $DOM_DISTILLER_DIR/out/package/* $CHROME_SRC/third_party/dom_distiller_js/dist/ && \ touch $CHROME_SRC/components/resources/dom_distiller_resources.grdp ) } ``` -------------------------------- ### Generate Training Output CSV for Long-Article Model Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/README.md Combines derived features with distilled features to create CSV files suitable for training the long-article model. This generates multiple 'labelled-*.csv' files. ```bash ./write_features_csv.py --distilled out_dir/dfeature-derived --features out_dir/feature-derived --out labelled ``` -------------------------------- ### Sanity Check Derived Features (Original Page) Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/README.md Compares derived features between JavaScript and native Chrome implementations for content from the original web page. This requires a Chrome version that supports distillability JSON dumping via the '--distillability-dev' command-line argument. ```bash ./check_derived_features.py --features out_dir/feature-derived ``` -------------------------------- ### Extract Web Page Content using Chromium Browser Tests Source: https://github.com/chromium/dom-distiller/blob/main/README.md This command runs a specific manual test (`MANUAL_ExtractUrl`) within `components_browsertests` to extract content from a given URL. It outputs the extracted HTML to `extract.out` and console logs to `extract.log`. ```bash xvfb-run out/Debug/components_browsertests \ --gtest_filter='*MANUAL_ExtractUrl' \ --run-manual \ --test-tiny-timeout=600000 \ --output-file=./extract.out \ --url=http://www.example.com \ > ./extract.log 2>&1 ``` -------------------------------- ### Re-extract Features from MHTML Archives with get_screenshots.py Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/README.md This command is used to re-extract features from previously saved MHTML archives after modifications to `extract_features.js`. It utilizes `xvfb-run` and the `--load-mhtml` and `--skip-distillation` options to process existing archives without re-distilling, speeding up iteration. ```bash xvfb-run -a -s "-screen 0 1600x5000x24" ./get_screenshots.py --out out_dir --urls-file urls.txt --load-mhtml --skip-distillation ``` -------------------------------- ### Define Bash Function for Iterative Content Extraction Source: https://github.com/chromium/dom-distiller/blob/main/README.md This bash function, `distill`, encapsulates the content extraction command, making it easier to repeatedly extract content from different URLs. It includes building the browser tests and running the manual extraction test. ```bash distill() { ( roll-distiller && \ autoninja -C out/Debug components_browsertests && xvfb-run out/Debug/components_browsertests \ --gtest_filter='*MANUAL_ExtractUrl' \ --run-manual \ --test-tiny-timeout=600000 \ --output-file=./extract.out \ --url=$1 \ > ./extract.log 2>&1 ) } ``` -------------------------------- ### Basic CSS Styling for GWT 2.7.0 Body and Elements Source: https://github.com/chromium/dom-distiller/blob/main/third_party/gwt-2.7.0/about.html This CSS snippet defines fundamental styling rules for the main body and specific UI elements within a Google Web Toolkit 2.7.0 application. It sets properties such as background color, text color, font family, font size, margins, and overflow for the body, and specific font styles for elements identified by IDs like 'title', 'version', 'intro', and 'attribs'. ```CSS body { background-color: white; color: black; font-family: Arial, sans-serif; font-size: 10pt; margin: 20px; overflow: hidden; } #title { font-size: 14pt; font-weight: bold; } #title a { text-decoration: none; } #version { font-size: 8pt; font-weight: bold; text-align: right; } #intro { margin: 10px 0px 10px 0px ; } #attribs { } ``` -------------------------------- ### Sanity Check Derived Features (MHTML Archive) Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/README.md Compares derived features extracted from an MHTML archive between JavaScript and native Chrome implementations. While features from MHTML should ideally be identical, known issues like non-deterministic results due to MHTML not being fully offline can cause discrepancies. ```bash ./check_derived_features.py --features out_dir/mfeature-derived --from-mhtml ``` -------------------------------- ### Run All JavaScript Tests in Chrome DevTools Source: https://github.com/chromium/dom-distiller/blob/main/README.md This JavaScript command, executed in the Chrome Developer Tools console, runs all available JavaScript tests for DOM Distiller. It's part of the interactive debugging workflow. ```javascript org.chromium.distiller.JsTestEntry.run() ``` -------------------------------- ### Run Filtered JavaScript Tests in Chrome DevTools Source: https://github.com/chromium/dom-distiller/blob/main/README.md This JavaScript command allows running a subset of tests by providing a regular expression filter. This is useful for focusing on specific tests during interactive debugging in Chrome Developer Tools. ```javascript org.chromium.distiller.JsTestEntry.runWithFilter('MyTestClass.testSomething') ``` -------------------------------- ### Filter Chromium Browser Tests by Pattern Source: https://github.com/chromium/dom-distiller/blob/main/README.md Use the `--gtest_filter` argument with a pattern to run only a subset of tests. This allows targeting specific tests, such as those related to 'Distiller', for focused debugging or execution. ```bash out/Debug/components_browsertests --gtest_filter=\*Distiller\* ``` -------------------------------- ### Recalculate Derived Features from Raw Features Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/README.md Recalculates derived features from existing raw features without re-extracting them. This is useful when the feature derivation logic has changed or for processing older datasets where derived features were not initially calculated. The raw features should be available in 'out_dir/feature'. ```bash ./calculate_derived_features.py --core out_dir/feature --out out_dir/feature-derived ``` -------------------------------- ### Define Core UI Styles for DOM Distiller Source: https://github.com/chromium/dom-distiller/blob/main/heuristics/distillable/index.html This CSS defines the visual appearance for various elements within the Chromium DOM Distiller UI, including table borders, status-based background colors (error, good, poor, bad), image holder styling, and navigation caret designs. It also includes utility classes for hiding elements and styling content containers, ensuring a consistent user interface. ```CSS table { border-collapse: collapse; } table, tr, td { border: 1px solid black; } .error { background-color: #aaaaaa; } .good { background-color: #aaffaa; } .poor { background-color: #aaaaff; } .bad { background-color: #ffaaaa; } tr.active { border: 3px solid blue; } #image-holder { width: 90%; margin: 0 auto; } #image-holder img { vertical-align: text-top; } #base-img { width: 66%; } #distilled-img { width: 33%; } .hidden { display: none; } #image-holder.error { border: 5px solid #aaaaaa; } #image-holder.good { border: 5px solid green; } #image-holder.poor { border: 5px solid blue; } #image-holder.bad { border: 5px solid red; } .content { background-color: #e0e0e0; } #data-viewer { background-color: white; } .content-holder { height: 100%; background-color: #e0e0e0; float: left; overflow: hidden; overflow-y: scroll; } .content-holder.active { display: block } button { height: 50px } .left-caret { float: left; cursor: pointer; width: 35px; height: 35px; position: relative; } .left-caret:before { content: ''; position: absolute; left: 12px; top: 25%; border-right: 12px solid #555; border-top: 12px solid transparent; border-bottom: 12px solid transparent; } .left-caret:hover:before { border-right: 12px solid #777; } .right-caret { float: right; position: relative; cursor: pointer; width: 35px; height: 35px; } .right-caret:before { content: ''; position: absolute; right: 12px; top: 25%; border-left: 12px solid #555; border-top: 12px solid transparent; border-bottom: 12px solid transparent; } .right-caret:hover:before { border-left: 12px solid #777; } .button-row { padding: 20px } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.